@nocobase/plugin-ai 2.3.0-alpha.1 → 2.3.0-beta.2
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.
- package/dist/ai/docs/nocobase/ai-dev/watermark-plugin.md +2 -0
- package/dist/ai/docs/nocobase/ai-employees/block/ai-chat-box.md +133 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/rag.md +43 -13
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
- package/dist/ai/docs/nocobase/api/app/env.md +2 -0
- package/dist/ai/docs/nocobase/api/cli/api/resource/create.md +4 -3
- package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
- package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
- package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
- package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
- package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
- package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
- package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
- package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
- package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
- package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
- package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
- package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
- package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
- package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
- package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
- package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
- package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
- package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
- package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
- package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
- package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
- package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
- package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
- package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
- package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
- package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
- package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
- package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
- package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
- package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
- package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
- package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
- package/dist/ai/docs/nocobase/file-manager/file-preview/index.md +44 -3
- package/dist/ai/docs/nocobase/file-manager/storage/aliyun-oss.md +100 -3
- package/dist/ai/docs/nocobase/file-manager/storage/index.md +66 -26
- package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
- package/dist/ai/docs/nocobase/get-started/installation/env.md +1 -1
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
- package/dist/ai/docs/nocobase/plugin-development/build.md +10 -4
- package/dist/ai/docs/nocobase/plugin-development/client/appendix/faq.md +1 -1
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-action.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-block.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/custom-field.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/fullstack-plugin.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/client/examples/settings-page.md +2 -0
- package/dist/ai/docs/nocobase/plugin-development/common/i18n.md +3 -3
- package/dist/ai/docs/nocobase/plugin-development/server/cache.md +1 -1
- package/dist/ai/docs/nocobase/plugin-development/server/collections.md +0 -6
- package/dist/ai/docs/nocobase/plugin-development/server/command.md +2 -2
- package/dist/ai/docs/nocobase/plugin-development/server/context.md +2 -2
- package/dist/ai/docs/nocobase/plugin-development/server/i18n.md +4 -4
- package/dist/ai/docs/nocobase/plugin-development/write-your-first-plugin.md +91 -43
- package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
- package/dist/ai/docs/nocobase/users-permissions/sync/index.md +8 -1
- package/dist/ai/docs/nocobase/users-permissions/sync/sources/dingtalk.md +138 -0
- package/dist/ai/docs/nocobase/users-permissions/sync/sources/ldap.md +87 -0
- package/dist/ai/docs/nocobase/workflow/nodes/javascript.md +21 -1
- package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
- package/dist/ai/tools/executeFrontendTool.js +86 -0
- package/dist/ai/tools/getSkill.js +1 -1
- package/dist/ai/tools/knowledge-base-retrieve.js +3 -1
- package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
- package/dist/ai/tools/loadFrontendTool.js +99 -0
- package/dist/client/244.28ee769f796b7c2f.js +10 -0
- package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
- package/dist/client/681.6ffbc9329b9ac242.js +10 -0
- package/dist/{client-v2/705.1d10027ff8cfdf79.js → client/705.a4fe26945d175e8a.js} +1 -1
- package/dist/client/index.d.ts +1 -3
- package/dist/client/index.js +8 -8
- package/dist/client-v2/244.39348a95d627d9e3.js +10 -0
- package/dist/client-v2/420.a5b929a5e7f330be.js +10 -0
- package/dist/client-v2/681.6890caa389564ff7.js +10 -0
- package/dist/client-v2/705.f2e1b26a3f000075.js +10 -0
- package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
- package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
- package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
- package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
- package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
- package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
- package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
- package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/reasoning-stream.d.ts +10 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
- package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
- package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -33
- package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
- package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
- package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
- package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
- package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
- package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
- package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
- package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
- package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/types.d.ts +30 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
- package/dist/client-v2/{ai-employees/chatbox/components/DebugPanel.d.ts → block/ai-chat-box/components/AIChatBoxCoreView.d.ts} +1 -1
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
- package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
- package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
- package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
- package/dist/client-v2/index.d.ts +3 -5
- package/dist/client-v2/index.js +3 -3
- package/dist/client-v2/llm-providers/forms.d.ts +2 -0
- package/dist/client-v2/llm-providers/index.d.ts +1 -0
- package/dist/client-v2/llm-services/model-select.d.ts +33 -0
- package/dist/client-v2/llm-services/utils.d.ts +1 -0
- package/dist/client-v2/manager/ai-manager.d.ts +10 -3
- package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
- package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
- package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +8 -0
- package/dist/client-v2/pages/EmployeesPage.d.ts +12 -0
- package/dist/client-v2/pages/LLMServicesPage.d.ts +9 -4
- package/dist/client-v2/repositories/AIConfigRepository.d.ts +2 -0
- package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
- package/dist/collections/ai-employees.d.ts +1 -0
- package/dist/collections/ai-employees.js +1 -0
- package/dist/common/ai-employee-validation.d.ts +15 -0
- package/dist/common/ai-employee-validation.js +61 -0
- package/dist/common/error-codes.d.ts +13 -0
- package/dist/common/error-codes.js +48 -0
- package/dist/common/frontend-tools.d.ts +26 -0
- package/dist/common/frontend-tools.js +57 -0
- package/dist/common/llm-service-models.d.ts +16 -0
- package/dist/common/llm-service-models.js +84 -0
- package/dist/externalVersion.js +19 -17
- package/dist/locale/de-DE.json +2 -1
- package/dist/locale/en-US.json +85 -5
- package/dist/locale/es-ES.json +2 -1
- package/dist/locale/fr-FR.json +2 -1
- package/dist/locale/hu-HU.json +2 -1
- package/dist/locale/id-ID.json +2 -1
- package/dist/locale/it-IT.json +2 -1
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/ko-KR.json +2 -1
- package/dist/locale/nl-NL.json +2 -1
- package/dist/locale/pt-BR.json +2 -1
- package/dist/locale/ru-RU.json +2 -1
- package/dist/locale/tr-TR.json +2 -1
- package/dist/locale/uk-UA.json +2 -1
- package/dist/locale/vi-VN.json +2 -1
- package/dist/locale/zh-CN.json +85 -5
- package/dist/locale/zh-TW.json +2 -1
- package/dist/node_modules/@langchain/mistralai/package.json +1 -1
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +4 -1
- package/dist/server/ai-employees/ai-conversations.js +2 -0
- package/dist/server/ai-employees/ai-employee.d.ts +4 -1
- package/dist/server/ai-employees/ai-employee.js +112 -47
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +21 -1
- package/dist/server/ai-employees/ai-knowledge-base.js +76 -8
- package/dist/server/ai-employees/middleware/conversation.js +9 -2
- package/dist/server/ai-employees/reasoning-stream-state.d.ts +23 -0
- package/dist/server/ai-employees/reasoning-stream-state.js +63 -0
- package/dist/server/collections/ai-conversations.js +5 -0
- package/dist/server/document-loader/constants.js +1 -1
- package/dist/server/features/knowledge-base.d.ts +2 -0
- package/dist/server/frontend-tools.d.ts +25 -0
- package/dist/server/frontend-tools.js +171 -0
- package/dist/server/llm-providers/common/reasoning.js +18 -10
- package/dist/server/llm-providers/deepseek/index.d.ts +10 -0
- package/dist/server/llm-providers/deepseek/index.js +32 -0
- package/dist/server/llm-providers/deepseek/provider.d.ts +57 -0
- package/dist/server/llm-providers/deepseek/provider.js +320 -0
- package/dist/server/llm-providers/deepseek/reasoning.d.ts +83 -0
- package/dist/server/llm-providers/deepseek/reasoning.js +285 -0
- package/dist/server/llm-providers/mistral.d.ts +1 -1
- package/dist/server/llm-providers/provider.d.ts +1 -0
- package/dist/server/llm-providers/provider.js +3 -0
- package/dist/server/llm-providers/shengsuanyun.d.ts +29 -0
- package/dist/server/llm-providers/shengsuanyun.js +114 -0
- package/dist/server/manager/ai-feature-manager.js +1 -1
- package/dist/server/manager/ai-manager.d.ts +3 -0
- package/dist/server/manager/ai-manager.js +7 -2
- package/dist/server/manager/work-context-handler.js +10 -3
- package/dist/server/migrations/20260501000000-ai-employee-knowledge-base-retrieval-strategy.d.ts +14 -0
- package/dist/server/migrations/20260501000000-ai-employee-knowledge-base-retrieval-strategy.js +49 -0
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +31 -0
- package/dist/server/resource/aiConversations.d.ts +2 -0
- package/dist/server/resource/aiConversations.js +33 -3
- package/dist/server/resource/aiEmployees.d.ts +2 -0
- package/dist/server/resource/aiEmployees.js +70 -0
- package/dist/server/resource/aiWorkflowTasks.js +9 -1
- package/dist/server/resource/llmServices.d.ts +11 -0
- package/dist/server/resource/llmServices.js +85 -0
- package/dist/server/types/ai-message.type.d.ts +4 -0
- package/dist/server/types/knowledge-base.type.d.ts +8 -3
- package/dist/swagger/common.d.ts +143 -0
- package/dist/swagger/common.js +144 -0
- package/dist/swagger/employees.d.ts +301 -0
- package/dist/swagger/employees.js +131 -0
- package/dist/swagger/index.d.ts +1617 -0
- package/dist/swagger/index.js +62 -0
- package/dist/swagger/llm.d.ts +563 -0
- package/dist/swagger/llm.js +255 -0
- package/dist/swagger/schemas.d.ts +757 -0
- package/dist/swagger/schemas.js +392 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
- package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
- package/dist/client/372.40eb52905e3f3049.js +0 -10
- package/dist/client/681.399948c18d753667.js +0 -10
- package/dist/client/705.380279da896021fb.js +0 -10
- package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
- package/dist/client-v2/406.341be51205c674e0.js +0 -10
- package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
- package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
- package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
- package/dist/client-v2/debug-logger.d.ts +0 -52
- package/dist/server/llm-providers/deepseek.d.ts +0 -40
- package/dist/server/llm-providers/deepseek.js +0 -174
|
@@ -1,23 +1,51 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "ctx.ai"
|
|
3
|
-
description: "Use ctx.ai in RunJS to trigger AI employee tasks, either with inline task content or with tasks configured on an AI employee action."
|
|
4
|
-
keywords: "ctx.ai,AI employee,triggerTask,triggerModelTask,RunJS,NocoBase"
|
|
3
|
+
description: "Use ctx.ai in RunJS to trigger AI employee tasks in the global conversation or a specified AI Chat Box, either with inline task content or with tasks configured on an AI employee action."
|
|
4
|
+
keywords: "ctx.ai,AI employee,uploadFile,attachments,triggerTask,triggerModelTask,onResponseLoadingChange,chatBoxUid,AI Chat Box,RunJS,NocoBase"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# ctx.ai
|
|
8
8
|
|
|
9
9
|
Use `ctx.ai` in RunJS to trigger **AI employee tasks**. It works well in JSBlock, JSAction, and other interactions where a button, form, or business flow needs to hand work to a specific AI employee.
|
|
10
10
|
|
|
11
|
-
`ctx.ai`
|
|
11
|
+
`ctx.ai` uploads AI task attachments and triggers tasks. File uploads can be awaited, but task triggering does not return the execution result of the AI employee task. After the call, the task enters the AI employee conversation flow, and the result is handled by the AI employee session.
|
|
12
12
|
|
|
13
13
|
:::warning Note
|
|
14
14
|
|
|
15
|
-
`ctx.ai` is provided by the AI plugin. If the AI plugin is not enabled, or the current RunJS environment has not loaded the corresponding client capability, `ctx.ai` may not exist. You can check `ctx.ai?.triggerTask
|
|
15
|
+
`ctx.ai` is provided by the AI plugin. If the AI plugin is not enabled, or the current RunJS environment has not loaded the corresponding client capability, `ctx.ai` may not exist. You can check `ctx.ai?.uploadFile`, `ctx.ai?.triggerTask`, or `ctx.ai?.triggerModelTask` before calling it.
|
|
16
16
|
|
|
17
17
|
:::
|
|
18
18
|
|
|
19
19
|
## Methods
|
|
20
20
|
|
|
21
|
+
### ctx.ai.uploadFile()
|
|
22
|
+
|
|
23
|
+
Upload one file and return an attachment object that can be passed directly to an AI employee task.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const attachment = await ctx.ai.uploadFile(file, options);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Parameter | Type | Description |
|
|
30
|
+
|------|------|------|
|
|
31
|
+
| `file` | `File` | Browser file object to upload. |
|
|
32
|
+
| `options.onProgress` | `(percent: number) => void` | Upload progress callback. `percent` ranges from `0` to `100`. |
|
|
33
|
+
| `options.signal` | `AbortSignal` | Signal used to cancel the upload. |
|
|
34
|
+
|
|
35
|
+
The upload uses the file storage configured by the AI plugin and creates a record in `aiFiles`. The returned object includes fields such as `id`, `filename`, `url`, and `source`:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const attachment = await ctx.ai.uploadFile(file, {
|
|
39
|
+
onProgress(percent) {
|
|
40
|
+
console.log('upload progress', percent);
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// attachment can be placed directly in message.attachments
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The Promise is rejected when the upload fails. Removing an attachment from the local UI does not delete the record already created in `aiFiles`, matching the behavior of the default AI chat window.
|
|
48
|
+
|
|
21
49
|
### ctx.ai.triggerTask()
|
|
22
50
|
|
|
23
51
|
Trigger an AI employee task directly.
|
|
@@ -30,8 +58,10 @@ ctx.ai.triggerTask(options: TriggerTaskOptions): void
|
|
|
30
58
|
|------|------|------|
|
|
31
59
|
| `aiEmployee` | `string \| AIEmployee` | AI employee. When a string is passed, NocoBase matches `AIEmployee.username` exactly, and the AI employee must be accessible to the current user. |
|
|
32
60
|
| `tasks` | `Task[]` | Tasks to trigger. |
|
|
61
|
+
| `chatBoxUid` | `string` | FlowModel uid of the AI Chat Box block that should receive the task. |
|
|
33
62
|
| `open` | `boolean` | Whether to open the AI employee conversation panel. |
|
|
34
63
|
| `auto` | `boolean` | Whether to use the auto-trigger semantics of an AI employee action. |
|
|
64
|
+
| `onResponseLoadingChange` | `(loading: boolean) => void` | Model response loading callback. It only runs when this task is sent automatically. |
|
|
35
65
|
|
|
36
66
|
Common `Task` fields:
|
|
37
67
|
|
|
@@ -40,12 +70,160 @@ Common `Task` fields:
|
|
|
40
70
|
| `title` | `string` | Task title. |
|
|
41
71
|
| `message.system` | `string` | System message, used to constrain the AI employee's role and output requirements. |
|
|
42
72
|
| `message.user` | `string` | User message, which is the main instruction for this task. |
|
|
73
|
+
| `message.attachments` | `Attachment[]` | Attachments used by the task, usually returned by `ctx.ai.uploadFile()`. |
|
|
43
74
|
| `message.workContext` | `ContextItem[]` | Page block context used by the task. |
|
|
44
75
|
| `autoSend` | `boolean` | Whether to send the task message automatically. |
|
|
45
76
|
| `webSearch` | `boolean` | Whether Web search is allowed for this task. |
|
|
46
77
|
| `model` | `{ llmService: string; model: string } \| null` | Model used by this task. |
|
|
47
78
|
| `skillSettings` | `SkillSettings` | Skills and tools available to this task. |
|
|
48
79
|
|
|
80
|
+
### Track the Response Loading State
|
|
81
|
+
|
|
82
|
+
Pass `onResponseLoadingChange` in the top-level options to track the model response loading state for this task. The callback receives `true` when NocoBase starts waiting for the model response, and `false` when the response completes, is canceled, or fails. If the React component has declared `setResponseLoading` with `useState`, you can write:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
ctx.ai.triggerTask({
|
|
86
|
+
aiEmployee: 'nathan',
|
|
87
|
+
open: true,
|
|
88
|
+
tasks: [
|
|
89
|
+
{
|
|
90
|
+
title: ctx.t('Review current page'),
|
|
91
|
+
message: {
|
|
92
|
+
user: 'Review the current page and summarize the main risks.',
|
|
93
|
+
},
|
|
94
|
+
autoSend: true,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
onResponseLoadingChange(loading) {
|
|
98
|
+
setResponseLoading(loading);
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`onResponseLoadingChange` only tracks the model response started directly by this `triggerTask()` call. With `autoSend: false`, the task is placed in the chat draft and the callback does not run. If the user sends the draft later, that manual send does not reuse this callback.
|
|
104
|
+
|
|
105
|
+
In a React component inside a JS block, this state update rerenders the component while it remains mounted.
|
|
106
|
+
|
|
107
|
+
### Target an AI Chat Box
|
|
108
|
+
|
|
109
|
+
Set `chatBoxUid` on the top-level `triggerTask()` options to trigger the task in a mounted AI Chat Box block instead of the global AI employee dialog.
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
ctx.ai.triggerTask({
|
|
113
|
+
aiEmployee: 'nathan',
|
|
114
|
+
chatBoxUid: 'AI_CHAT_BOX_BLOCK_UID',
|
|
115
|
+
open: true,
|
|
116
|
+
tasks: [
|
|
117
|
+
{
|
|
118
|
+
title: ctx.t('Review current page'),
|
|
119
|
+
message: {
|
|
120
|
+
user: 'Review the current page and summarize the main risks.',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The uid must belong to the outer AI Chat Box block currently mounted on the page. Do not put this routing value inside `tasks`. If the target block cannot be found, NocoBase reports an error and does not fall back to the global dialog. When `chatBoxUid` is omitted, the task uses the global AI employee dialog.
|
|
128
|
+
|
|
129
|
+
### Upload and Send Attachments in JSBlock
|
|
130
|
+
|
|
131
|
+
The following example renders file upload, task instructions, and a send button in JSBlock. Uploaded files are passed to the AI employee through `message.attachments`:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
if (!ctx.ai?.uploadFile || !ctx.ai?.triggerTask) {
|
|
135
|
+
ctx.message.error(ctx.t('AI employee task API is not available.'));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const { React } = ctx.libs;
|
|
140
|
+
const { useState } = React;
|
|
141
|
+
const { Button, Card, Input, Space, Upload } = ctx.libs.antd;
|
|
142
|
+
const { InboxOutlined, SendOutlined } = ctx.libs.antdIcons;
|
|
143
|
+
|
|
144
|
+
const AttachmentTask = () => {
|
|
145
|
+
const [prompt, setPrompt] = useState('');
|
|
146
|
+
const [fileList, setFileList] = useState([]);
|
|
147
|
+
|
|
148
|
+
const uploadAttachment = async ({ file, onError, onProgress, onSuccess }) => {
|
|
149
|
+
try {
|
|
150
|
+
const attachment = await ctx.ai.uploadFile(file, {
|
|
151
|
+
onProgress(percent) {
|
|
152
|
+
onProgress?.({ percent });
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
onSuccess?.(attachment);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
onError?.(error instanceof Error ? error : new Error(ctx.t('File upload failed')));
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const sendTask = () => {
|
|
162
|
+
const attachments = fileList
|
|
163
|
+
.filter((file) => file.status === 'done' && file.response)
|
|
164
|
+
.map((file) => file.response);
|
|
165
|
+
|
|
166
|
+
if (!prompt.trim()) {
|
|
167
|
+
ctx.message.warning(ctx.t('Enter task instructions'));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
ctx.ai.triggerTask({
|
|
172
|
+
aiEmployee: 'viz',
|
|
173
|
+
open: true,
|
|
174
|
+
tasks: [
|
|
175
|
+
{
|
|
176
|
+
title: ctx.t('Analyze uploaded files'),
|
|
177
|
+
message: {
|
|
178
|
+
user: prompt.trim(),
|
|
179
|
+
attachments,
|
|
180
|
+
},
|
|
181
|
+
autoSend: true,
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
setPrompt('');
|
|
186
|
+
setFileList([]);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const uploading = fileList.some((file) => file.status === 'uploading');
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<Card title={ctx.t('AI file analysis')}>
|
|
193
|
+
<Space direction="vertical" size="middle" style={{ width: '100%' }}>
|
|
194
|
+
<Upload.Dragger
|
|
195
|
+
multiple
|
|
196
|
+
fileList={fileList}
|
|
197
|
+
customRequest={uploadAttachment}
|
|
198
|
+
onChange={({ fileList: nextFileList }) => setFileList(nextFileList)}
|
|
199
|
+
>
|
|
200
|
+
<p className="ant-upload-drag-icon"><InboxOutlined /></p>
|
|
201
|
+
<p>{ctx.t('Click or drag files here to upload')}</p>
|
|
202
|
+
</Upload.Dragger>
|
|
203
|
+
<Input.TextArea
|
|
204
|
+
value={prompt}
|
|
205
|
+
onChange={(event) => setPrompt(event.target.value)}
|
|
206
|
+
placeholder={ctx.t('Describe the task for the AI employee')}
|
|
207
|
+
autoSize={{ minRows: 3, maxRows: 8 }}
|
|
208
|
+
/>
|
|
209
|
+
<Button
|
|
210
|
+
type="primary"
|
|
211
|
+
icon={<SendOutlined />}
|
|
212
|
+
disabled={uploading || !prompt.trim()}
|
|
213
|
+
onClick={sendTask}
|
|
214
|
+
>
|
|
215
|
+
{ctx.t('Send to AI')}
|
|
216
|
+
</Button>
|
|
217
|
+
</Space>
|
|
218
|
+
</Card>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
ctx.render(<AttachmentTask />);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
With `autoSend: false`, the attachments and task instructions are placed in the AI chat draft instead of being sent immediately.
|
|
226
|
+
|
|
49
227
|
### Add Page Block Context
|
|
50
228
|
|
|
51
229
|
`message.workContext` currently passes page blocks. Put the FlowModel uid of the target page block into it:
|
|
@@ -163,9 +341,15 @@ ctx.ai.triggerModelTask(uid: string, taskIndex: number, options?: TriggerModelTa
|
|
|
163
341
|
| `taskIndex` | `number` | Task index, starting from `0`. |
|
|
164
342
|
| `options.open` | `boolean` | Whether to open the AI employee conversation panel. |
|
|
165
343
|
| `options.auto` | `boolean` | Whether to use the auto-trigger semantics of an AI employee action. |
|
|
344
|
+
| `options.attachments` | `Attachment[]` | Attachments dynamically appended to the configured task. |
|
|
345
|
+
| `options.onResponseLoadingChange` | `(loading: boolean) => void` | Model response loading callback. It only runs when the configured task is sent automatically. |
|
|
166
346
|
|
|
167
347
|
This method reads the AI employee and task configuration from the target model. It is useful when the task has already been configured on an AI employee action on the page, and RunJS only needs to trigger it.
|
|
168
348
|
|
|
349
|
+
The public `triggerModelTask()` options do not accept `chatBoxUid`. To target an AI Chat Box, configure `chatBoxUid` on the preset task of the AI employee action. `triggerModelTask()` continues to reuse that preset value.
|
|
350
|
+
|
|
351
|
+
`options.onResponseLoadingChange` behaves the same as the option on `triggerTask()`. Whether it runs depends on the configured task's `autoSend` value. It does not run when that task uses `autoSend: false`.
|
|
352
|
+
|
|
169
353
|
```ts
|
|
170
354
|
if (!ctx.ai?.triggerModelTask) {
|
|
171
355
|
ctx.message.error(ctx.t('AI employee task API is not available.'));
|
|
@@ -176,6 +360,7 @@ const weeklyReviewActionUid = 'AI_EMPLOYEE_ACTION_MODEL_UID';
|
|
|
176
360
|
|
|
177
361
|
ctx.ai.triggerModelTask(weeklyReviewActionUid, 0, {
|
|
178
362
|
open: true,
|
|
363
|
+
attachments,
|
|
179
364
|
});
|
|
180
365
|
|
|
181
366
|
ctx.message.success(ctx.t('Configured AI employee task triggered.'));
|
|
@@ -195,9 +380,14 @@ If the target model does not exist, has no AI employee configured, or the specif
|
|
|
195
380
|
## Notes
|
|
196
381
|
|
|
197
382
|
- `triggerTask()` and `triggerModelTask()` are fire-and-forget. They do not return the execution result of the AI employee task.
|
|
383
|
+
- `uploadFile()` returns a Promise. Wait for the upload to finish before triggering a task that uses the attachment.
|
|
198
384
|
- `aiEmployee` strings only match `AIEmployee.username` exactly. They do not match nicknames, job titles, or translated names.
|
|
199
385
|
- `triggerModelTask()` uses a `0`-based `taskIndex`.
|
|
200
386
|
- `triggerModelTask()` reads task configuration from the target AI employee action model. If the task needs work context, configure `message.workContext` on that task.
|
|
387
|
+
- Top-level `triggerTask().chatBoxUid` must reference an AI Chat Box block currently mounted on the page.
|
|
388
|
+
- `triggerModelTask()` keeps using `chatBoxUid` configured on its preset task.
|
|
389
|
+
- Dynamic `triggerModelTask()` attachments are appended to the preset task's existing `message.attachments` without changing the saved task configuration.
|
|
390
|
+
- `onResponseLoadingChange` only tracks a model response automatically sent by the current call. It does not track a message the user sends manually later.
|
|
201
391
|
|
|
202
392
|
## Related
|
|
203
393
|
|
|
@@ -8,6 +8,13 @@ pkg: '@nocobase/plugin-user-data-sync'
|
|
|
8
8
|
|
|
9
9
|
This feature allows you to register and manage user data synchronization sources. By default, an HTTP API is provided, but additional data sources can be supported through plugins. It supports syncing data to the **Users** and **Departments** collections by default, with the possibility to extend synchronization to other target resources using plugins.
|
|
10
10
|
|
|
11
|
+
## Available data sources
|
|
12
|
+
|
|
13
|
+
- [DingTalk](./sources/dingtalk.md) — Synchronize DingTalk users and departments, with incremental updates through HTTP callbacks or Stream mode.
|
|
14
|
+
- [LDAP](./sources/ldap.md) — Synchronize LDAP users and optional organizational units by reusing an LDAP authenticator.
|
|
15
|
+
- [WeCom](./sources/wecom.md) — Synchronize users and departments from WeCom.
|
|
16
|
+
- [HTTP API](./sources/api.md) — Push user and department data through the synchronization API.
|
|
17
|
+
|
|
11
18
|
## Data Source Management and Synchronization
|
|
12
19
|
|
|
13
20
|
|
|
@@ -51,4 +58,4 @@ For failed synchronization tasks, you can click **Retry**.
|
|
|
51
58
|
In case of synchronization failures, you can troubleshoot the issue through system logs. Additionally, raw synchronization records are stored in the `user-data-sync` directory under the application logs folder.
|
|
52
59
|
|
|
53
60
|
|
|
54
|
-

|
|
61
|
+

|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
pkg: '@nocobase/plugin-auth-dingtalk'
|
|
3
|
+
title: "Synchronize User Data from DingTalk"
|
|
4
|
+
description: "Synchronize DingTalk users and departments to NocoBase and receive incremental changes through HTTP callbacks or Stream mode."
|
|
5
|
+
keywords: "DingTalk,user synchronization,department synchronization,Stream mode,event subscription,NocoBase"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Synchronize User Data from DingTalk
|
|
9
|
+
|
|
10
|
+
<PluginInfo commercial="true" name="auth-dingtalk"></PluginInfo>
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
14
|
+
The **DingTalk** plugin synchronizes users and departments from a DingTalk organization to NocoBase. It supports full synchronization on demand and incremental updates through either an HTTP callback or a Stream connection.
|
|
15
|
+
|
|
16
|
+
## Before you begin
|
|
17
|
+
|
|
18
|
+
1. Install and enable the **DingTalk** and **User Data Synchronization** plugins.
|
|
19
|
+
2. Create an internal application in the DingTalk developer console.
|
|
20
|
+
3. Grant the contact permissions and configure the data permission scope described below.
|
|
21
|
+
4. Copy the application's Client ID and Client Secret. See [Authentication: DingTalk](/auth-verification/auth-dingtalk/) for the credential setup.
|
|
22
|
+
|
|
23
|
+
## Configure contact permissions and the data permission scope
|
|
24
|
+
|
|
25
|
+
Open **Permission Management** for the application in the DingTalk developer console and grant the following contact permissions.
|
|
26
|
+
|
|
27
|
+
| Permission | Identifier | Required | Purpose |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| Read department information | `qyapi_get_department_list` | Yes | Read the department list, names, and hierarchy. |
|
|
30
|
+
| Read department members | `qyapi_get_department_member` | Yes | Read the member list of each department. |
|
|
31
|
+
| Read member information | `qyapi_get_member` | Yes | Read member details and department memberships. |
|
|
32
|
+
| Employee mobile number information | `fieldMobile` | When using mobile numbers | Synchronize mobile numbers. This permission is required when **User unique identifier field** is `mobile`. |
|
|
33
|
+
| Email and other personal information | `fieldEmail` | No | Grant this permission when user email addresses need to be synchronized. |
|
|
34
|
+
|
|
35
|
+
After granting the permissions, configure the application's **Data Permission Scope** (also called **Contact Permission Scope** or **Visibility Range** in some console versions) to include the departments and employees that may be synchronized. Select all employees for a full organization synchronization. If only selected departments or employees are included, NocoBase synchronizes only those entries.
|
|
36
|
+
|
|
37
|
+
:::warning
|
|
38
|
+
API permissions determine which fields the application can read, while the data permission scope determines which departments and employees it can read. Both must be configured. Event subscriptions do not replace contact read permissions: after receiving an event, NocoBase still calls DingTalk APIs to retrieve the latest user or department information.
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
If the same DingTalk application is also used for sign-in, grant the personal-information permissions described in [Authentication: DingTalk](/auth-verification/auth-dingtalk/). Those sign-in permissions are not required solely for user data synchronization.
|
|
42
|
+
|
|
43
|
+
## Add a DingTalk synchronization source
|
|
44
|
+
|
|
45
|
+
Go to **Users & Permissions > Synchronize**, click **Add new**, and select **DingTalk** as the type.
|
|
46
|
+
|
|
47
|
+
Configure the following fields:
|
|
48
|
+
|
|
49
|
+
| Field | Description |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| Source name | A unique name for this synchronization source. |
|
|
52
|
+
| Enabled | Starts event reception for this source and enables synchronization tasks. |
|
|
53
|
+
| Client ID | The Client ID of the DingTalk internal application. Environment variables and secrets are supported. |
|
|
54
|
+
| Client Secret | The Client Secret of the DingTalk internal application. Environment variables and secrets are supported. |
|
|
55
|
+
| User unique identifier field | Select `mobile` or `unionId`. Keep the selected field stable after the first synchronization. Users without a value for the selected field are skipped. |
|
|
56
|
+
| Event receiving mode | Select **HTTP callback** or **Stream mode** for incremental user and department changes. |
|
|
57
|
+
|
|
58
|
+
Save and enable the source, then click **Sync** to complete the initial full synchronization before relying on incremental events.
|
|
59
|
+
|
|
60
|
+
## Choose an event receiving mode
|
|
61
|
+
|
|
62
|
+
### Stream mode
|
|
63
|
+
|
|
64
|
+
Stream mode establishes an outbound persistent connection from the NocoBase server to DingTalk. It does not require a public callback URL, Token, or EncodingAESKey.
|
|
65
|
+
|
|
66
|
+
1. In the DingTalk developer console, open the application's event subscription settings and select **Stream mode**.
|
|
67
|
+
2. Subscribe to the user and department change events required by the application.
|
|
68
|
+
3. In NocoBase, select **Stream mode**, save the source, and enable it.
|
|
69
|
+
|
|
70
|
+
The Stream client starts when the source is enabled. Updating, disabling, or deleting the source refreshes or closes the corresponding connection.
|
|
71
|
+
|
|
72
|
+
:::info
|
|
73
|
+
The NocoBase server must be able to establish outbound connections to DingTalk. A reverse proxy or public inbound callback endpoint is not required for Stream mode.
|
|
74
|
+
:::
|
|
75
|
+
|
|
76
|
+
### HTTP callback
|
|
77
|
+
|
|
78
|
+
HTTP callback mode receives DingTalk events through a NocoBase callback URL.
|
|
79
|
+
|
|
80
|
+
1. Select **HTTP callback** in NocoBase.
|
|
81
|
+
2. Enter the Token and EncodingAESKey configured for the DingTalk event subscription.
|
|
82
|
+
3. Save the source and copy the generated **Event callback URL**.
|
|
83
|
+
4. Configure that URL in the DingTalk developer console and subscribe to the required user and department events.
|
|
84
|
+
|
|
85
|
+
The callback URL must be reachable by DingTalk. In a production environment, expose it through HTTPS and make sure the reverse proxy forwards the request path unchanged.
|
|
86
|
+
|
|
87
|
+
## Supported incremental events
|
|
88
|
+
|
|
89
|
+
Both event receiving modes handle the following DingTalk events:
|
|
90
|
+
|
|
91
|
+
| Event | Result in NocoBase |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| `user_add_org` | Create or update the user. |
|
|
94
|
+
| `user_modify_org` | Update the user. |
|
|
95
|
+
| `user_leave_org` | Delete the synchronized user. |
|
|
96
|
+
| `org_dept_create` | Create or update the department. |
|
|
97
|
+
| `org_dept_modify` | Update the department and synchronize its users. |
|
|
98
|
+
| `org_dept_remove` | Delete the synchronized department. |
|
|
99
|
+
|
|
100
|
+
## Synchronized fields
|
|
101
|
+
|
|
102
|
+
### Department fields
|
|
103
|
+
|
|
104
|
+
| DingTalk field | NocoBase field or purpose |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `dept_id` | Source-unique department identifier. |
|
|
107
|
+
| `name` | Department name. |
|
|
108
|
+
| `parent_id` | Parent department used to build the department hierarchy. If the parent is outside the data permission scope, the department is synchronized as a root department. |
|
|
109
|
+
|
|
110
|
+
### User fields
|
|
111
|
+
|
|
112
|
+
| DingTalk field | NocoBase field or purpose |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `mobile` or `unionid` | Generates the source-unique user identifier and username according to **User unique identifier field**. A user without the selected field is skipped. |
|
|
115
|
+
| `name` | User nickname. |
|
|
116
|
+
| `mobile` | Phone number. Requires the **Employee mobile number information** permission. |
|
|
117
|
+
| `email`, falling back to `org_email` | Email address. Requires the **Email and other personal information** permission. |
|
|
118
|
+
| `dept_id_list` | Department memberships. Only departments within the data permission scope are retained. |
|
|
119
|
+
| `dept_order_list` | Primary department. |
|
|
120
|
+
| `leader_in_dept` | Whether the user is an owner of the corresponding department. |
|
|
121
|
+
|
|
122
|
+
### Department owners
|
|
123
|
+
|
|
124
|
+
DingTalk uses `leader_in_dept` in the user details to indicate whether the user is an owner of each department they belong to. NocoBase synchronizes this flag separately for each department: the same user can own multiple departments, and an owned department does not have to be the user's primary department. Only departments within the data permission scope are included.
|
|
125
|
+
|
|
126
|
+
When an owner flag is removed in DingTalk, the corresponding owner flag in NocoBase is removed by the next synchronization. Owner status changed manually in NocoBase may be overwritten by DingTalk data during the next synchronization.
|
|
127
|
+
|
|
128
|
+
Full and incremental synchronization use the same field mapping. Other DingTalk user fields, such as avatar, job title, and employee number, are not currently synchronized.
|
|
129
|
+
|
|
130
|
+
## Troubleshooting
|
|
131
|
+
|
|
132
|
+
- If synchronization returns no data or an entire department is missing, verify the three required contact read permissions and confirm that the department is included in the data permission scope.
|
|
133
|
+
- If a user is present but their mobile number or email address is empty, verify the **Employee mobile number information** or **Email and other personal information** permission respectively.
|
|
134
|
+
- If DingTalk reports that a department or employee is outside the permission scope, expand the application's data permission scope instead of only resubscribing to events.
|
|
135
|
+
- If users are skipped, verify that they have a value for the configured unique identifier field.
|
|
136
|
+
- For Stream mode, check the application logs for `Dingtalk stream client starting`, `Dingtalk stream client started`, or connection errors.
|
|
137
|
+
- For HTTP callback mode, verify that the callback URL is publicly reachable and that Token and EncodingAESKey match the DingTalk configuration.
|
|
138
|
+
- Run a manual full synchronization after changing the application's permissions or visibility range.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
pkg: '@nocobase/plugin-auth-ldap'
|
|
3
|
+
title: "Synchronize User Data from LDAP"
|
|
4
|
+
description: "Synchronize LDAP users and departments to NocoBase by reusing an existing LDAP authenticator."
|
|
5
|
+
keywords: "LDAP,user synchronization,department synchronization,Bind DN,Search DN,NocoBase"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Synchronize User Data from LDAP
|
|
9
|
+
|
|
10
|
+
<PluginInfo commercial="true" name="auth-ldap"></PluginInfo>
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
14
|
+
The **Auth: LDAP** plugin can use an existing LDAP authenticator as a user data synchronization source. The synchronization source reuses the authenticator's LDAP connection, Bind DN, Search DN, search scope, and attribute mappings, then writes the resulting users and optional department hierarchy to NocoBase.
|
|
15
|
+
|
|
16
|
+
## Before you begin
|
|
17
|
+
|
|
18
|
+
1. Install and enable the **Auth: LDAP** and **User Data Synchronization** plugins.
|
|
19
|
+
2. Create and verify an LDAP authenticator. See [Authentication: LDAP](/auth-verification/auth-ldap/).
|
|
20
|
+
3. Make sure the authenticator's attribute mappings include the fields needed by NocoBase, such as username or email, nickname, and phone number.
|
|
21
|
+
|
|
22
|
+
## Add an LDAP synchronization source
|
|
23
|
+
|
|
24
|
+
Go to **Users & Permissions > Synchronize**, click **Add new**, and select **LDAP** as the type.
|
|
25
|
+
|
|
26
|
+
Configure the following fields:
|
|
27
|
+
|
|
28
|
+
| Field | Description |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Source name | A unique name for this synchronization source. |
|
|
31
|
+
| Enabled | Enables manual synchronization and LDAP synchronization tasks for this source. |
|
|
32
|
+
| LDAP authenticator | The existing LDAP authenticator whose connection and attribute mappings will be reused. |
|
|
33
|
+
| Sync filter | The LDAP filter used to find users during synchronization. The default is `(&(objectCategory=person)(objectClass=user))`. Adjust it to match your directory schema. |
|
|
34
|
+
| Size limit | Optional maximum number of entries returned by an LDAP search. Leave it empty to use the LDAP server's default limit. |
|
|
35
|
+
| Page size | Optional page size for paged LDAP searches. Use this when the directory contains more entries than a single query can return. |
|
|
36
|
+
| Sync departments | Also synchronizes the LDAP organizational hierarchy to NocoBase departments. |
|
|
37
|
+
| Department search DN | Required when department synchronization is enabled. Specify the DN that contains the organizational units to synchronize, for example `ou=departments,dc=example,dc=com`. |
|
|
38
|
+
|
|
39
|
+
:::info
|
|
40
|
+
The synchronization source uses the selected authenticator's Bind DN and Bind password to search LDAP. It does not store a second copy of the LDAP connection credentials.
|
|
41
|
+
:::
|
|
42
|
+
|
|
43
|
+
## Synchronize users
|
|
44
|
+
|
|
45
|
+
Save and enable the source, then click **Sync** to start a full synchronization. Open **Task** to review the result and retry a failed task.
|
|
46
|
+
|
|
47
|
+
User matching follows the field selected in the LDAP authenticator's **Use this field to bind the user** setting. Keep that setting and the authenticator's attribute mappings stable after the first synchronization to avoid creating duplicate users.
|
|
48
|
+
|
|
49
|
+
## Synchronize departments
|
|
50
|
+
|
|
51
|
+
Enable **Sync departments** and enter a **Department search DN** when the LDAP directory contains a hierarchy that should be represented in NocoBase.
|
|
52
|
+
|
|
53
|
+
The plugin searches organizational units below that DN, preserves their parent-child relationships, and associates users with departments based on their distinguished names. The configured Department search DN must cover the organizational units referenced by the users you expect to synchronize.
|
|
54
|
+
|
|
55
|
+
## Synchronized fields
|
|
56
|
+
|
|
57
|
+
### User fields
|
|
58
|
+
|
|
59
|
+
User fields reuse the selected LDAP authenticator's **Attribute mapping**:
|
|
60
|
+
|
|
61
|
+
| LDAP attribute or setting | NocoBase field or purpose |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| Login account attribute | Used as the source-unique user identifier and written to the username or email selected by the authenticator's **Use this field to bind the user** setting. This attribute is usually inferred from `{{account}}` in the authenticator's search filter, such as `uid`, `sAMAccountName`, or `mail`. A user without this attribute is skipped. |
|
|
64
|
+
| Attribute mapped to `username` | Username. |
|
|
65
|
+
| Attribute mapped to `nickname` | User nickname. |
|
|
66
|
+
| Attribute mapped to `email` | Email address. |
|
|
67
|
+
| Attribute mapped to `phone` | Phone number. |
|
|
68
|
+
| `distinguishedName`, falling back to the entry DN | Finds the nearest synchronized department in the DN path and sets it as the user's primary department. This applies only when department synchronization is enabled. |
|
|
69
|
+
|
|
70
|
+
For a multi-valued LDAP attribute, only the first value is currently synchronized. Other user attributes that are not included in the authenticator's attribute mapping are not synchronized.
|
|
71
|
+
|
|
72
|
+
### Department fields
|
|
73
|
+
|
|
74
|
+
| LDAP attribute or structure | NocoBase field or purpose |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `objectGUID` | Source-unique department identifier. An organizational unit without this attribute is skipped. |
|
|
77
|
+
| `ou`, `cn`, `name` | The first non-empty value in this order becomes the department name. An organizational unit without a name is skipped. |
|
|
78
|
+
| `distinguishedName`, falling back to the entry DN | Identifies the current department and its parent to build the department hierarchy. |
|
|
79
|
+
|
|
80
|
+
Department synchronization searches for `organizationalUnit` and `container` objects by default. It does not currently synchronize multiple user departments from attributes such as `memberOf`, or department owners.
|
|
81
|
+
|
|
82
|
+
## Troubleshooting
|
|
83
|
+
|
|
84
|
+
- If no users are returned, verify the authenticator's Search DN, search scope, Bind DN permissions, and the synchronization filter.
|
|
85
|
+
- If the result is truncated, configure a page size and verify the LDAP server's size limits.
|
|
86
|
+
- If departments are missing, verify that department synchronization is enabled and the Department search DN covers the required organizational units.
|
|
87
|
+
- Review the synchronization task details and application logs for LDAP connection, bind, and search errors.
|
|
@@ -44,6 +44,26 @@ If checked, subsequent nodes will still be executed even if the script encounter
|
|
|
44
44
|
If the script errors out, it will have no return value, and the node's result will be populated with the error message. If subsequent nodes use the result variable from the script node, it should be handled with caution.
|
|
45
45
|
:::
|
|
46
46
|
|
|
47
|
+
## Worker concurrency control
|
|
48
|
+
|
|
49
|
+
JavaScript script nodes place pending scripts in a task queue and execute them in separate Worker threads. By default, NocoBase does not limit JavaScript script Worker concurrency. If multiple tasks are waiting in the queue, they can create Workers and run concurrently.
|
|
50
|
+
|
|
51
|
+
If scripts consume a significant amount of memory while running, multiple Workers can quickly increase the memory usage of an application instance. In this case, use the `WORKFLOW_SCRIPT_WORKER_CONCURRENCY` environment variable to set a concurrency limit. The same applies to CPU-intensive scripts: excessive concurrency increases CPU contention and may affect other requests and workflows in NocoBase. You should also configure this variable if a large number of script tasks may be created within a short period:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
WORKFLOW_SCRIPT_WORKER_CONCURRENCY=4
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The configuration rules are as follows:
|
|
58
|
+
|
|
59
|
+
- If the variable is unset or its value is invalid, concurrency is unlimited
|
|
60
|
+
- A positive integer sets the maximum number of Worker threads that can run concurrently
|
|
61
|
+
- A value of `0` removes the concurrency limit, allowing all queued tasks to run concurrently
|
|
62
|
+
|
|
63
|
+
When the concurrency limit is reached, new tasks remain in the queue until a Worker becomes available. You can keep the default configuration if scripts run infrequently and each execution uses few resources. If you need a concurrency limit, start with a small value and adjust it gradually based on the application instance's memory and CPU usage and task queueing time.
|
|
64
|
+
|
|
65
|
+
If an application runs on multiple server instances, this setting applies separately to each instance. The overall concurrency capacity also depends on the number of instances that can consume tasks. Restart the NocoBase service after changing the environment variable for the new value to take effect.
|
|
66
|
+
|
|
47
67
|
## Execution Engine
|
|
48
68
|
|
|
49
69
|
The JavaScript script node supports two execution engines, automatically selected based on whether the `WORKFLOW_SCRIPT_MODULES` environment variable is configured:
|
|
@@ -164,4 +184,4 @@ async function sleep(time) {
|
|
|
164
184
|
await sleep(1000);
|
|
165
185
|
|
|
166
186
|
return 123;
|
|
167
|
-
```
|
|
187
|
+
```
|
|
@@ -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
|
+
declare const _default: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 executeFrontendTool_exports = {};
|
|
38
|
+
__export(executeFrontendTool_exports, {
|
|
39
|
+
default: () => executeFrontendTool_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(executeFrontendTool_exports);
|
|
42
|
+
var import_ai = require("@nocobase/ai");
|
|
43
|
+
var import_zod = require("zod");
|
|
44
|
+
var import_frontend_tools = require("../../common/frontend-tools");
|
|
45
|
+
var import_frontend_tools2 = require("../../server/frontend-tools");
|
|
46
|
+
var import_package = __toESM(require("../../../package.json"));
|
|
47
|
+
var executeFrontendTool_default = (0, import_ai.defineTools)({
|
|
48
|
+
scope: "GENERAL",
|
|
49
|
+
execution: "frontend",
|
|
50
|
+
defaultPermission: "ALLOW",
|
|
51
|
+
introduction: {
|
|
52
|
+
title: `{{t("Execute frontend tool", { ns: "${import_package.default.name}" })}}`,
|
|
53
|
+
about: `{{t("Execute a frontend tool provided by the selected block.", { ns: "${import_package.default.name}" })}}`
|
|
54
|
+
},
|
|
55
|
+
definition: {
|
|
56
|
+
name: import_frontend_tools.EXECUTE_FRONTEND_TOOL_NAME,
|
|
57
|
+
description: "Execute a frontend tool from the current frontendToolCatalog. Use loadFrontendTool first when you need its input schema. Never use a tool id that is not present in the current catalog.",
|
|
58
|
+
schema: import_zod.z.object({
|
|
59
|
+
toolId: import_zod.z.string().describe("The exact tool id from the current frontendToolCatalog."),
|
|
60
|
+
args: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).default({}).describe("Arguments that match the loaded frontend tool schema.")
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
invoke: async (ctx, args, runtime) => {
|
|
64
|
+
const tool = await (0, import_frontend_tools2.findCurrentFrontendTool)(ctx, args.toolId);
|
|
65
|
+
if (!tool) {
|
|
66
|
+
return {
|
|
67
|
+
status: "error",
|
|
68
|
+
content: "Frontend tool is unavailable in the current conversation."
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const result = await (0, import_frontend_tools2.readFrontendToolResult)(ctx, runtime.toolCallId);
|
|
72
|
+
if (!(result == null ? void 0 : result.provided)) {
|
|
73
|
+
return {
|
|
74
|
+
status: "error",
|
|
75
|
+
content: "Frontend tool did not return a result."
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if ((0, import_frontend_tools.isFrontendToolInvokeResult)(result.value)) {
|
|
79
|
+
return result.value;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
status: "success",
|
|
83
|
+
content: result.value
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -43,7 +43,7 @@ var import_ai = require("@nocobase/ai");
|
|
|
43
43
|
var import_zod = require("zod");
|
|
44
44
|
var import_package = __toESM(require("../../../package.json"));
|
|
45
45
|
var getSkill_default = (0, import_ai.defineTools)({
|
|
46
|
-
scope: "
|
|
46
|
+
scope: "SPECIFIED",
|
|
47
47
|
defaultPermission: "ALLOW",
|
|
48
48
|
introduction: {
|
|
49
49
|
title: `{{t("Load specific SKILLS", { ns: "${import_package.default.name}" })}}`,
|