@nocobase/plugin-ai 2.3.0-alpha.1 → 3.0.0-alpha.1

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 (246) hide show
  1. package/dist/ai/docs/nocobase/ai-employees/block/ai-chat-box.md +133 -0
  2. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
  3. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
  4. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
  5. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
  6. package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
  7. package/dist/ai/docs/nocobase/api/app/env.md +3 -1
  8. package/dist/ai/docs/nocobase/api/cli/index.md +14 -2
  9. package/dist/ai/docs/nocobase/api/cli/portal/config.md +44 -0
  10. package/dist/ai/docs/nocobase/api/cli/portal/create.md +48 -0
  11. package/dist/ai/docs/nocobase/api/cli/portal/deploy.md +39 -0
  12. package/dist/ai/docs/nocobase/api/cli/portal/destroy.md +41 -0
  13. package/dist/ai/docs/nocobase/api/cli/portal/dev.md +39 -0
  14. package/dist/ai/docs/nocobase/api/cli/portal/index.md +136 -0
  15. package/dist/ai/docs/nocobase/api/cli/portal/info.md +41 -0
  16. package/dist/ai/docs/nocobase/api/cli/portal/list.md +40 -0
  17. package/dist/ai/docs/nocobase/api/cli/portal/pull.md +43 -0
  18. package/dist/ai/docs/nocobase/api/cli/portal/push.md +41 -0
  19. package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
  20. package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
  21. package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
  22. package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
  23. package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
  24. package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
  25. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
  26. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
  27. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
  28. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
  29. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
  30. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
  31. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
  32. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
  33. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
  34. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
  35. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
  36. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
  37. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
  38. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
  39. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
  40. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
  41. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
  42. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
  43. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
  44. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
  45. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
  46. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
  47. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
  48. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
  49. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
  50. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
  51. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
  52. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
  53. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
  54. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
  55. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
  56. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
  57. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
  58. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
  59. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
  60. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
  61. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
  62. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
  63. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
  64. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
  65. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
  66. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
  67. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
  68. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
  69. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
  70. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
  71. package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
  72. package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
  73. package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
  74. package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
  75. package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
  76. package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
  77. package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
  78. package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
  79. package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
  80. package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
  81. package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
  82. package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
  83. package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
  84. package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
  85. package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
  86. package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
  87. package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
  88. package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
  89. package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
  90. package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
  91. package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
  92. package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
  93. package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
  94. package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
  95. package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
  96. package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
  97. package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
  98. package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
  99. package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
  100. package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
  101. package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
  102. package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
  103. package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
  104. package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
  105. package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
  106. package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
  107. package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
  108. package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
  109. package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
  110. package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
  111. package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
  112. package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
  113. package/dist/ai/docs/nocobase/file-manager/storage/index.md +66 -26
  114. package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
  115. package/dist/ai/docs/nocobase/get-started/installation/env.md +2 -2
  116. package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
  117. package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
  118. package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
  119. package/dist/ai/tools/executeFrontendTool.js +86 -0
  120. package/dist/ai/tools/getSkill.js +1 -1
  121. package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
  122. package/dist/ai/tools/loadFrontendTool.js +99 -0
  123. package/dist/client/244.8631eb5cf3f05e21.js +10 -0
  124. package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
  125. package/dist/client/681.6ffbc9329b9ac242.js +10 -0
  126. package/dist/{client-v2/705.1d10027ff8cfdf79.js → client/705.19b642db34de438a.js} +1 -1
  127. package/dist/client/index.d.ts +1 -3
  128. package/dist/client/index.js +8 -8
  129. package/dist/client-v2/244.c428e645ecb94414.js +10 -0
  130. package/dist/client-v2/420.b2aedb1ff71fca0e.js +10 -0
  131. package/dist/client-v2/681.6890caa389564ff7.js +10 -0
  132. package/dist/client-v2/705.8dc34d43f02f322c.js +10 -0
  133. package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
  134. package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
  135. package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
  136. package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
  137. package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
  138. package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
  139. package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
  140. package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
  141. package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
  142. package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
  143. package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
  144. package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
  145. package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
  146. package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
  147. package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
  148. package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
  149. package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
  150. package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
  151. package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
  152. package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
  153. package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -31
  154. package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
  155. package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
  156. package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
  157. package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
  158. package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
  159. package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
  160. package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
  161. package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
  162. package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
  163. package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
  164. package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
  165. package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
  166. package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
  167. package/dist/client-v2/ai-employees/types.d.ts +30 -0
  168. package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
  169. package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
  170. package/dist/client-v2/block/ai-chat-box/components/AIChatBoxCoreView.d.ts +10 -0
  171. package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
  172. package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
  173. package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
  174. package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
  175. package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
  176. package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
  177. package/dist/client-v2/index.d.ts +3 -5
  178. package/dist/client-v2/index.js +3 -3
  179. package/dist/client-v2/llm-services/model-select.d.ts +33 -0
  180. package/dist/client-v2/llm-services/utils.d.ts +1 -0
  181. package/dist/client-v2/manager/ai-manager.d.ts +10 -3
  182. package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
  183. package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
  184. package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +5 -0
  185. package/dist/client-v2/pages/EmployeesPage.d.ts +2 -0
  186. package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
  187. package/dist/common/ai-employee-validation.d.ts +15 -0
  188. package/dist/common/ai-employee-validation.js +61 -0
  189. package/dist/common/error-codes.d.ts +13 -0
  190. package/dist/common/error-codes.js +48 -0
  191. package/dist/common/frontend-tools.d.ts +26 -0
  192. package/dist/common/frontend-tools.js +57 -0
  193. package/dist/common/llm-service-models.d.ts +16 -0
  194. package/dist/common/llm-service-models.js +84 -0
  195. package/dist/externalVersion.js +16 -16
  196. package/dist/locale/en-US.json +67 -0
  197. package/dist/locale/zh-CN.json +67 -0
  198. package/dist/node_modules/@langchain/mistralai/package.json +1 -1
  199. package/dist/node_modules/@langchain/xai/package.json +1 -1
  200. package/dist/node_modules/fs-extra/package.json +1 -1
  201. package/dist/node_modules/jsonrepair/package.json +1 -1
  202. package/dist/node_modules/just-bash/package.json +1 -1
  203. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  204. package/dist/node_modules/openai/package.json +1 -1
  205. package/dist/node_modules/zod/package.json +1 -1
  206. package/dist/server/ai-employees/ai-conversations.d.ts +4 -1
  207. package/dist/server/ai-employees/ai-conversations.js +2 -0
  208. package/dist/server/ai-employees/ai-employee.d.ts +2 -1
  209. package/dist/server/ai-employees/ai-employee.js +26 -7
  210. package/dist/server/ai-employees/middleware/conversation.js +9 -2
  211. package/dist/server/collections/ai-conversations.js +5 -0
  212. package/dist/server/document-loader/constants.js +1 -1
  213. package/dist/server/frontend-tools.d.ts +25 -0
  214. package/dist/server/frontend-tools.js +171 -0
  215. package/dist/server/manager/work-context-handler.js +10 -3
  216. package/dist/server/plugin.d.ts +1 -0
  217. package/dist/server/plugin.js +25 -0
  218. package/dist/server/resource/aiConversations.d.ts +2 -0
  219. package/dist/server/resource/aiConversations.js +33 -3
  220. package/dist/server/resource/aiEmployees.d.ts +2 -0
  221. package/dist/server/resource/aiEmployees.js +62 -0
  222. package/dist/server/resource/aiWorkflowTasks.js +9 -1
  223. package/dist/server/resource/llmServices.d.ts +11 -0
  224. package/dist/server/resource/llmServices.js +85 -0
  225. package/dist/server/types/knowledge-base.type.d.ts +6 -2
  226. package/dist/swagger/common.d.ts +143 -0
  227. package/dist/swagger/common.js +144 -0
  228. package/dist/swagger/employees.d.ts +301 -0
  229. package/dist/swagger/employees.js +131 -0
  230. package/dist/swagger/index.d.ts +1588 -0
  231. package/dist/swagger/index.js +62 -0
  232. package/dist/swagger/llm.d.ts +555 -0
  233. package/dist/swagger/llm.js +247 -0
  234. package/dist/swagger/schemas.d.ts +736 -0
  235. package/dist/swagger/schemas.js +381 -0
  236. package/package.json +2 -2
  237. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
  238. package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
  239. package/dist/client/372.40eb52905e3f3049.js +0 -10
  240. package/dist/client/681.399948c18d753667.js +0 -10
  241. package/dist/client/705.380279da896021fb.js +0 -10
  242. package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
  243. package/dist/client-v2/406.341be51205c674e0.js +0 -10
  244. package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
  245. package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
  246. package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
