@nocobase/plugin-ai 2.1.0-beta.15 → 2.1.0-beta.17
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/ai-employees/atlas/index.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.js → ai/ai-employees/atlas/index.js} +29 -20
- package/dist/ai/ai-employees/atlas/prompt.md +84 -0
- package/dist/ai/ai-employees/dara.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
- package/dist/ai/ai-employees/dex.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.js → ai/ai-employees/dex.js} +15 -7
- package/dist/ai/ai-employees/ellis.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/prompt.js → ai/ai-employees/ellis.js} +19 -11
- package/dist/ai/ai-employees/lexi.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/prompt.js → ai/ai-employees/lexi.js} +15 -7
- package/dist/ai/ai-employees/vera.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/research-analyst/prompt.js → ai/ai-employees/vera.js} +16 -8
- package/dist/ai/ai-employees/viz.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/insights-analyst/prompt.js → ai/ai-employees/viz.js} +15 -7
- package/dist/ai/skills/business-analysis-report/SKILLS.md +88 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.d.ts → ai/skills/business-analysis-report/tools/businessReportGenerator.d.ts} +1 -3
- package/dist/ai/skills/business-analysis-report/tools/businessReportGenerator.js +98 -0
- package/dist/ai/skills/document-search/SKILLS.md +69 -0
- package/dist/ai/tools/chartGenerator.js +15 -3
- package/dist/ai/tools/formFiller.js +13 -2
- package/dist/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/tools/getSkill.d.ts} +1 -3
- package/dist/{server/ai-employees/built-in/data-modeling/index.js → ai/tools/getSkill.js} +39 -32
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/tools/knowledge-base-retrieve.d.ts} +1 -3
- package/dist/ai/tools/knowledge-base-retrieve.js +94 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/tools/sub-agents/dispatch-sub-agent-task.d.ts} +1 -3
- package/dist/ai/tools/sub-agents/dispatch-sub-agent-task.js +108 -0
- package/dist/ai/tools/sub-agents/get-ai-employee.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/profile.js → ai/tools/sub-agents/get-ai-employee.js} +28 -21
- package/dist/ai/tools/sub-agents/list-ai-employees.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/profile.js → ai/tools/sub-agents/list-ai-employees.js} +25 -21
- package/dist/ai/tools/sub-agents/shared.d.ts +33 -0
- package/dist/ai/tools/sub-agents/shared.js +169 -0
- package/dist/ai/tools/suggestions.js +15 -4
- package/dist/client/170.d98eacdc00d9d527.js +10 -0
- package/dist/client/228.b18148eb1009d2fb.js +10 -0
- package/dist/client/280.029428b83d62155f.js +10 -0
- package/dist/client/290.0888139e33c9b7cb.js +10 -0
- package/dist/client/{524.954f96ec4fc2fd7a.js → 331.d547c95410476a69.js} +1 -1
- package/dist/client/343.83f7d96664e4e038.js +10 -0
- package/dist/client/406.15c09d98faa2ccf1.js +10 -0
- package/dist/client/428.e9f38da3b0d8b498.js +10 -0
- package/dist/client/486.afbed6b132b3c0dd.js +10 -0
- package/dist/client/502.2b4a51e0a8122e52.js +10 -0
- package/dist/client/525.33a9c8ec28be4ec4.js +10 -0
- package/dist/client/559.133d286a0a0a1d93.js +10 -0
- package/dist/client/{91.90e7098b7fbd5d00.js → 561.776886c5308e3c26.js} +1 -1
- package/dist/client/580.e75f97fb883ad042.js +10 -0
- package/dist/client/597.aa363881a325b5c0.js +10 -0
- package/dist/client/604.de96f3ec4d471afd.js +10 -0
- package/dist/client/614.aa766080f6b99aab.js +10 -0
- package/dist/client/646.51313bb0d85d6366.js +10 -0
- package/dist/client/687.224e569a99cae4bb.js +10 -0
- package/dist/client/699.57c0a1acb723202a.js +10 -0
- package/dist/client/711.266b8f1c520d467a.js +10 -0
- package/dist/client/758.a9741e81911e53c3.js +10 -0
- package/dist/client/768.973ce32e15099a48.js +10 -0
- package/dist/client/792.ae8ad1fcae9fd974.js +10 -0
- package/dist/client/820.6a26239ea96c075a.js +10 -0
- package/dist/client/832.0cf69e3f43c320b2.js +10 -0
- package/dist/client/927.ff5cd05b14901ae6.js +10 -0
- package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
- package/dist/client/ai-employees/admin/ToolsSettings.d.ts +17 -0
- package/dist/client/ai-employees/admin/mcp/MCPSettings.d.ts +10 -0
- package/dist/client/ai-employees/admin/mcp/MCPToolsList.d.ts +19 -0
- package/dist/client/ai-employees/admin/mcp/context.d.ts +15 -0
- package/dist/client/ai-employees/admin/mcp/schemas.d.ts +1286 -0
- package/dist/client/ai-employees/built-in/utils.d.ts +1 -0
- package/dist/client/ai-employees/business-report/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportCard.d.ts +12 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportModal.d.ts +17 -0
- package/dist/client/ai-employees/business-report/ui/report-utils.d.ts +38 -0
- package/dist/client/ai-employees/chatbox/AIEmployeeSwitch.d.ts +3 -2
- package/dist/client/ai-employees/chatbox/HintMessageHeader.d.ts +10 -0
- package/dist/client/ai-employees/chatbox/ModelSwitcher.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/SearchSwitch.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/Upload.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/conversations/ConversationsList.d.ts +27 -0
- package/dist/client/ai-employees/chatbox/conversations/WorkflowTasksList.d.ts +33 -0
- package/dist/client/ai-employees/chatbox/conversations/common.d.ts +43 -0
- package/dist/client/ai-employees/chatbox/conversations/index.d.ts +9 -0
- package/dist/client/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +5 -3
- package/dist/client/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +27 -0
- package/dist/client/ai-employees/chatbox/markdown/ECharts.d.ts +1 -2
- package/dist/client/ai-employees/chatbox/markdown/Markdown.d.ts +1 -1
- package/dist/client/ai-employees/chatbox/roles.d.ts +1 -0
- package/dist/client/ai-employees/chatbox/stores/chat-box.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +4 -0
- package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/workflow-tasks.d.ts +45 -0
- package/dist/client/ai-employees/chatbox/utils.d.ts +17 -7
- package/dist/client/ai-employees/sub-agents/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/sub-agents/ui/SubAgentDispatchCard.d.ts +21 -0
- package/dist/client/ai-employees/types.d.ts +24 -4
- package/dist/{server/ai-employees/built-in/ai-coding/document/example/js-filter → client/ai-employees/workflow-tasks/tools}/index.d.ts +2 -7
- package/dist/client/ai-employees/workflow-tasks/ui/WorkflowTaskOutputCard.d.ts +11 -0
- package/dist/client/components/ListCollapse.d.ts +28 -0
- package/dist/client/index.js +7 -7
- package/dist/client/manager/ai-manager.d.ts +4 -23
- package/dist/client/repositories/AIConfigRepository.d.ts +11 -3
- package/dist/client/workflow/nodes/employee/components/AIEmployeeSelect.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/assigness.d.ts +11 -0
- package/dist/client/workflow/nodes/employee/components/file-inputs.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/message-inputs.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/components/model-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/skill-settings.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/structured-output.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/users-select.d.ts +15 -0
- package/dist/client/workflow/nodes/employee/components/web-search-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/configuration.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/flow-models/feedback.d.ts +14 -0
- package/dist/client/workflow/nodes/employee/flow-models/task.d.ts +13 -0
- package/dist/client/workflow/nodes/employee/index.d.ts +7 -31
- package/dist/collections/ai-employees.js +2 -1
- package/dist/collections/ai-mcp-clients.d.ts +51 -0
- package/dist/collections/ai-mcp-clients.js +111 -0
- package/dist/externalVersion.js +17 -15
- package/dist/locale/en-US.json +141 -8
- package/dist/locale/zh-CN.json +142 -9
- package/dist/node_modules/fast-glob/out/index.js +8 -8
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/dist/flexsearch.bundle.min.js +2 -2
- package/dist/node_modules/flexsearch/package.json +1 -1
- package/dist/node_modules/fs-extra/lib/index.js +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/index.js +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +70 -0
- package/dist/server/ai-employees/ai-conversations.js +325 -0
- package/dist/server/ai-employees/ai-employee.d.ts +100 -19
- package/dist/server/ai-employees/ai-employee.js +484 -261
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +28 -0
- package/dist/server/ai-employees/ai-knowledge-base.js +167 -0
- package/dist/server/ai-employees/middleware/conversation.d.ts +2 -0
- package/dist/server/ai-employees/middleware/conversation.js +38 -5
- package/dist/server/ai-employees/middleware/index.d.ts +2 -0
- package/dist/server/ai-employees/middleware/index.js +5 -1
- package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
- package/dist/server/ai-employees/middleware/skill-tools.js +88 -0
- package/dist/server/ai-employees/middleware/tools.js +37 -10
- package/dist/server/ai-employees/middleware/workflow-history.d.ts +22 -0
- package/dist/server/ai-employees/middleware/workflow-history.js +173 -0
- package/dist/server/ai-employees/prompts.d.ts +16 -1
- package/dist/server/ai-employees/prompts.js +37 -1
- package/dist/server/ai-employees/sub-agents/dispatcher.d.ts +36 -0
- package/dist/server/ai-employees/sub-agents/dispatcher.js +225 -0
- package/dist/server/ai-employees/sub-agents/index.d.ts +9 -0
- package/dist/server/{migrations/20250923221107-setup-build-in.js → ai-employees/sub-agents/index.js} +9 -13
- package/dist/server/ai-employees/templates/form-assistant.d.ts +2 -2
- package/dist/server/ai-employees/templates/form-assistant.js +2 -2
- package/dist/server/ai-employees/utils.js +2 -2
- package/dist/server/collections/ai-conversations.js +18 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/nocobase-assistant/index.js → collections/ai-mcp-clients.js} +12 -13
- package/dist/server/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-skills.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/email-assistant/index.js → collections/ai-skills.js} +46 -23
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.d.ts → collections/ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/ai-workflow-tasks.js +112 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.d.ts → collections/users-ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/users-ai-workflow-tasks.js +44 -0
- package/dist/server/llm-providers/anthropic.d.ts +1 -0
- package/dist/server/llm-providers/anthropic.js +2 -1
- package/dist/server/llm-providers/dashscope.d.ts +1 -0
- package/dist/server/llm-providers/deepseek.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.js +2 -1
- package/dist/server/llm-providers/kimi/provider.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.js +2 -1
- package/dist/server/llm-providers/provider.d.ts +1 -10
- package/dist/server/llm-providers/provider.js +3 -34
- package/dist/server/manager/ai-coding-manager.d.ts +1 -2
- package/dist/server/manager/ai-coding-manager.js +0 -41
- package/dist/server/manager/ai-context-datasource-manager.js +30 -1
- package/dist/server/manager/built-in-manager.d.ts +2 -4
- package/dist/server/manager/built-in-manager.js +8 -117
- package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.d.ts +14 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.js +63 -0
- package/dist/server/plugin.d.ts +6 -1
- package/dist/server/plugin.js +31 -8
- package/dist/server/resource/aiConversations.js +112 -188
- package/dist/server/resource/aiEmployees.js +5 -7
- package/dist/server/resource/aiMcpClients.d.ts +11 -0
- package/dist/server/resource/aiMcpClients.js +78 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/index.d.ts → resource/aiSkills.d.ts} +3 -7
- package/dist/server/resource/aiSkills.js +71 -0
- package/dist/server/resource/aiTools.js +4 -6
- package/dist/server/resource/aiWorkflowTasks.d.ts +12 -0
- package/dist/server/resource/aiWorkflowTasks.js +290 -0
- package/dist/server/tools/docs.js +4 -3
- package/dist/server/tools/workflow-caller.js +1 -0
- package/dist/server/types/ai-chat-conversation.type.d.ts +8 -2
- package/dist/server/types/ai-message.type.d.ts +7 -0
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.js +28 -3
- package/dist/server/workflow/nodes/employee/files.d.ts +16 -0
- package/dist/server/workflow/nodes/employee/files.js +125 -0
- package/dist/server/workflow/nodes/employee/handler.d.ts +11 -0
- package/dist/server/workflow/nodes/employee/handler.js +107 -0
- package/dist/server/workflow/nodes/employee/index.d.ts +17 -0
- package/dist/server/workflow/nodes/employee/index.js +404 -0
- package/dist/server/workflow/nodes/employee/tools.d.ts +12 -0
- package/dist/server/workflow/nodes/employee/tools.js +133 -0
- package/dist/server/workflow/nodes/employee/types.d.ts +35 -0
- package/dist/server/workflow/nodes/employee/types.js +24 -0
- package/dist/server/workflow/utils.d.ts +14 -0
- package/dist/server/workflow/utils.js +111 -0
- package/package.json +4 -2
- package/dist/client/107.64d9efa24d6b9143.js +0 -10
- package/dist/client/124.768c8aa5d6e6b461.js +0 -10
- package/dist/client/159.d52107c7a34ce2da.js +0 -10
- package/dist/client/192.0419770b69678994.js +0 -10
- package/dist/client/204.91be8cfc54d91a59.js +0 -10
- package/dist/client/238.9f784a7cdb751999.js +0 -10
- package/dist/client/263.6e1dfb1cbb1964f5.js +0 -10
- package/dist/client/35.5ee7503d9c09daa8.js +0 -10
- package/dist/client/47.6bd245f2140efd24.js +0 -10
- package/dist/client/481.03b3d2306d409933.js +0 -10
- package/dist/client/586.6a1510cabaa84f23.js +0 -10
- package/dist/client/650.8871a07b31c307ea.js +0 -10
- package/dist/client/755.e295bbd2b2a1cc21.js +0 -10
- package/dist/client/772.d51f683c55e18dd4.js +0 -10
- package/dist/client/870.84187dcb8c89b4dc.js +0 -10
- package/dist/client/933.baab3aa75f30e020.js +0 -10
- package/dist/client/987.3aee964e7f406939.js +0 -10
- package/dist/server/ai-employees/built-in/ai-coding/document/basic/flow-resource.js +0 -256
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/index.js +0 -48
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.js +0 -452
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.js +0 -363
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.js +0 -270
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.js +0 -219
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.js +0 -409
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.js +0 -324
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.js +0 -309
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.js +0 -50
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.js +0 -345
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.js +0 -381
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.js +0 -545
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.js +0 -346
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.js +0 -102
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.js +0 -314
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.js +0 -113
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.js +0 -498
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.js +0 -184
- package/dist/server/ai-employees/built-in/ai-coding/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/ai-coding/index.js +0 -99
- package/dist/server/ai-employees/built-in/ai-coding/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/ai-coding/profile.js +0 -60
- package/dist/server/ai-employees/built-in/ai-coding/prompt_en.md +0 -110
- package/dist/server/ai-employees/built-in/data-modeling/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-modeling/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-modeling/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-modeling/prompt.js +0 -283
- package/dist/server/ai-employees/built-in/data-organizer/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-organizer/index.js +0 -63
- package/dist/server/ai-employees/built-in/data-organizer/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-organizer/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-visualization/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-visualization/index.js +0 -58
- package/dist/server/ai-employees/built-in/data-visualization/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-visualization/profile.js +0 -60
- package/dist/server/ai-employees/built-in/email-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/email-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/insights-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/insights-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/insights-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/insights-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/insights-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.js +0 -60
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.js +0 -52
- package/dist/server/ai-employees/built-in/research-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/research-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/research-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/research-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/research-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/translator/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/translator/index.js +0 -67
- package/dist/server/ai-employees/built-in/translator/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
- /package/dist/client/ai-employees/chatbox/{Conversations.d.ts → conversations/Conversations.d.ts} +0 -0
- /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
|
@@ -75,15 +75,20 @@ var aiConversations_default = {
|
|
|
75
75
|
if (!userId) {
|
|
76
76
|
return ctx.throw(403);
|
|
77
77
|
}
|
|
78
|
+
const filter = ctx.action.params.filter || {};
|
|
78
79
|
ctx.action.mergeParams({
|
|
79
80
|
filter: {
|
|
80
|
-
|
|
81
|
+
...filter,
|
|
82
|
+
userId,
|
|
83
|
+
from: filter.from ?? "main-agent",
|
|
84
|
+
category: "chat"
|
|
81
85
|
}
|
|
82
86
|
});
|
|
83
87
|
return import_actions.default.list(ctx, next);
|
|
84
88
|
},
|
|
85
89
|
async create(ctx, next) {
|
|
86
90
|
var _a;
|
|
91
|
+
const plugin = ctx.app.pm.get("ai");
|
|
87
92
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
88
93
|
if (!userId) {
|
|
89
94
|
return ctx.throw(403);
|
|
@@ -93,43 +98,39 @@ var aiConversations_default = {
|
|
|
93
98
|
if (!employee) {
|
|
94
99
|
ctx.throw(400, "AI employee not found");
|
|
95
100
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
values: {
|
|
101
|
+
try {
|
|
102
|
+
ctx.body = await plugin.aiConversationsManager.create({
|
|
99
103
|
userId,
|
|
100
104
|
aiEmployee,
|
|
101
105
|
options: {
|
|
102
106
|
systemMessage,
|
|
103
107
|
skillSettings,
|
|
104
108
|
conversationSettings
|
|
105
|
-
}
|
|
106
|
-
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (error.message === "AI employee not found") {
|
|
113
|
+
ctx.throw(400, error.message);
|
|
107
114
|
}
|
|
108
|
-
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
109
117
|
await next();
|
|
110
118
|
},
|
|
111
119
|
async update(ctx, next) {
|
|
112
120
|
var _a;
|
|
121
|
+
const plugin = ctx.app.pm.get("ai");
|
|
113
122
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
114
123
|
if (!userId) {
|
|
115
124
|
return ctx.throw(403);
|
|
116
125
|
}
|
|
117
126
|
const { filterByTk: sessionId } = ctx.action.params;
|
|
118
127
|
const { title } = ctx.action.params.values || {};
|
|
119
|
-
|
|
120
|
-
ctx.body = await repo.update({
|
|
121
|
-
filter: {
|
|
122
|
-
userId,
|
|
123
|
-
sessionId
|
|
124
|
-
},
|
|
125
|
-
values: {
|
|
126
|
-
title
|
|
127
|
-
}
|
|
128
|
-
});
|
|
128
|
+
ctx.body = await plugin.aiConversationsManager.update({ userId, sessionId, title });
|
|
129
129
|
await next();
|
|
130
130
|
},
|
|
131
131
|
async updateOptions(ctx, next) {
|
|
132
132
|
var _a;
|
|
133
|
+
const plugin = ctx.app.pm.get("ai");
|
|
133
134
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
134
135
|
if (!userId) {
|
|
135
136
|
return ctx.throw(403);
|
|
@@ -142,34 +143,18 @@ var aiConversations_default = {
|
|
|
142
143
|
if (!systemMessage && !skillSettings && !conversationSettings) {
|
|
143
144
|
return ctx.throw(400, "invalid options");
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
try {
|
|
147
|
+
ctx.body = await plugin.aiConversationsManager.update({
|
|
148
|
+
userId,
|
|
147
149
|
sessionId,
|
|
148
|
-
|
|
150
|
+
options: { systemMessage, skillSettings, conversationSettings }
|
|
151
|
+
});
|
|
152
|
+
} catch (error) {
|
|
153
|
+
if (error.message === "invalid sessionId") {
|
|
154
|
+
ctx.throw(400, error.message);
|
|
149
155
|
}
|
|
150
|
-
|
|
151
|
-
if (!conversation) {
|
|
152
|
-
ctx.throw(400, "invalid sessionId");
|
|
153
|
-
}
|
|
154
|
-
const options = conversation.options ?? {};
|
|
155
|
-
if (systemMessage) {
|
|
156
|
-
options["systemMessage"] = systemMessage;
|
|
156
|
+
throw error;
|
|
157
157
|
}
|
|
158
|
-
if (skillSettings) {
|
|
159
|
-
options["skillSettings"] = skillSettings;
|
|
160
|
-
}
|
|
161
|
-
if (conversationSettings) {
|
|
162
|
-
options["conversationSettings"] = conversationSettings;
|
|
163
|
-
}
|
|
164
|
-
ctx.body = await ctx.db.getRepository("aiConversations").update({
|
|
165
|
-
filter: {
|
|
166
|
-
userId,
|
|
167
|
-
sessionId
|
|
168
|
-
},
|
|
169
|
-
values: {
|
|
170
|
-
options
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
158
|
await next();
|
|
174
159
|
},
|
|
175
160
|
async destroy(ctx, next) {
|
|
@@ -197,92 +182,24 @@ var aiConversations_default = {
|
|
|
197
182
|
ctx.throw(400);
|
|
198
183
|
}
|
|
199
184
|
const paginate = ((_b = ctx.action.params) == null ? void 0 : _b.paginate) === "false" ? false : true;
|
|
200
|
-
|
|
201
|
-
|
|
185
|
+
try {
|
|
186
|
+
ctx.body = await plugin.aiConversationsManager.getMessages({
|
|
187
|
+
userId,
|
|
202
188
|
sessionId,
|
|
203
|
-
|
|
189
|
+
cursor,
|
|
190
|
+
paginate
|
|
191
|
+
});
|
|
192
|
+
} catch (error) {
|
|
193
|
+
if (error.message === "invalid sessionId") {
|
|
194
|
+
ctx.throw(400);
|
|
204
195
|
}
|
|
205
|
-
|
|
206
|
-
if (!conversation) {
|
|
207
|
-
ctx.throw(400);
|
|
196
|
+
throw error;
|
|
208
197
|
}
|
|
209
|
-
const pageSize = 10;
|
|
210
|
-
const maxLimit = 200;
|
|
211
|
-
const messageRepository = ctx.db.getRepository("aiConversations.messages", sessionId);
|
|
212
|
-
const filter = {
|
|
213
|
-
role: {
|
|
214
|
-
$notIn: ["tool"]
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
if (paginate && cursor) {
|
|
218
|
-
filter["messageId"] = {
|
|
219
|
-
$lt: cursor
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
const rows = await messageRepository.find({
|
|
223
|
-
sort: ["-messageId"],
|
|
224
|
-
limit: paginate ? pageSize + 1 : maxLimit,
|
|
225
|
-
filter
|
|
226
|
-
});
|
|
227
|
-
const hasMore = paginate && rows.length > pageSize;
|
|
228
|
-
const data = hasMore ? rows.slice(0, -1) : rows;
|
|
229
|
-
const newCursor = data.length ? data[data.length - 1].messageId : null;
|
|
230
|
-
const toolCallIds = data.filter((row) => {
|
|
231
|
-
var _a2;
|
|
232
|
-
return ((_a2 = row == null ? void 0 : row.toolCalls) == null ? void 0 : _a2.length) ?? 0 > 0;
|
|
233
|
-
}).flatMap((row) => row.toolCalls).map((toolCall) => toolCall.id);
|
|
234
|
-
const toolMessages = await ctx.db.getRepository("aiToolMessages").find({
|
|
235
|
-
filter: {
|
|
236
|
-
sessionId,
|
|
237
|
-
toolCallId: {
|
|
238
|
-
$in: toolCallIds
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
const toolMessageKey = (messageId, toolCallId) => `${messageId}:${toolCallId}`;
|
|
243
|
-
const toolMessageMap = new Map(
|
|
244
|
-
toolMessages.map((toolMessage) => [
|
|
245
|
-
toolMessageKey(toolMessage.messageId, toolMessage.toolCallId),
|
|
246
|
-
toolMessage
|
|
247
|
-
])
|
|
248
|
-
);
|
|
249
|
-
const toolsList = await plugin.ai.toolsManager.listTools();
|
|
250
|
-
const toolsMap = new Map(toolsList.map((t) => [t.definition.name, t]));
|
|
251
|
-
ctx.body = {
|
|
252
|
-
rows: data.map((row) => {
|
|
253
|
-
var _a2, _b2;
|
|
254
|
-
if (((_a2 = row == null ? void 0 : row.toolCalls) == null ? void 0 : _a2.length) ?? 0 > 0) {
|
|
255
|
-
for (const toolCall of row.toolCalls) {
|
|
256
|
-
const tools = toolsMap.get(toolCall.name);
|
|
257
|
-
const toolMessage = toolMessageMap.get(toolMessageKey(row.messageId, toolCall.id));
|
|
258
|
-
toolCall.invokeStatus = toolMessage == null ? void 0 : toolMessage.invokeStatus;
|
|
259
|
-
toolCall.auto = toolMessage == null ? void 0 : toolMessage.auto;
|
|
260
|
-
toolCall.status = toolMessage == null ? void 0 : toolMessage.status;
|
|
261
|
-
toolCall.content = toolMessage == null ? void 0 : toolMessage.content;
|
|
262
|
-
toolCall.execution = tools == null ? void 0 : tools.execution;
|
|
263
|
-
toolCall.willInterrupt = (tools == null ? void 0 : tools.execution) === "frontend" || (toolMessage == null ? void 0 : toolMessage.auto) === false;
|
|
264
|
-
toolCall.defaultPermission = tools == null ? void 0 : tools.defaultPermission;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
const providerOptions = plugin.aiManager.llmProviders.get((_b2 = row.metadata) == null ? void 0 : _b2.provider);
|
|
268
|
-
if (!providerOptions) {
|
|
269
|
-
return (0, import_utils.parseResponseMessage)(row);
|
|
270
|
-
}
|
|
271
|
-
const Provider = providerOptions.provider;
|
|
272
|
-
const provider = new Provider({
|
|
273
|
-
app: ctx.app
|
|
274
|
-
});
|
|
275
|
-
return provider.parseResponseMessage(row);
|
|
276
|
-
}),
|
|
277
|
-
...paginate && {
|
|
278
|
-
hasMore,
|
|
279
|
-
cursor: newCursor
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
198
|
await next();
|
|
283
199
|
},
|
|
284
200
|
async updateToolArgs(ctx, next) {
|
|
285
201
|
var _a;
|
|
202
|
+
const plugin = ctx.app.pm.get("ai");
|
|
286
203
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
287
204
|
if (!userId) {
|
|
288
205
|
return ctx.throw(403);
|
|
@@ -295,11 +212,9 @@ var aiConversations_default = {
|
|
|
295
212
|
if (!sessionId) {
|
|
296
213
|
ctx.throw(400);
|
|
297
214
|
}
|
|
298
|
-
const conversation = await
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
userId
|
|
302
|
-
}
|
|
215
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
216
|
+
sessionId,
|
|
217
|
+
userId
|
|
303
218
|
});
|
|
304
219
|
if (!conversation) {
|
|
305
220
|
ctx.throw(400);
|
|
@@ -326,11 +241,12 @@ var aiConversations_default = {
|
|
|
326
241
|
await next();
|
|
327
242
|
},
|
|
328
243
|
async sendMessages(ctx, next) {
|
|
329
|
-
var _a, _b, _c;
|
|
244
|
+
var _a, _b, _c, _d;
|
|
330
245
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
331
246
|
if (!userId) {
|
|
332
247
|
return ctx.throw(403);
|
|
333
248
|
}
|
|
249
|
+
const plugin = ctx.app.pm.get("ai");
|
|
334
250
|
const {
|
|
335
251
|
sessionId,
|
|
336
252
|
aiEmployee: employeeName,
|
|
@@ -364,11 +280,9 @@ var aiConversations_default = {
|
|
|
364
280
|
return next();
|
|
365
281
|
}
|
|
366
282
|
try {
|
|
367
|
-
const conversation = await
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
userId
|
|
371
|
-
}
|
|
283
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
284
|
+
sessionId,
|
|
285
|
+
userId
|
|
372
286
|
});
|
|
373
287
|
if (!conversation) {
|
|
374
288
|
if (shouldStream) {
|
|
@@ -403,29 +317,42 @@ var aiConversations_default = {
|
|
|
403
317
|
return next();
|
|
404
318
|
}
|
|
405
319
|
const legacy = conversation.thread === 0;
|
|
406
|
-
const aiEmployee = new import_ai_employee.AIEmployee(
|
|
320
|
+
const aiEmployee = new import_ai_employee.AIEmployee({
|
|
407
321
|
ctx,
|
|
408
322
|
employee,
|
|
409
323
|
sessionId,
|
|
410
|
-
(_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
411
|
-
(_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
324
|
+
systemMessage: (_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
325
|
+
skillSettings: (_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
326
|
+
tools: (_d = conversation.options) == null ? void 0 : _d.tools,
|
|
412
327
|
webSearch,
|
|
413
328
|
model,
|
|
414
329
|
legacy
|
|
415
|
-
);
|
|
330
|
+
});
|
|
416
331
|
if (!editingMessageId) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
332
|
+
if (await plugin.subAgentsDispatcher.isInterrupted(ctx)) {
|
|
333
|
+
const userDecisions = await plugin.subAgentsDispatcher.reject(ctx);
|
|
334
|
+
if (userDecisions) {
|
|
335
|
+
if (shouldStream) {
|
|
336
|
+
await aiEmployee.stream({ userDecisions });
|
|
337
|
+
} else {
|
|
338
|
+
ctx.body = await aiEmployee.invoke({ userDecisions });
|
|
339
|
+
}
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
const toolMessages = await aiEmployee.cancelToolCall();
|
|
344
|
+
if (toolMessages == null ? void 0 : toolMessages.length) {
|
|
345
|
+
for (let i = toolMessages.length - 1; i >= 0; i--) {
|
|
346
|
+
const toolMessage = toolMessages[i];
|
|
347
|
+
messages.unshift({
|
|
348
|
+
role: toolMessage.role,
|
|
349
|
+
content: toolMessage.content,
|
|
350
|
+
toolCalls: toolMessage.toolCalls,
|
|
351
|
+
attachments: toolMessage.attachments,
|
|
352
|
+
workContext: toolMessage.workContext,
|
|
353
|
+
metadata: toolMessage.metadata
|
|
354
|
+
});
|
|
355
|
+
}
|
|
429
356
|
}
|
|
430
357
|
}
|
|
431
358
|
}
|
|
@@ -442,8 +369,9 @@ var aiConversations_default = {
|
|
|
442
369
|
ctx.status = 500;
|
|
443
370
|
ctx.body = { error: err.message || "Tool call error" };
|
|
444
371
|
}
|
|
372
|
+
} finally {
|
|
373
|
+
await next();
|
|
445
374
|
}
|
|
446
|
-
await next();
|
|
447
375
|
},
|
|
448
376
|
async abort(ctx, next) {
|
|
449
377
|
var _a;
|
|
@@ -453,11 +381,9 @@ var aiConversations_default = {
|
|
|
453
381
|
}
|
|
454
382
|
const { sessionId } = ctx.action.params.values || {};
|
|
455
383
|
const plugin = ctx.app.pm.get("ai");
|
|
456
|
-
const conversation = await
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
userId
|
|
460
|
-
}
|
|
384
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
385
|
+
sessionId,
|
|
386
|
+
userId
|
|
461
387
|
});
|
|
462
388
|
if (!conversation) {
|
|
463
389
|
ctx.throw(404, "conversation not found");
|
|
@@ -466,7 +392,8 @@ var aiConversations_default = {
|
|
|
466
392
|
await next();
|
|
467
393
|
},
|
|
468
394
|
async resendMessages(ctx, next) {
|
|
469
|
-
var _a, _b, _c;
|
|
395
|
+
var _a, _b, _c, _d;
|
|
396
|
+
const plugin = ctx.app.pm.get("ai");
|
|
470
397
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
471
398
|
if (!userId) {
|
|
472
399
|
return ctx.throw(403);
|
|
@@ -479,11 +406,9 @@ var aiConversations_default = {
|
|
|
479
406
|
return next();
|
|
480
407
|
}
|
|
481
408
|
try {
|
|
482
|
-
const conversation = await
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
userId
|
|
486
|
-
}
|
|
409
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
410
|
+
sessionId,
|
|
411
|
+
userId
|
|
487
412
|
});
|
|
488
413
|
if (!conversation) {
|
|
489
414
|
sendErrorResponse(ctx, "conversation not found");
|
|
@@ -528,15 +453,16 @@ var aiConversations_default = {
|
|
|
528
453
|
sendErrorResponse(ctx, "AI employee not found");
|
|
529
454
|
return next();
|
|
530
455
|
}
|
|
531
|
-
const aiEmployee = new import_ai_employee.AIEmployee(
|
|
456
|
+
const aiEmployee = new import_ai_employee.AIEmployee({
|
|
532
457
|
ctx,
|
|
533
458
|
employee,
|
|
534
459
|
sessionId,
|
|
535
|
-
(_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
536
|
-
(_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
460
|
+
systemMessage: (_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
461
|
+
skillSettings: (_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
462
|
+
tools: (_d = conversation.options) == null ? void 0 : _d.tools,
|
|
537
463
|
webSearch,
|
|
538
464
|
model
|
|
539
|
-
);
|
|
465
|
+
});
|
|
540
466
|
await aiEmployee.stream({ messageId, userMessages: resendMessages.length ? resendMessages : void 0 });
|
|
541
467
|
} catch (err) {
|
|
542
468
|
ctx.log.error(err);
|
|
@@ -555,16 +481,14 @@ var aiConversations_default = {
|
|
|
555
481
|
if (!sessionId) {
|
|
556
482
|
ctx.throw(400);
|
|
557
483
|
}
|
|
558
|
-
const conversation = await
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
userId
|
|
562
|
-
}
|
|
484
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
485
|
+
sessionId,
|
|
486
|
+
userId
|
|
563
487
|
});
|
|
564
488
|
if (!conversation) {
|
|
565
489
|
ctx.throw(400);
|
|
566
490
|
}
|
|
567
|
-
const message = await ctx.db.getRepository("
|
|
491
|
+
const message = await ctx.db.getRepository("aiMessages").findOne({
|
|
568
492
|
filter: {
|
|
569
493
|
messageId
|
|
570
494
|
}
|
|
@@ -578,7 +502,7 @@ var aiConversations_default = {
|
|
|
578
502
|
}
|
|
579
503
|
const aiToolMessagesModel = ctx.db.getModel("aiToolMessages");
|
|
580
504
|
const toolCall = await aiToolMessagesModel.findOne({
|
|
581
|
-
where: { sessionId, messageId, toolCallId }
|
|
505
|
+
where: { sessionId: message.sessionId, messageId: message.messageId, toolCallId }
|
|
582
506
|
});
|
|
583
507
|
if (!toolCall) {
|
|
584
508
|
ctx.throw(400);
|
|
@@ -590,8 +514,8 @@ var aiConversations_default = {
|
|
|
590
514
|
},
|
|
591
515
|
{
|
|
592
516
|
where: {
|
|
593
|
-
sessionId,
|
|
594
|
-
messageId,
|
|
517
|
+
sessionId: message.sessionId,
|
|
518
|
+
messageId: message.messageId,
|
|
595
519
|
toolCallId,
|
|
596
520
|
invokeStatus: "interrupted"
|
|
597
521
|
}
|
|
@@ -600,8 +524,8 @@ var aiConversations_default = {
|
|
|
600
524
|
const toolCallIds = toolCalls.map((x) => x.id);
|
|
601
525
|
const toolMessages = await ctx.db.getRepository("aiToolMessages").find({
|
|
602
526
|
filter: {
|
|
603
|
-
sessionId,
|
|
604
|
-
messageId,
|
|
527
|
+
sessionId: message.sessionId,
|
|
528
|
+
messageId: message.messageId,
|
|
605
529
|
toolCallId: {
|
|
606
530
|
$in: toolCallIds
|
|
607
531
|
}
|
|
@@ -610,7 +534,7 @@ var aiConversations_default = {
|
|
|
610
534
|
const toolMessageMap = new Map(
|
|
611
535
|
toolMessages.map((toolMessage) => [toolMessage.toolCallId, toolMessage])
|
|
612
536
|
);
|
|
613
|
-
const toolsList = await plugin.ai.toolsManager.listTools();
|
|
537
|
+
const toolsList = await plugin.ai.toolsManager.listTools({ sessionId: message.sessionId });
|
|
614
538
|
const toolsMap = new Map(toolsList.map((t) => [t.definition.name, t]));
|
|
615
539
|
for (const toolCall2 of toolCalls) {
|
|
616
540
|
const tools = toolsMap.get(toolCall2.name);
|
|
@@ -630,23 +554,22 @@ var aiConversations_default = {
|
|
|
630
554
|
await next();
|
|
631
555
|
},
|
|
632
556
|
async resumeToolCall(ctx, next) {
|
|
633
|
-
var _a, _b, _c;
|
|
557
|
+
var _a, _b, _c, _d;
|
|
634
558
|
const userId = (_a = ctx.auth) == null ? void 0 : _a.user.id;
|
|
635
559
|
if (!userId) {
|
|
636
560
|
return ctx.throw(403);
|
|
637
561
|
}
|
|
638
562
|
setupSSEHeaders(ctx);
|
|
563
|
+
const plugin = ctx.app.pm.get("ai");
|
|
639
564
|
const { sessionId, messageId, model, webSearch } = ctx.action.params.values || {};
|
|
640
565
|
if (!sessionId) {
|
|
641
566
|
sendErrorResponse(ctx, "sessionId is required");
|
|
642
567
|
return next();
|
|
643
568
|
}
|
|
644
569
|
try {
|
|
645
|
-
const conversation = await
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
userId
|
|
649
|
-
}
|
|
570
|
+
const conversation = await plugin.aiConversationsManager.getConversation({
|
|
571
|
+
sessionId,
|
|
572
|
+
userId
|
|
650
573
|
});
|
|
651
574
|
if (!conversation) {
|
|
652
575
|
sendErrorResponse(ctx, "conversation not found");
|
|
@@ -659,7 +582,7 @@ var aiConversations_default = {
|
|
|
659
582
|
}
|
|
660
583
|
let message;
|
|
661
584
|
if (messageId) {
|
|
662
|
-
message = await ctx.db.getRepository("
|
|
585
|
+
message = await ctx.db.getRepository("aiMessages").findOne({
|
|
663
586
|
filter: {
|
|
664
587
|
messageId
|
|
665
588
|
}
|
|
@@ -678,16 +601,17 @@ var aiConversations_default = {
|
|
|
678
601
|
sendErrorResponse(ctx, "No tool calls found");
|
|
679
602
|
return next();
|
|
680
603
|
}
|
|
681
|
-
const aiEmployee = new import_ai_employee.AIEmployee(
|
|
604
|
+
const aiEmployee = new import_ai_employee.AIEmployee({
|
|
682
605
|
ctx,
|
|
683
606
|
employee,
|
|
684
607
|
sessionId,
|
|
685
|
-
(_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
686
|
-
(_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
608
|
+
systemMessage: (_b = conversation.options) == null ? void 0 : _b.systemMessage,
|
|
609
|
+
skillSettings: (_c = conversation.options) == null ? void 0 : _c.skillSettings,
|
|
610
|
+
tools: (_d = conversation.options) == null ? void 0 : _d.tools,
|
|
687
611
|
webSearch,
|
|
688
612
|
model
|
|
689
|
-
);
|
|
690
|
-
const userDecisions = await
|
|
613
|
+
});
|
|
614
|
+
const userDecisions = await plugin.aiConversationsManager.getUserDecisions(messageId);
|
|
691
615
|
await aiEmployee.stream({
|
|
692
616
|
userDecisions
|
|
693
617
|
});
|
|
@@ -50,14 +50,13 @@ const list = async (ctx, next) => {
|
|
|
50
50
|
const builtInManager = plugin.builtInManager;
|
|
51
51
|
await import_actions.default.list(ctx, () => {
|
|
52
52
|
});
|
|
53
|
-
const locale = ctx.getCurrentLocale();
|
|
54
53
|
let data = ctx.body.rows;
|
|
55
54
|
if (paginate === "false" || paginate === false) {
|
|
56
55
|
data = ctx.body;
|
|
57
56
|
}
|
|
58
57
|
data.forEach((row) => {
|
|
59
58
|
if (row.builtIn) {
|
|
60
|
-
builtInManager.setupBuiltInInfo(
|
|
59
|
+
builtInManager.setupBuiltInInfo(ctx, row);
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
62
|
await next();
|
|
@@ -108,19 +107,18 @@ const listByUser = async (ctx, next) => {
|
|
|
108
107
|
[sequelize.fn("COALESCE", sequelize.col("userConfigs.sort"), sequelize.col("aiEmployees.sort")), "ASC"]
|
|
109
108
|
]
|
|
110
109
|
});
|
|
111
|
-
const locale = ctx.getCurrentLocale();
|
|
112
110
|
rows.forEach((row) => {
|
|
113
111
|
if (row.builtIn) {
|
|
114
|
-
builtInManager.setupBuiltInInfo(
|
|
112
|
+
builtInManager.setupBuiltInInfo(ctx, row);
|
|
115
113
|
}
|
|
116
114
|
});
|
|
117
115
|
ctx.body = rows.map((row) => {
|
|
118
116
|
var _a, _b;
|
|
119
|
-
const skillSettings = row.skillSettings ?? {
|
|
117
|
+
const skillSettings = row.skillSettings ?? { tools: [] };
|
|
120
118
|
for (const tool of tools) {
|
|
121
|
-
skillSettings.
|
|
119
|
+
skillSettings.tools.push({
|
|
122
120
|
name: tool.definition.name,
|
|
123
|
-
|
|
121
|
+
autoCall: tool.defaultPermission === "ALLOW"
|
|
124
122
|
});
|
|
125
123
|
}
|
|
126
124
|
return {
|
|
@@ -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 { ResourceOptions } from '@nocobase/resourcer';
|
|
10
|
+
export declare const aiMcpClients: ResourceOptions;
|
|
11
|
+
export default aiMcpClients;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var aiMcpClients_exports = {};
|
|
28
|
+
__export(aiMcpClients_exports, {
|
|
29
|
+
aiMcpClients: () => aiMcpClients,
|
|
30
|
+
default: () => aiMcpClients_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(aiMcpClients_exports);
|
|
33
|
+
const aiMcpClients = {
|
|
34
|
+
name: "aiMcpClients",
|
|
35
|
+
actions: {
|
|
36
|
+
testConnection: async (ctx, next) => {
|
|
37
|
+
const values = ctx.action.params.values;
|
|
38
|
+
if (!values) {
|
|
39
|
+
ctx.body = {
|
|
40
|
+
success: false,
|
|
41
|
+
error: "No configuration provided"
|
|
42
|
+
};
|
|
43
|
+
await next();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const plugin = ctx.app.pm.get("ai");
|
|
47
|
+
const result = await plugin.ai.mcpManager.testConnection(values);
|
|
48
|
+
ctx.body = result;
|
|
49
|
+
await next();
|
|
50
|
+
},
|
|
51
|
+
rebuildClient: async (ctx, next) => {
|
|
52
|
+
const plugin = ctx.app.pm.get("ai");
|
|
53
|
+
await plugin.ai.mcpManager.rebuildClient();
|
|
54
|
+
ctx.body = { success: true };
|
|
55
|
+
await next();
|
|
56
|
+
},
|
|
57
|
+
listTools: async (ctx, next) => {
|
|
58
|
+
const plugin = ctx.app.pm.get("ai");
|
|
59
|
+
ctx.body = await plugin.ai.mcpManager.listMCPTools();
|
|
60
|
+
await next();
|
|
61
|
+
},
|
|
62
|
+
updateToolPermission: async (ctx, next) => {
|
|
63
|
+
const { toolName, permission } = ctx.action.params.values || {};
|
|
64
|
+
if (!toolName || !permission) {
|
|
65
|
+
ctx.throw(400, "toolName and permission are required");
|
|
66
|
+
}
|
|
67
|
+
const plugin = ctx.app.pm.get("ai");
|
|
68
|
+
await plugin.ai.mcpManager.updateMCPToolPermission(toolName, permission);
|
|
69
|
+
ctx.body = { success: true };
|
|
70
|
+
await next();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var aiMcpClients_default = aiMcpClients;
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
aiMcpClients
|
|
78
|
+
});
|
|
@@ -6,10 +6,6 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
content: string;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
export default _default;
|
|
9
|
+
import { ResourceOptions } from '@nocobase/resourcer';
|
|
10
|
+
export declare const aiSkills: ResourceOptions;
|
|
11
|
+
export default aiSkills;
|