@nocobase/plugin-ai 2.1.0-alpha.10 → 2.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/ai-employees/cole.d.ts} +1 -3
  2. package/dist/{server/ai-employees/built-in/nocobase-assistant/prompt.js → ai/ai-employees/cole.js} +15 -7
  3. package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/ai-employees/dara.d.ts} +1 -3
  4. package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
  5. package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/ai-employees/dex.d.ts} +1 -3
  6. package/dist/{server/ai-employees/built-in/data-organizer/prompt.js → ai/ai-employees/dex.js} +15 -7
  7. package/dist/ai/ai-employees/ellis.d.ts +10 -0
  8. package/dist/{server/ai-employees/built-in/email-assistant/prompt.js → ai/ai-employees/ellis.js} +19 -11
  9. package/dist/ai/ai-employees/lexi.d.ts +10 -0
  10. package/dist/{server/ai-employees/built-in/translator/prompt.js → ai/ai-employees/lexi.js} +15 -7
  11. package/dist/ai/ai-employees/vera.d.ts +10 -0
  12. package/dist/{server/ai-employees/built-in/research-analyst/prompt.js → ai/ai-employees/vera.js} +15 -7
  13. package/dist/ai/ai-employees/viz.d.ts +10 -0
  14. package/dist/{server/ai-employees/built-in/insights-analyst/prompt.js → ai/ai-employees/viz.js} +15 -7
  15. package/dist/ai/skills/document-search/SKILLS.md +69 -0
  16. package/dist/ai/tools/chartGenerator.js +14 -3
  17. package/dist/ai/tools/formFiller.js +13 -2
  18. package/dist/{server/ai-employees/built-in/ai-coding/prompt.d.ts → ai/tools/getSkill.d.ts} +1 -3
  19. package/dist/{server/ai-employees/built-in/data-modeling/index.js → ai/tools/getSkill.js} +39 -32
  20. package/dist/ai/tools/suggestions.js +13 -2
  21. package/dist/client/{a06081a2b06f1c14.js → 200ac94fc7f6e97b.js} +1 -1
  22. package/dist/client/27539a4356faebb1.js +10 -0
  23. package/dist/client/2db4faf814179140.js +10 -0
  24. package/dist/client/{521c94db45b1e031.js → 4f9117811ffc7ab3.js} +1 -1
  25. package/dist/client/{c49557cc10afc6b2.js → 5af11e24bcb39ac4.js} +1 -1
  26. package/dist/client/62bf6ed27c8de0df.js +10 -0
  27. package/dist/client/6dc8c9b641452067.js +10 -0
  28. package/dist/client/8169eb2b48edf6c7.js +10 -0
  29. package/dist/client/81f6436fd9322dc1.js +10 -0
  30. package/dist/client/{33811690df6f43ba.js → 85af3d6d85eb5b2b.js} +1 -1
  31. package/dist/client/87bc4d3cb55e4006.js +10 -0
  32. package/dist/client/9ac11803370a9625.js +10 -0
  33. package/dist/client/9c00efb8eb0b4d69.js +10 -0
  34. package/dist/client/{f74949b95f9bbb91.js → a4948d5b70172a69.js} +1 -1
  35. package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
  36. package/dist/{server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.d.ts → client/ai-employees/admin/ToolsSettings.d.ts} +8 -4
  37. package/dist/client/ai-employees/admin/mcp/MCPSettings.d.ts +10 -0
  38. package/dist/client/ai-employees/admin/mcp/MCPToolsList.d.ts +19 -0
  39. package/dist/client/ai-employees/admin/mcp/context.d.ts +15 -0
  40. package/dist/client/ai-employees/admin/mcp/schemas.d.ts +1286 -0
  41. package/dist/client/ai-employees/chatbox/utils.d.ts +3 -7
  42. package/dist/client/ai-employees/types.d.ts +5 -4
  43. package/dist/client/c83c2cae956ba914.js +10 -0
  44. package/dist/client/{6fcc98eb80deed47.js → d4e2ed9fa44a82b2.js} +1 -1
  45. package/dist/client/{5be6710cc905ec12.js → f944d487b7ff1f00.js} +1 -1
  46. package/dist/client/index.js +2 -2
  47. package/dist/client/repositories/AIConfigRepository.d.ts +8 -1
  48. package/dist/collections/ai-employees.js +2 -1
  49. package/dist/collections/ai-mcp-clients.d.ts +51 -0
  50. package/dist/collections/ai-mcp-clients.js +111 -0
  51. package/dist/externalVersion.js +14 -14
  52. package/dist/locale/en-US.json +65 -8
  53. package/dist/locale/zh-CN.json +66 -9
  54. package/dist/node_modules/fast-glob/package.json +1 -1
  55. package/dist/node_modules/flexsearch/package.json +1 -1
  56. package/dist/node_modules/fs-extra/package.json +1 -1
  57. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  58. package/dist/node_modules/openai/package.json +1 -1
  59. package/dist/node_modules/zod/package.json +1 -1
  60. package/dist/server/ai-employees/ai-employee.d.ts +5 -1
  61. package/dist/server/ai-employees/ai-employee.js +90 -13
  62. package/dist/server/ai-employees/middleware/index.d.ts +1 -0
  63. package/dist/server/ai-employees/middleware/index.js +2 -0
  64. package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
  65. package/dist/server/ai-employees/middleware/skill-tools.js +74 -0
  66. package/dist/server/ai-employees/prompts.d.ts +6 -1
  67. package/dist/server/ai-employees/prompts.js +9 -1
  68. package/dist/server/ai-employees/templates/form-assistant.d.ts +2 -2
  69. package/dist/server/ai-employees/templates/form-assistant.js +2 -2
  70. package/dist/server/ai-employees/utils.js +2 -2
  71. package/dist/server/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
  72. package/dist/server/{ai-employees/built-in/ai-coding/prompt.js → collections/ai-mcp-clients.js} +12 -10
  73. package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.d.ts → collections/ai-skills.d.ts} +1 -4
  74. package/dist/server/{migrations/20250923221107-setup-build-in.js → collections/ai-skills.js} +46 -13
  75. package/dist/server/manager/ai-coding-manager.d.ts +1 -2
  76. package/dist/server/manager/ai-coding-manager.js +0 -41
  77. package/dist/server/manager/built-in-manager.d.ts +2 -4
  78. package/dist/server/manager/built-in-manager.js +7 -118
  79. package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
  80. package/dist/server/plugin.d.ts +0 -1
  81. package/dist/server/plugin.js +17 -8
  82. package/dist/server/resource/aiEmployees.js +5 -7
  83. package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.d.ts → resource/aiMcpClients.d.ts} +3 -5
  84. package/dist/server/resource/aiMcpClients.js +78 -0
  85. package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/index.d.ts → resource/aiSkills.d.ts} +3 -7
  86. package/dist/server/resource/aiSkills.js +71 -0
  87. package/dist/server/resource/aiTools.js +4 -6
  88. package/dist/server/tools/docs.js +2 -2
  89. package/dist/server/tools/workflow-caller.js +1 -0
  90. package/package.json +2 -2
  91. package/dist/client/16dbe01d9077bb74.js +0 -10
  92. package/dist/client/180c8b1051a4f36e.js +0 -10
  93. package/dist/client/41229e007006e7f6.js +0 -10
  94. package/dist/client/41950da4c64caf73.js +0 -10
  95. package/dist/client/585ba360c7c57caf.js +0 -10
  96. package/dist/client/9f62a4c5136dfe8b.js +0 -10
  97. package/dist/client/b7f721f8dabb54e5.js +0 -10
  98. package/dist/client/bc471dd60174458c.js +0 -10
  99. package/dist/client/c40ed1a900aefb67.js +0 -10
  100. package/dist/server/ai-employees/built-in/ai-coding/document/basic/flow-resource.js +0 -256
  101. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/index.js +0 -48
  102. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.js +0 -452
  103. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.js +0 -363
  104. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.js +0 -270
  105. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.d.ts +0 -13
  106. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.js +0 -219
  107. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.d.ts +0 -13
  108. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.js +0 -409
  109. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.d.ts +0 -13
  110. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.js +0 -324
  111. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.d.ts +0 -13
  112. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.js +0 -309
  113. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.d.ts +0 -15
  114. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.js +0 -50
  115. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.d.ts +0 -13
  116. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.js +0 -345
  117. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.d.ts +0 -13
  118. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.js +0 -381
  119. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.d.ts +0 -13
  120. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.js +0 -545
  121. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.d.ts +0 -13
  122. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.js +0 -346
  123. package/dist/server/ai-employees/built-in/ai-coding/document/js-action.d.ts +0 -13
  124. package/dist/server/ai-employees/built-in/ai-coding/document/js-action.js +0 -102
  125. package/dist/server/ai-employees/built-in/ai-coding/document/js-block.d.ts +0 -13
  126. package/dist/server/ai-employees/built-in/ai-coding/document/js-block.js +0 -314
  127. package/dist/server/ai-employees/built-in/ai-coding/document/js-column.d.ts +0 -13
  128. package/dist/server/ai-employees/built-in/ai-coding/document/js-column.js +0 -113
  129. package/dist/server/ai-employees/built-in/ai-coding/document/js-field.d.ts +0 -13
  130. package/dist/server/ai-employees/built-in/ai-coding/document/js-field.js +0 -498
  131. package/dist/server/ai-employees/built-in/ai-coding/document/js-item.d.ts +0 -13
  132. package/dist/server/ai-employees/built-in/ai-coding/document/js-item.js +0 -184
  133. package/dist/server/ai-employees/built-in/ai-coding/index.d.ts +0 -37
  134. package/dist/server/ai-employees/built-in/ai-coding/index.js +0 -99
  135. package/dist/server/ai-employees/built-in/ai-coding/profile.d.ts +0 -27
  136. package/dist/server/ai-employees/built-in/ai-coding/profile.js +0 -60
  137. package/dist/server/ai-employees/built-in/ai-coding/prompt_en.md +0 -110
  138. package/dist/server/ai-employees/built-in/data-modeling/index.d.ts +0 -37
  139. package/dist/server/ai-employees/built-in/data-modeling/profile.d.ts +0 -27
  140. package/dist/server/ai-employees/built-in/data-modeling/profile.js +0 -60
  141. package/dist/server/ai-employees/built-in/data-modeling/prompt.js +0 -283
  142. package/dist/server/ai-employees/built-in/data-organizer/index.d.ts +0 -37
  143. package/dist/server/ai-employees/built-in/data-organizer/index.js +0 -63
  144. package/dist/server/ai-employees/built-in/data-organizer/profile.d.ts +0 -27
  145. package/dist/server/ai-employees/built-in/data-organizer/profile.js +0 -60
  146. package/dist/server/ai-employees/built-in/data-visualization/index.d.ts +0 -37
  147. package/dist/server/ai-employees/built-in/data-visualization/index.js +0 -58
  148. package/dist/server/ai-employees/built-in/data-visualization/profile.d.ts +0 -27
  149. package/dist/server/ai-employees/built-in/data-visualization/profile.js +0 -60
  150. package/dist/server/ai-employees/built-in/email-assistant/index.d.ts +0 -34
  151. package/dist/server/ai-employees/built-in/email-assistant/index.js +0 -50
  152. package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
  153. package/dist/server/ai-employees/built-in/email-assistant/profile.js +0 -60
  154. package/dist/server/ai-employees/built-in/email-assistant/prompt.d.ts +0 -12
  155. package/dist/server/ai-employees/built-in/insights-analyst/index.d.ts +0 -37
  156. package/dist/server/ai-employees/built-in/insights-analyst/index.js +0 -63
  157. package/dist/server/ai-employees/built-in/insights-analyst/profile.d.ts +0 -27
  158. package/dist/server/ai-employees/built-in/insights-analyst/profile.js +0 -60
  159. package/dist/server/ai-employees/built-in/insights-analyst/prompt.d.ts +0 -12
  160. package/dist/server/ai-employees/built-in/nocobase-assistant/index.d.ts +0 -34
  161. package/dist/server/ai-employees/built-in/nocobase-assistant/index.js +0 -50
  162. package/dist/server/ai-employees/built-in/nocobase-assistant/profile.d.ts +0 -27
  163. package/dist/server/ai-employees/built-in/nocobase-assistant/profile.js +0 -60
  164. package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.d.ts +0 -12
  165. package/dist/server/ai-employees/built-in/research-analyst/index.d.ts +0 -37
  166. package/dist/server/ai-employees/built-in/research-analyst/index.js +0 -63
  167. package/dist/server/ai-employees/built-in/research-analyst/profile.d.ts +0 -27
  168. package/dist/server/ai-employees/built-in/research-analyst/profile.js +0 -60
  169. package/dist/server/ai-employees/built-in/research-analyst/prompt.d.ts +0 -12
  170. package/dist/server/ai-employees/built-in/translator/index.d.ts +0 -37
  171. package/dist/server/ai-employees/built-in/translator/index.js +0 -67
  172. package/dist/server/ai-employees/built-in/translator/profile.d.ts +0 -27
  173. package/dist/server/ai-employees/built-in/translator/profile.js +0 -60
  174. package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
  175. /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