@@ -6,6 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import type { AIEmployee } from '../../types';
9
10
  export type WorkflowTask = {
10
11
  id: string;
11
12
  sessionId: string;
@@ -28,6 +29,7 @@ export type WorkflowTaskOutputSchema = {
28
29
  properties?: Record<string, WorkflowTaskOutputSchema>;
29
30
  };
30
31
  export type WorkflowTaskDetail = WorkflowTask & {
32
+ aiEmployee?: AIEmployee | null;
31
33
  readonly?: boolean;
32
34
  structuredOutputSchema?: WorkflowTaskOutputSchema | string | null;
33
35
  config?: {
@@ -39,22 +41,32 @@ export type WorkflowTaskDetail = WorkflowTask & {
39
41
  [key: string]: unknown;
40
42
  } | null;
41
43
  };
42
- type WorkflowTasksState = {
44
+ type WorkflowTaskStateUpdater<T> = T | ((prev: T) => T);
45
+ export declare const JOB_STATUS: {
46
+ readonly PENDING: 0;
47
+ readonly RESOLVED: 1;
48
+ readonly FAILED: -1;
49
+ readonly ERROR: -2;
50
+ readonly ABORTED: -3;
51
+ readonly CANCELED: -4;
52
+ readonly REJECTED: -5;
53
+ readonly RETRY_NEEDED: -6;
54
+ };
55
+ export declare const normalizeWorkflowTask: (workflowTask: WorkflowTask) => WorkflowTask;
56
+ export declare class WorkflowTaskModel {
43
57
  workflowTasks: WorkflowTask[];
44
- currentWorkflowTask?: WorkflowTaskDetail;
58
+ currentWorkflowTask: WorkflowTaskDetail | undefined;
45
59
  unreadCount: number;
46
60
  loading: boolean;
47
61
  keyword: string;
48
- selectedJobStatus?: number;
49
- };
50
- type WorkflowTasksActions = {
51
- setWorkflowTasks: (workflowTasks: WorkflowTask[] | ((prev: WorkflowTask[]) => WorkflowTask[])) => void;
52
- setCurrentWorkflowTask: (workflowTask: WorkflowTaskDetail | undefined | ((prev?: WorkflowTaskDetail) => WorkflowTaskDetail | undefined)) => void;
53
- setUnreadCount: (unreadCount: number | ((prev: number) => number)) => void;
62
+ selectedJobStatus: number | undefined;
63
+ constructor();
64
+ setWorkflowTasks: (workflowTasks: WorkflowTaskStateUpdater<WorkflowTask[]>) => void;
65
+ setCurrentWorkflowTask: (currentWorkflowTask: WorkflowTaskDetail | ((prev?: WorkflowTaskDetail) => WorkflowTaskDetail | undefined)) => void;
66
+ setUnreadCount: (unreadCount: WorkflowTaskStateUpdater<number>) => void;
54
67
  markWorkflowTaskRead: (sessionId: string) => void;
55
68
  setLoading: (loading: boolean) => void;
56
69
  setKeyword: (keyword: string) => void;
57
70
  setSelectedJobStatus: (selectedJobStatus: number | undefined) => void;
58
- };
59
- export declare const useWorkflowTasksStore: import("./create-selectors").ObservableStore<WorkflowTasksState & WorkflowTasksActions>;
71
+ }
60
72
  export {};
@@ -0,0 +1,19 @@
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
+ import type { APIClient } from '@nocobase/client-v2';
10
+ import type { Attachment, UploadAIFileOptions } from '../types';
11
+ type AIFileUploadRequestOptions = UploadAIFileOptions & {
12
+ action?: string;
13
+ data?: Record<string, string | Blob>;
14
+ fieldName?: string;
15
+ headers?: Record<string, string>;
16
+ withCredentials?: boolean;
17
+ };
18
+ export declare function uploadAIFile(apiClient: Pick<APIClient, 'request'>, file: Blob, options?: AIFileUploadRequestOptions): Promise<Attachment>;
19
+ export {};
@@ -6,12 +6,36 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { ContextItem, SkillSettings, TaskMessage, Message } from '../types';
10
- export declare function normalizeAIFileUploadAttachment<T extends Record<string, unknown>>(fileData: T, status: string): T & {
9
+ import type { APIClient } from '@nocobase/client-v2';
10
+ import type { AIConfigRepository } from '../../repositories/AIConfigRepository';
11
+ import { ContextItem, SkillSettings, TaskMessage, Message, type AIEmployee, type Task, type TriggerTaskOptions } from '../types';
12
+ export type RunJSAIEmployeeTriggerTaskOptions = Omit<TriggerTaskOptions, 'aiEmployee'> & {
13
+ aiEmployee?: string | AIEmployee;
14
+ };
15
+ export type NormalizeTriggerTaskOptionsContext = {
16
+ aiConfigRepository?: Pick<AIConfigRepository, 'getAIEmployees'> | null;
17
+ apiClient?: Pick<APIClient, 'resource'> | null;
18
+ };
19
+ export declare const getTargetChatBoxUid: (tasks?: Task[]) => string;
20
+ export declare function normalizeTriggerTaskOptions(options: RunJSAIEmployeeTriggerTaskOptions, context?: NormalizeTriggerTaskOptionsContext): Promise<TriggerTaskOptions | null>;
21
+ export declare function normalizeAIFileUploadAttachment<T extends Record<string, unknown>>(fileData: T, status?: string): T & {
22
+ filename?: string;
11
23
  source?: Record<string, unknown>;
12
- status: string;
24
+ status?: string;
25
+ };
26
+ export declare function normalizeAIFileUploadAttachment<T>(fileData: T, status?: string): T;
27
+ export declare const AI_EMPLOYEE_ATTACHMENT_COUNT_LIMIT = 10;
28
+ export declare const AI_EMPLOYEE_ATTACHMENT_SIZE_LIMIT_DEFAULT: number;
29
+ export type AttachmentLimitViolation = {
30
+ type: 'count';
31
+ limit: number;
32
+ } | {
33
+ type: 'size';
34
+ limit: number;
13
35
  };
14
- export declare function normalizeAIFileUploadAttachment<T>(fileData: T, status: string): T;
36
+ export declare function resolveStorageSizeLimit(rules: unknown): number;
37
+ export declare function validateAIEmployeeAttachmentLimits(attachments: unknown[], sizeLimit: number): AttachmentLimitViolation | null;
38
+ export declare function formatAttachmentSizeLimit(size: number): string;
15
39
  export declare function isCurrentLiveMessage(latestMessageId: string | undefined, messageId?: string, toolCallMessageId?: unknown): boolean;
16
40
  export declare const parseTask: (task: {
17
41
  message?: TaskMessage;
@@ -0,0 +1,11 @@
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
+ import type { ToolsOptions } from '@nocobase/client-v2';
10
+ export declare const loadFrontendTool: [string, ToolsOptions];
11
+ export declare const executeFrontendTool: [string, ToolsOptions];
@@ -12,5 +12,5 @@ type SuggestionsArgs = {
12
12
  options?: string[] | string;
13
13
  [key: string]: unknown;
14
14
  };
15
- export declare const SuggestionsOptionsCard: React.FC<ToolsUIProperties<SuggestionsArgs>>;
15
+ export declare const SuggestionsOptionsCard: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<ToolsUIProperties<SuggestionsArgs>>>;
16
16
  export {};
@@ -12,5 +12,5 @@ type WorkflowTaskOutputArgs = {
12
12
  result?: Record<string, unknown>;
13
13
  [key: string]: unknown;
14
14
  };
15
- export declare const WorkflowTaskOutputCard: React.FC<ToolsUIProperties<WorkflowTaskOutputArgs>>;
15
+ export declare const WorkflowTaskOutputCard: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<ToolsUIProperties<WorkflowTaskOutputArgs>>>;
16
16
  export {};
@@ -10,6 +10,7 @@ import type { BubbleProps } from '@ant-design/x';
10
10
  import type { ComponentType } from 'react';
11
11
  import type { Application } from '@nocobase/client-v2';
12
12
  import type { FlowEngineContext } from '@nocobase/flow-engine';
13
+ import type { FrontendToolManifest } from '../../common/frontend-tools';
13
14
  export type Selector = {
14
15
  onSelect: (options: {
15
16
  uid: string;
@@ -78,6 +79,7 @@ export type ContextItem = {
78
79
  uid: string;
79
80
  title?: string;
80
81
  content?: unknown;
82
+ frontendTools?: FrontendToolManifest[];
81
83
  };
82
84
  type ActionParams = {
83
85
  item: ContextItem;
@@ -119,6 +121,7 @@ export type WorkContextOptions = {
119
121
  actions?: ActionOptions[];
120
122
  children?: Record<string, Omit<WorkContextOptions, 'children'>>;
121
123
  getContent?: (app: Application, item: ContextItem) => Promise<unknown>;
124
+ getFrontendTools?: (app: Application, item: ContextItem) => Promise<FrontendToolManifest[]>;
122
125
  };
123
126
  export type ToolCall<T = unknown> = {
124
127
  id: string;
@@ -136,13 +139,36 @@ export type ToolCall<T = unknown> = {
136
139
  [key: string]: unknown;
137
140
  };
138
141
  export type Attachment = {
142
+ id?: string | number;
143
+ uid?: string;
144
+ name?: string;
139
145
  filename?: string;
146
+ url?: string;
147
+ preview?: string;
148
+ thumbUrl?: string;
149
+ size?: number;
150
+ mimetype?: string;
151
+ type?: string;
152
+ percent?: number;
140
153
  status?: string;
154
+ source?: {
155
+ dataSourceKey?: string;
156
+ collectionName?: string;
157
+ field?: string;
158
+ };
159
+ meta?: {
160
+ source?: Attachment['source'];
161
+ [key: string]: unknown;
162
+ };
141
163
  response?: {
142
164
  data?: Attachment;
143
165
  };
144
166
  [key: string]: unknown;
145
167
  };
168
+ export type UploadAIFileOptions = {
169
+ onProgress?: (percent: number) => void;
170
+ signal?: AbortSignal;
171
+ };
146
172
  export type MessageType = 'text' | 'greeting';
147
173
  export type Message = Omit<BubbleProps, 'content'> & {
148
174
  key?: string | number;
@@ -192,6 +218,7 @@ export type TaskMessage = {
192
218
  };
193
219
  export type Task = {
194
220
  title?: string;
221
+ chatBoxUid?: string;
195
222
  message?: TaskMessage;
196
223
  autoSend?: boolean;
197
224
  skillSettings?: SkillSettings;
@@ -204,8 +231,10 @@ export type Task = {
204
231
  export type TriggerTaskOptions = {
205
232
  aiEmployee?: AIEmployee;
206
233
  tasks?: Task[];
234
+ chatBoxUid?: string;
207
235
  auto?: boolean;
208
236
  open?: boolean;
237
+ onResponseLoadingChange?: (loading: boolean) => void;
209
238
  };
210
239
  export type SendOptions = {
211
240
  sessionId?: string;
@@ -224,6 +253,7 @@ export type SendOptions = {
224
253
  llmService: string;
225
254
  model: string;
226
255
  } | null;
256
+ onResponseLoadingChange?: (loading: boolean) => void;
227
257
  };
228
258
  export type ResendOptions = {
229
259
  sessionId: string;
@@ -0,0 +1,21 @@
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
+ import React from 'react';
10
+ import { BlockModel } from '@nocobase/client-v2';
11
+ import { type ChatBoxRuntime } from '../../ai-employees/chatbox/stores/runtime';
12
+ import type { AIChatBoxBlockProps, AIChatBoxBlockStructure } from './types';
13
+ export declare class AIChatBoxBlockModel extends BlockModel<AIChatBoxBlockStructure> {
14
+ props: AIChatBoxBlockProps;
15
+ chatBoxRuntime?: ChatBoxRuntime;
16
+ afterAddAsSubModel(): Promise<void>;
17
+ renderComponent(): React.JSX.Element;
18
+ renderActions(): React.JSX.Element;
19
+ renderConfigureActions(): React.JSX.Element;
20
+ renderConfigureItems(): React.JSX.Element;
21
+ }
@@ -0,0 +1,13 @@
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
+ import React from 'react';
10
+ import { FlowModel } from '@nocobase/flow-engine';
11
+ export declare class AIChatBoxCoreModel extends FlowModel {
12
+ render(): React.JSX.Element;
13
+ }
@@ -0,0 +1,10 @@
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
+ import React from 'react';
10
+ export declare const AIChatBoxCoreView: React.FC;
@@ -0,0 +1,12 @@
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
+ import React from 'react';
10
+ export declare const AI_CHAT_BOX_CORE_MIN_WIDTH = 400;
11
+ export declare const AI_CHAT_BOX_CORE_MIN_HEIGHT = 420;
12
+ export declare const AIChatBoxView: React.FC;
@@ -0,0 +1,14 @@
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
+ export { AIChatBoxBlockModel } from './AIChatBoxBlockModel';
10
+ export { AIChatBoxCoreModel } from './AIChatBoxCoreModel';
11
+ export { AIChatBoxActionGroupModel, AIChatBoxItemGroupModel } from './sub-models';
12
+ export { AI_CHAT_BOX_BLOCK_SETTINGS_FLOW_KEY } from './settings';
13
+ export { getAIChatBoxConversationScope, getAIChatBoxCreateScope, getAIChatBoxSettings, getAIChatBoxWorkContext, getDefaultAIChatBoxSettings, normalizeAIChatBoxScopeForSave, normalizeAIChatBoxWorkContext, } from './utils';
14
+ export type { AIChatBoxBlockProps, AIChatBoxBlockStructure, AIChatBoxSettings } from './types';
@@ -0,0 +1,12 @@
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
+ export declare const AI_CHAT_BOX_BLOCK_SETTINGS_FLOW_KEY = "aiChatBoxBlockSettings";
10
+ type AIChatBoxBlockModelConstructor = typeof import('./AIChatBoxBlockModel').AIChatBoxBlockModel;
11
+ export declare const registerAIChatBoxBlockSettings: (ModelClass: AIChatBoxBlockModelConstructor) => void;
12
+ export {};
@@ -0,0 +1,26 @@
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
+ import React from 'react';
10
+ import { ActionGroupModel, ActionModel } from '@nocobase/client-v2';
11
+ import { FlowModel, type FlowModelContext, type SubModelItem } from '@nocobase/flow-engine';
12
+ import type { AIChatBoxBlockModel } from './AIChatBoxBlockModel';
13
+ export declare const AI_CHAT_BOX_ACTION_MODEL_NAMES: readonly ["JSActionModel", "AIEmployeeActionModel"];
14
+ export declare const AI_CHAT_BOX_ITEM_MODEL_NAMES: readonly ["JSBlockModel", "IframeBlockModel", "MarkdownBlockModel"];
15
+ export declare const isAIChatBoxCoreModel: (model: FlowModel) => boolean;
16
+ export declare class AIChatBoxItemGroupModel extends FlowModel {
17
+ static defineChildren(ctx: FlowModelContext): Promise<SubModelItem[]>;
18
+ }
19
+ export declare class AIChatBoxActionGroupModel extends ActionGroupModel {
20
+ static baseClass: typeof ActionModel;
21
+ static defineChildren(ctx: FlowModelContext): Promise<SubModelItem[]>;
22
+ }
23
+ export declare const moveAddedItemBeforeCore: (model: AIChatBoxBlockModel, addedModel: FlowModel) => Promise<void>;
24
+ export declare const renderAIChatBoxActions: (model: AIChatBoxBlockModel) => React.JSX.Element;
25
+ export declare const renderAIChatBoxConfigureActions: (model: AIChatBoxBlockModel) => React.JSX.Element;
26
+ export declare const renderAIChatBoxConfigureItems: (model: AIChatBoxBlockModel) => React.JSX.Element;
@@ -0,0 +1,38 @@
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
+ import type { ActionModel } from '@nocobase/client-v2';
10
+ import type { FlowModel } from '@nocobase/flow-engine';
11
+ import type { ContextItem } from '../../ai-employees/types';
12
+ export type AIChatBoxBlockStructure = {
13
+ subModels: {
14
+ items: FlowModel[];
15
+ actions: ActionModel[];
16
+ };
17
+ };
18
+ export type AIChatBoxBlockProps = {
19
+ minWidth?: number;
20
+ height?: number;
21
+ showMessages?: boolean;
22
+ scope?: string;
23
+ systemPrompt?: string;
24
+ defaultUserMessage?: string;
25
+ workContext?: ContextItem[];
26
+ allowedAIEmployees?: string[];
27
+ allowedModels?: string[];
28
+ senderPlaceholder?: string;
29
+ showContextSelector?: boolean;
30
+ showUpload?: boolean;
31
+ showWebSearch?: boolean;
32
+ showEmployeeSelect?: boolean;
33
+ showModelSelect?: boolean;
34
+ showDisclaimer?: boolean;
35
+ };
36
+ export type AIChatBoxSettings = Required<Pick<AIChatBoxBlockProps, 'showMessages' | 'minWidth' | 'height' | 'systemPrompt' | 'defaultUserMessage' | 'workContext' | 'allowedAIEmployees' | 'allowedModels' | 'senderPlaceholder' | 'showContextSelector' | 'showUpload' | 'showWebSearch' | 'showEmployeeSelect' | 'showModelSelect' | 'showDisclaimer'>> & {
37
+ scope?: string;
38
+ };
@@ -0,0 +1,26 @@
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
+ import type { ContextItem } from '../../ai-employees/types';
10
+ import type { AIChatBoxBlockModel } from './AIChatBoxBlockModel';
11
+ import type { AIChatBoxBlockProps, AIChatBoxSettings } from './types';
12
+ type AIChatBoxScopeRenderContext = {
13
+ resolveJsonTemplate?: (template: string) => unknown | Promise<unknown>;
14
+ };
15
+ export declare const DEFAULT_AI_CHAT_BOX_WIDTH = 400;
16
+ export declare const DEFAULT_AI_CHAT_BOX_HEIGHT = 650;
17
+ export declare const getDefaultAIChatBoxSettings: () => AIChatBoxSettings;
18
+ export declare const getAIChatBoxSettings: (props?: AIChatBoxBlockProps) => AIChatBoxSettings;
19
+ export declare const normalizeAIChatBoxHeight: (height: unknown) => number;
20
+ export declare const getAIChatBoxConversationScope: (model: AIChatBoxBlockModel) => string;
21
+ export declare const getAIChatBoxCreateScope: (model: AIChatBoxBlockModel) => string;
22
+ export declare const renderAIChatBoxScope: (scope: string | undefined, ctx?: AIChatBoxScopeRenderContext) => Promise<string>;
23
+ export declare const normalizeAIChatBoxScopeForSave: (scope: string | undefined) => string;
24
+ export declare const normalizeAIChatBoxWorkContext: (workContext: ContextItem[] | undefined) => ContextItem[];
25
+ export declare const getAIChatBoxWorkContext: (model: AIChatBoxBlockModel) => ContextItem[];
26
+ export {};
@@ -13,18 +13,16 @@ export { AddContextButton } from './ai-employees/AddContextButton';
13
13
  export { AISelection } from './ai-employees/AISelection';
14
14
  export { AISelectionControl } from './ai-employees/AISelectionControl';
15
15
  export { avatars, avatarsMap } from './ai-employees/avatars';
16
- export type { AIEmployee, Attachment, ChatEditorRef, ContextItem, Conversation, Message, SkillSettings, Task, TriggerTaskOptions, WebSearching, } from './ai-employees/types';
16
+ export type { AIEmployee, Attachment, ChatEditorRef, ContextItem, Conversation, Message, SkillSettings, Task, TriggerTaskOptions, UploadAIFileOptions, WebSearching, } from './ai-employees/types';
17
17
  export { formatModelLabel } from './llm-services/model-label';
18
18
  export { createModelSettingsForm, ModelSelect, OptionsFields, type OptionField } from './llm-providers/forms';
19
19
  export { AIConfigRepository, type LLMServiceItem } from './repositories/AIConfigRepository';
20
20
  export { AIPluginFeatureManagerImpl } from './manager/ai-feature-manager';
21
21
  export { AIManager } from './manager/ai-manager';
22
- export type { LLMProviderOptions, ToolModalProps, ToolOptions } from './manager/ai-manager';
22
+ export type { LLMProviderOptions, ToolModalProps, ToolOptions, TriggerModelTaskOptions } from './manager/ai-manager';
23
23
  export * from './features';
24
24
  export { defaultVectorStorePropForm } from './features/components';
25
25
  export { useAIConfigRepository } from './repositories/hooks/useAIConfigRepository';
26
- export { useChatMessagesStore } from './ai-employees/chatbox/stores/chat-messages';
27
- export { useChatBoxStore } from './ai-employees/chatbox/stores/chat-box';
28
- export { useChatConversationsStore } from './ai-employees/chatbox/stores/chat-conversations';
29
26
  export { useChatBoxActions } from './ai-employees/chatbox/hooks/useChatBoxActions';
27
+ export { ChatBoxRuntimeProvider, getGlobalChatBoxRuntime, type ChatBoxRuntime, } from './ai-employees/chatbox/stores/runtime';
30
28
  export { ChatBox, ChatBoxLayout, ChatButton, AIEmployeeSwitcher, ModelSwitcher, } from './ai-employees/chatbox/components';