@@ -1,184 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var js_item_exports = {};
28
- __export(js_item_exports, {
29
- default: () => js_item_default
30
- });
31
- module.exports = __toCommonJS(js_item_exports);
32
- var js_item_default = {
33
- name: "js-item-model",
34
- content: String.raw`# JSItemModel
35
-
36
- 用于表单网格中的“自定义项”(非字段绑定)。你可以用 JS 渲染任意内容(提示、统计、预览、按钮等),并与表单、记录上下文交互。
37
-
38
- 典型场景:CreateForm(新建)、EditForm(编辑)中展示与表单字段联动的实时预览或说明;或在表单中嵌入轻交互组件。
39
-
40
- ## 可用上下文(常用)
41
- - \`ctx.element\`:ElementProxy(安全封装的容器)。用于写入 DOM、绑定事件。
42
- - \`ctx.form\`:AntD Form 实例,可 \`getFieldValue/setFieldValue/validateFields\` 等。
43
- - \`ctx.formValues\`:当前表单值快照(简便读取方式)。
44
- - \`ctx.blockModel\`:所在表单块模型(CreateFormModel/EditFormModel),可监听 \`formValuesChange\` 事件实现联动。
45
- - \`ctx.collection\`:当前集合对象。
46
- - \`ctx.viewer\`:视图控制器(drawer/dialog/popover/embed)。
47
- - \`ctx.api\`:API 客户端(发起请求)。
48
- - \`ctx.t\`:国际化函数。
49
-
50
- 说明:
51
- - JSItemModel 不绑定具体字段值;如需读取表单字段,请使用 \`ctx.form.getFieldValue('fieldName')\` 或 \`ctx.form.getFieldsValue()\`。
52
-
53
- ## 示例:新增表单中的“合计金额实时预览”
54
- 在 CreateForm 中添加“其他 → JS 项(JSItemModel)”,在“JavaScript settings”里粘贴:
55
-
56
- \`\`\`javascript
57
- // 根据 price、quantity 联动计算应付总额并实时展示
58
- const render = () => {
59
- const { price = 0, quantity = 1, discount = 0 } = ctx.form.getFieldsValue();
60
- const total = Number(price) * Number(quantity);
61
- const final = total * (1 - Number(discount || 0));
62
- const fmt = (n) => \`¥\${(Number(n) || 0).toFixed(2)}\`;
63
- ctx.element.innerHTML = \`
64
- <div style="padding:8px 12px;background:#f6ffed;border:1px solid #b7eb8f;border-radius:6px;">
65
- <div style="font-weight:600;color:#389e0d;">预计实付:\${fmt(final)}</div>
66
- <div style="color:#999">商品小计 \${fmt(total)},折扣 \${(Number(discount)*100||0).toFixed(0)}%</div>
67
- </div>
68
- \`;
69
- };
70
-
71
- // 首次渲染
72
- render();
73
- // 监听表单值变化(由 FormModel 派发)
74
- ctx.blockModel?.on?.('formValuesChange', () => render());
75
- \`\`\`
76
-
77
- ## 示例:表单中打开自定义抽屉(扩展性示例)
78
- 在 JSItemModel 的脚本中绑定点击事件,打开抽屉展示更多说明或预览:
79
-
80
- \`\`\`javascript
81
- ctx.element.innerHTML = \`
82
- <button type="button" style="padding:6px 10px;border:1px solid #1890ff;background:#fff;color:#1890ff;border-radius:4px;cursor:pointer;">
83
- 打开预览
84
- </button>
85
- \`;
86
-
87
- ctx.element.querySelector('button')?.addEventListener('click', async () => {
88
- const values = ctx.form.getFieldsValue();
89
- await ctx.viewer.drawer({
90
- width: '48%',
91
- content: \`
92
- <div style="padding:16px;font:14px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;">
93
- <h3 style="margin:0 0 12px;">提交前预览</h3>
94
- <pre style="background:#f5f5f5;padding:12px;border-radius:6px;">\${JSON.stringify(values, null, 2)}</pre>
95
- </div>
96
- \`,
97
- });
98
- });
99
- \`\`\`
100
-
101
- ## 进阶提示
102
- - 可用 \`ctx.api\` 预取数据做联动提示(例如唯一性校验前置提示等);
103
- - 如需可编辑的 JS 字段,请使用可编辑字段模型(例如 \`JSEditableFieldModel\`)。
104
- - 可用 \`ctx.openView\` 做跨区块跨页面联动,可参考 JSFieldModel 文档示例。
105
-
106
- </nocobase-api-reference>
107
-
108
- <nocobase-api-reference name='JSColumnModel'>
109
- # JSColumnModel
110
-
111
- 用于表格中的“自定义列”,以 JavaScript 渲染单元格内容。适合表格汇总或者计算,或者请求远端关联数据展示等场景。
112
- 与普通字段列不同,JSColumnModel 不绑定具体字段值,你需要通过 \`ctx.record\` 自行读取当前行数据并渲染。
113
-
114
- ## 可用上下文(常用)
115
- - \`ctx.element\`:ElementProxy(当前单元格容器)。
116
- - \`ctx.record\`:当前行记录对象。
117
- - \`ctx.collection\`:当前集合对象(可获取主键、字段信息)。
118
- - \`ctx.viewer\`:视图控制器,支持 \`drawer\`、\`dialog\`、\`popover\`、\`embed\`。
119
- - \`ctx.api\`:API 客户端,可在点击时发起请求。
120
- - \`ctx.t\`:国际化函数。
121
-
122
- 说明:
123
- - 表格逐行渲染时会为每行创建 fork 上下文,\`ctx.record\` 均指向当前行。
124
-
125
- ## 示例:状态徽标列
126
-
127
- \`\`\`javascript
128
- const status = String(ctx.record?.status ?? '').toLowerCase();
129
- const color = status === 'done' ? '#52c41a' : status === 'pending' ? '#faad14' : '#ff4d4f';
130
- const text = status || 'unknown';
131
-
132
- ctx.element.innerHTML = \`
133
- <span style="display:inline-flex;align-items:center;gap:6px;">
134
- <i style="width:8px;height:8px;border-radius:50%;background:\${color};display:inline-block;"></i>
135
- <span style="color:\${color};text-transform:capitalize;">\${text}</span>
136
- </span>
137
- \`;
138
- \`\`\`
139
-
140
- ## 示例:点击打开抽屉查看详情(扩展性示例)
141
- 见上方 Demo 中 \`ctx.viewer.drawer\` 的用法。
142
-
143
- \`\`\`javascript
144
- // 简单 JSON 预览按钮
145
- ctx.element.innerHTML = \`
146
- <a href="javascript:;" style="color:#1677ff;">查看</a>
147
- \`;
148
-
149
- ctx.element.querySelector('a')?.addEventListener('click', async () => {
150
- const pk = ctx.collection?.getFilterByTK?.(ctx.record); // 当前行主键(若集合可推断)
151
- await ctx.viewer.drawer({
152
- width: '56%',
153
- content: \`
154
- <div style="padding:16px;font:14px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;">
155
- <h3 style="margin:0 0 12px;">行数据预览(#\${pk ?? ctx.recordIndex})</h3>
156
- <pre style="background:#f5f5f5;padding:12px;border-radius:6px;">\${JSON.stringify(ctx.record, null, 2)}</pre>
157
- </div>
158
- \`,
159
- });
160
- });
161
- \`\`\`
162
-
163
- ## 示例:组合多字段为一列的展示
164
- 将多个字段合并为单列显示(如 “姓名(部门) - 职级”):
165
-
166
- \`\`\`javascript
167
- const name = ctx.record?.name ?? '';
168
- const dept = ctx.record?.department?.name ?? '';
169
- const level = ctx.record?.level ?? '';
170
-
171
- ctx.element.innerHTML = \`
172
- <div style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
173
- <strong>\${name}</strong>
174
- <span style="color:#999">(\${dept})</span>
175
- <span style="color:#999"> - \${level}</span>
176
- </div>
177
- \`;
178
- \`\`\`
179
-
180
- ## 进阶提示
181
- - 可通过 \`ctx.api\` 请求后端,动态刷新 \`ctx.element\` 内容;
182
- - 对于“绑定字段值”的场景,请使用JS字段列,JSColumn 适合完全自定义展示与行为, 例如跨字段的汇总等场景。
183
- - 可用 \`ctx.openView\` 做跨区块跨页面联动,可参考 JSFieldModel 文档示例。`
184
- };
@@ -1,37 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- username: string;
11
- description: string;
12
- profile: {
13
- 'en-US': {
14
- avatar: string;
15
- nickname: string;
16
- position: string;
17
- bio: string;
18
- greeting: string;
19
- about: string;
20
- };
21
- 'zh-CN': {
22
- avatar: string;
23
- nickname: string;
24
- position: string;
25
- bio: string;
26
- greeting: string;
27
- about: string;
28
- };
29
- };
30
- skillSettings: {
31
- skills: {
32
- name: string;
33
- autoCall: boolean;
34
- }[];
35
- };
36
- };
37
- export default _default;
@@ -1,99 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var ai_coding_exports = {};
38
- __export(ai_coding_exports, {
39
- default: () => ai_coding_default
40
- });
41
- module.exports = __toCommonJS(ai_coding_exports);
42
- var import_profile = __toESM(require("./profile"));
43
- var ai_coding_default = {
44
- username: "nathan",
45
- description: "AI employee for coding",
46
- profile: import_profile.default,
47
- skillSettings: {
48
- skills: [
49
- {
50
- name: "getDataSources",
51
- autoCall: true
52
- },
53
- {
54
- name: "getCollectionNames",
55
- autoCall: true
56
- },
57
- {
58
- name: "getCollectionMetadata",
59
- autoCall: true
60
- },
61
- {
62
- name: "listCodeSnippet",
63
- autoCall: true
64
- },
65
- {
66
- name: "getCodeSnippet",
67
- autoCall: true
68
- },
69
- {
70
- name: "getContextApis",
71
- autoCall: true
72
- },
73
- {
74
- name: "getContextEnvs",
75
- autoCall: true
76
- },
77
- {
78
- name: "getContextVars",
79
- autoCall: true
80
- },
81
- {
82
- name: "lintAndTestJS",
83
- autoCall: true
84
- },
85
- {
86
- name: "searchFieldMetadata",
87
- autoCall: true
88
- },
89
- {
90
- name: "searchDocs",
91
- autoCall: true
92
- },
93
- {
94
- name: "readDocEntry",
95
- autoCall: true
96
- }
97
- ]
98
- }
99
- };
@@ -1,27 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'en-US': {
11
- avatar: string;
12
- nickname: string;
13
- position: string;
14
- bio: string;
15
- greeting: string;
16
- about: string;
17
- };
18
- 'zh-CN': {
19
- avatar: string;
20
- nickname: string;
21
- position: string;
22
- bio: string;
23
- greeting: string;
24
- about: string;
25
- };
26
- };
27
- export default _default;
@@ -1,60 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var profile_exports = {};
38
- __export(profile_exports, {
39
- default: () => profile_default
40
- });
41
- module.exports = __toCommonJS(profile_exports);
42
- var import_prompt = __toESM(require("./prompt"));
43
- var profile_default = {
44
- "en-US": {
45
- avatar: "nocobase-002-male",
46
- nickname: "Nathan",
47
- position: "Frontend code engineer",
48
- bio: "An frontend engineer specializing in JavaScript, HTML, and CSS.",
49
- greeting: "Hello, I\u2019m Nathan, your frontend code engineer. I\u2019ll generate high-quality JavaScript / HTML / CSS code for you. What would you like me to build today?",
50
- about: import_prompt.default["en-US"]
51
- },
52
- "zh-CN": {
53
- avatar: "nocobase-002-male",
54
- nickname: "Nathan",
55
- position: "\u524D\u7AEF\u5DE5\u7A0B\u5E08",
56
- bio: "\u4E00\u4E2A\u64C5\u957F JavaScript\u3001HTML \u548C CSS \u7684\u524D\u7AEF\u5DE5\u7A0B\u5E08\u3002",
57
- greeting: "\u55E8\uFF0C\u6211\u662F Nathan\uFF0C\u4F60\u7684\u524D\u7AEF\u5DE5\u7A0B\u5E08\u3002\u6211\u5C06\u4E3A\u60A8\u751F\u6210\u9AD8\u8D28\u91CF JavaScript / HTML / CSS \u4EE3\u7801\u3002\u4ECA\u5929\u60A8\u60F3\u521B\u5EFA\u4EC0\u4E48\uFF1F",
58
- about: import_prompt.default["en-US"]
59
- }
60
- };
@@ -1,110 +0,0 @@
1
- You are an AI coding assistant for NocoBase RunJS.
2
-
3
- RunJS is used in:
4
-
5
- - JS Block
6
- - JS Field
7
- - JS Item
8
- - JS Action
9
- - Event Flow
10
- - Linkage Rules
11
-
12
- Runtime:
13
-
14
- - Sandboxed
15
- - Access via `ctx`
16
- - Supports top-level await (PREFER whenever possible)
17
- - JSX → ctx.libs.React.createElement
18
- - Dynamic ESM via ctx.importAsync()
19
-
20
-
21
- # Core Rule (Strict)
22
-
23
- Never guess.
24
-
25
- You must NOT assume:
26
-
27
- - ctx APIs
28
- - context variables
29
- - collections / fields / schema
30
- - runtime behavior
31
- - React / Antd exposure
32
- - browser globals (window, document, location, history, navigator)
33
-
34
- All of the above MUST be verified via tools or NocoBase docs.
35
-
36
- If not confirmed → ask user.
37
-
38
-
39
- # Mandatory Workflow (Every Task)
40
-
41
- Follow this exact order:
42
-
43
- 1. Runtime
44
- - getContextEnvs
45
- - getContextVars
46
- - getContextApis
47
-
48
- 2. Docs
49
- - searchDocs
50
- - readDocEntry
51
-
52
- 3. Data (if involved)
53
- - getDatasources
54
- - getCollectionNames
55
- - getCollectionMetadata
56
- - searchFieldMetadata
57
-
58
- 4. If unclear
59
- - suggestions / ask user
60
-
61
- 5. Write code
62
-
63
- 6. Validate (REQUIRED)
64
- - lintAndTestJS must pass before output
65
-
66
-
67
- # Coding Rules
68
-
69
- - Single file
70
- - Prefer top-level await
71
- - No import / require
72
- - Libraries ONLY via ctx.importAsync()
73
- - HTTP ONLY via ctx.request()
74
- - Only call ctx.render when UI is required
75
- - JSX uses ctx.libs.React by default
76
- - When rendering UI, PREFER Ant Design components via ctx.libs.antd to match NocoBase style
77
- - Inline styles only
78
-
79
- Forbidden:
80
-
81
- - fetch
82
- - XMLHttpRequest
83
- - localStorage
84
- - eval
85
- - new Function
86
- - Direct document / window access unless explicitly documented
87
-
88
- # i18n
89
-
90
- All user-facing strings MUST use: `ctx.t(...)`
91
-
92
- # Security
93
-
94
- Never inject unsanitized user input into DOM.
95
-
96
- # Output Rules
97
-
98
- - Markdown
99
- - Exactly ONE complete code block at end
100
- - No partial snippets
101
- - Brief explanation after code
102
-
103
- # Standard
104
-
105
- Senior NocoBase engineer mindset:
106
- Tool-driven, deterministic, production-minded.
107
-
108
- If unsure: search.
109
- If still unsure: ask.
110
- Never guess.
@@ -1,37 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- username: string;
11
- description: string;
12
- profile: {
13
- 'en-US': {
14
- avatar: string;
15
- nickname: string;
16
- position: string;
17
- bio: string;
18
- greeting: string;
19
- about: string;
20
- };
21
- 'zh-CN': {
22
- avatar: string;
23
- nickname: string;
24
- position: string;
25
- bio: string;
26
- greeting: string;
27
- about: string;
28
- };
29
- };
30
- skillSettings: {
31
- skills: {
32
- name: string;
33
- autoCall: boolean;
34
- }[];
35
- };
36
- };
37
- export default _default;
@@ -1,27 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'en-US': {
11
- avatar: string;
12
- nickname: string;
13
- position: string;
14
- bio: string;
15
- greeting: string;
16
- about: string;
17
- };
18
- 'zh-CN': {
19
- avatar: string;
20
- nickname: string;
21
- position: string;
22
- bio: string;
23
- greeting: string;
24
- about: string;
25
- };
26
- };
27
- export default _default;
@@ -1,60 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var profile_exports = {};
38
- __export(profile_exports, {
39
- default: () => profile_default
40
- });
41
- module.exports = __toCommonJS(profile_exports);
42
- var import_prompt = __toESM(require("./prompt"));
43
- var profile_default = {
44
- "en-US": {
45
- avatar: "nocobase-055-male",
46
- nickname: "Orin",
47
- position: "Data modeling expert",
48
- bio: "A data modeling expert who helps translate business scenarios into normalized database schemas with table declarations and relationship diagrams.",
49
- greeting: "Hi, I\u2019m Orin. Tell me about your business scenario, and I\u2019ll help you model the database step by step.",
50
- about: import_prompt.default["en-US"]
51
- },
52
- "zh-CN": {
53
- avatar: "nocobase-055-male",
54
- nickname: "Orin",
55
- position: "\u6570\u636E\u5EFA\u6A21\u4E13\u5BB6",
56
- bio: "\u4E00\u4E2A\u5E2E\u52A9\u5C06\u4E1A\u52A1\u573A\u666F\u7FFB\u8BD1\u6210\u89C4\u8303\u5316\u7684\u6570\u636E\u5E93\u67B6\u6784\u7684\u5EFA\u6A21\u4E13\u5BB6\uFF0C\u4F7F\u7528\u8868\u58F0\u660E\u548C\u5173\u7CFB\u56FE\u8FDB\u884C\u5EFA\u6A21\u3002",
57
- greeting: "\u55E8\uFF0C\u6211\u662FOrin\u3002\u8BF7\u4ECB\u7ECD\u4F60\u7684\u4E1A\u52A1\u573A\u666F\uFF0C\u6211\u5C06\u5E2E\u4F60\u9010\u6B65\u521B\u5EFA\u6570\u636E\u5E93\u3002",
58
- about: import_prompt.default["en-US"]
59
- }
60
- };