@nocobase/plugin-ai 2.3.0-alpha.1 → 3.0.0-alpha.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-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/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 +3 -1
- package/dist/ai/docs/nocobase/api/cli/index.md +14 -2
- package/dist/ai/docs/nocobase/api/cli/portal/config.md +44 -0
- package/dist/ai/docs/nocobase/api/cli/portal/create.md +48 -0
- package/dist/ai/docs/nocobase/api/cli/portal/deploy.md +39 -0
- package/dist/ai/docs/nocobase/api/cli/portal/destroy.md +41 -0
- package/dist/ai/docs/nocobase/api/cli/portal/dev.md +39 -0
- package/dist/ai/docs/nocobase/api/cli/portal/index.md +136 -0
- package/dist/ai/docs/nocobase/api/cli/portal/info.md +41 -0
- package/dist/ai/docs/nocobase/api/cli/portal/list.md +40 -0
- package/dist/ai/docs/nocobase/api/cli/portal/pull.md +43 -0
- package/dist/ai/docs/nocobase/api/cli/portal/push.md +41 -0
- 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/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 +2 -2
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
- package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
- 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/loadFrontendTool.d.ts +10 -0
- package/dist/ai/tools/loadFrontendTool.js +99 -0
- package/dist/client/244.8631eb5cf3f05e21.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.19b642db34de438a.js} +1 -1
- package/dist/client/index.d.ts +1 -3
- package/dist/client/index.js +8 -8
- package/dist/client-v2/244.c428e645ecb94414.js +10 -0
- package/dist/client-v2/420.b2aedb1ff71fca0e.js +10 -0
- package/dist/client-v2/681.6890caa389564ff7.js +10 -0
- package/dist/client-v2/705.8dc34d43f02f322c.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/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 -31
- 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/block/ai-chat-box/components/AIChatBoxCoreView.d.ts +10 -0
- 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-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 +5 -0
- package/dist/client-v2/pages/EmployeesPage.d.ts +2 -0
- package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +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 +16 -16
- package/dist/locale/en-US.json +67 -0
- package/dist/locale/zh-CN.json +67 -0
- 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 +2 -1
- package/dist/server/ai-employees/ai-employee.js +26 -7
- package/dist/server/ai-employees/middleware/conversation.js +9 -2
- package/dist/server/collections/ai-conversations.js +5 -0
- package/dist/server/document-loader/constants.js +1 -1
- package/dist/server/frontend-tools.d.ts +25 -0
- package/dist/server/frontend-tools.js +171 -0
- package/dist/server/manager/work-context-handler.js +10 -3
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +25 -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 +62 -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/knowledge-base.type.d.ts +6 -2
- 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 +1588 -0
- package/dist/swagger/index.js +62 -0
- package/dist/swagger/llm.d.ts +555 -0
- package/dist/swagger/llm.js +247 -0
- package/dist/swagger/schemas.d.ts +736 -0
- package/dist/swagger/schemas.js +381 -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
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { AIEmployee, Attachment, ContextItem, ResendOptions, SendOptions } from '../../types';
|
|
10
|
-
|
|
10
|
+
import { type ChatBoxRuntime } from '../stores/runtime';
|
|
11
|
+
export declare const useChatMessageActions: (runtime?: ChatBoxRuntime) => {
|
|
11
12
|
syncContextAttachments: (items: ContextItem | ContextItem[]) => Attachment[];
|
|
12
13
|
loadMessages: (sessionId?: string, cursor?: string) => Promise<void>;
|
|
13
14
|
loadMoreMessages: () => Promise<void>;
|
|
14
|
-
sendMessages: ({ sessionId, aiEmployee, systemMessage, messages: sendMsgs, attachments, workContext, editingMessageId, onConversationCreate, skillSettings, webSearch, model: inputModel, }: SendOptions & {
|
|
15
|
+
sendMessages: ({ sessionId, aiEmployee, systemMessage, messages: sendMsgs, attachments, workContext, editingMessageId, onConversationCreate, skillSettings, webSearch, scope, model: inputModel, onResponseLoadingChange, }: SendOptions & {
|
|
16
|
+
scope?: string;
|
|
15
17
|
onConversationCreate?: (sessionId: string) => void;
|
|
16
18
|
}) => Promise<void>;
|
|
17
19
|
resendMessages: ({ sessionId, messageId, aiEmployee, important }: ResendOptions) => Promise<void>;
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { DecisionActions, ToolCall } from '@nocobase/client-v2';
|
|
10
|
-
|
|
10
|
+
import { type ChatBoxRuntime } from '../stores/runtime';
|
|
11
|
+
export declare const useToolCallActions: ({ messageId, runtime }: {
|
|
11
12
|
messageId: string;
|
|
13
|
+
runtime?: ChatBoxRuntime;
|
|
12
14
|
}) => {
|
|
13
15
|
getDecisionActions: (toolCall: ToolCall) => DecisionActions;
|
|
14
16
|
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import type { Attachment } from '../../types';
|
|
10
|
+
import { type ChatBoxRuntime } from '../stores/runtime';
|
|
10
11
|
type StorageBasicInfo = {
|
|
11
12
|
rules?: Record<string, unknown>;
|
|
12
13
|
[key: string]: unknown;
|
|
@@ -18,6 +19,9 @@ type UploadRequestOptions = {
|
|
|
18
19
|
filename: string;
|
|
19
20
|
headers?: Record<string, string>;
|
|
20
21
|
onError: (error: Error) => void;
|
|
22
|
+
onProgress?: (event: {
|
|
23
|
+
percent: number;
|
|
24
|
+
}) => void;
|
|
21
25
|
onSuccess: (body: unknown, file: Blob) => void;
|
|
22
26
|
withCredentials?: boolean;
|
|
23
27
|
};
|
|
@@ -35,12 +39,18 @@ export declare function useStorageUploadProps(props: Record<string, unknown>, st
|
|
|
35
39
|
rules: Record<string, unknown>;
|
|
36
40
|
};
|
|
37
41
|
export declare function useUploadProps(props: Record<string, unknown>): {
|
|
38
|
-
customRequest({ action, data, file, filename, headers, onError, onSuccess, withCredentials, }: UploadRequestOptions):
|
|
42
|
+
customRequest({ action, data, file, filename, headers, onError, onProgress, onSuccess, withCredentials, }: UploadRequestOptions): {
|
|
43
|
+
abort(): void;
|
|
44
|
+
};
|
|
39
45
|
};
|
|
40
|
-
export declare const useUploadFiles: () => {
|
|
46
|
+
export declare const useUploadFiles: (runtime?: ChatBoxRuntime) => {
|
|
47
|
+
beforeUpload: (file: import("antd/es/upload").RcFile, fileList: import("antd/es/upload").RcFile[]) => (string | boolean | void | File | Blob) | Promise<string | boolean | void | File | Blob>;
|
|
48
|
+
validateFiles: (files: unknown[], showMessage?: boolean) => boolean;
|
|
41
49
|
rules: Record<string, unknown>;
|
|
42
50
|
action: string;
|
|
43
51
|
onChange({ fileList }: UploadChangeInfo): void;
|
|
44
|
-
customRequest({ action, data, file, filename, headers, onError, onSuccess, withCredentials, }: UploadRequestOptions):
|
|
52
|
+
customRequest({ action, data, file, filename, headers, onError, onProgress, onSuccess, withCredentials, }: UploadRequestOptions): {
|
|
53
|
+
abort(): void;
|
|
54
|
+
};
|
|
45
55
|
};
|
|
46
56
|
export {};
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { WorkflowTask, WorkflowTaskDetail } from '../stores/workflow-tasks';
|
|
10
|
-
|
|
10
|
+
import { type ChatBoxRuntime } from '../stores/runtime';
|
|
11
|
+
export declare const useWorkflowTasks: (runtime?: ChatBoxRuntime) => {
|
|
11
12
|
loading: boolean;
|
|
12
13
|
workflowTasks: WorkflowTask[];
|
|
13
14
|
unreadCount: number;
|
|
@@ -22,6 +23,6 @@ export declare const useWorkflowTasks: () => {
|
|
|
22
23
|
getWorkflowTaskBySession: (sessionId: string) => Promise<WorkflowTaskDetail>;
|
|
23
24
|
updateReadonly: (sessionId: string) => Promise<void>;
|
|
24
25
|
currentWorkflowTask: WorkflowTaskDetail;
|
|
25
|
-
setCurrentWorkflowTask: (
|
|
26
|
+
setCurrentWorkflowTask: (currentWorkflowTask: WorkflowTaskDetail | ((prev?: WorkflowTaskDetail) => WorkflowTaskDetail)) => void;
|
|
26
27
|
setSelectedJobStatus: (selectedJobStatus: number) => void;
|
|
27
28
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { Conversations } from './components/Conversations';
|
|
10
|
+
export { ChatBoxUnreadBadge } from './components/ChatBoxUnreadBadge';
|
|
11
|
+
export { Messages } from './components/Messages';
|
|
12
|
+
export { useChat } from './hooks/useChat';
|
|
13
|
+
export { useChatBoxActions } from './hooks/useChatBoxActions';
|
|
14
|
+
export { useChatConversationActions } from './hooks/useChatConversationActions';
|
|
15
|
+
export { useChatMessageActions } from './hooks/useChatMessageActions';
|
|
16
|
+
export { registerMountedChatBox } from './stores/mounted-chat-boxes';
|
|
17
|
+
export { useChatBoxRuntime } from './stores/runtime';
|
|
@@ -6,157 +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
|
-
/// <reference types="react" />
|
|
10
9
|
import type { AIEmployee } from '../types';
|
|
11
|
-
export declare const defaultRoles: Record<string,
|
|
12
|
-
|
|
13
|
-
}, "content" | "messageRender" | "loadingRender"> & {
|
|
14
|
-
nickname?: string;
|
|
15
|
-
content?: {
|
|
16
|
-
content: unknown;
|
|
17
|
-
ref?: import("react").MutableRefObject<unknown>;
|
|
18
|
-
type?: import("../types").MessageType;
|
|
19
|
-
messageId?: string;
|
|
20
|
-
attachments?: import("../types").Attachment[];
|
|
21
|
-
workContext?: import("../types").ContextItem[];
|
|
22
|
-
tool_calls?: import("../types").ToolCall<unknown>[];
|
|
23
|
-
metadata?: {
|
|
24
|
-
model: string;
|
|
25
|
-
provider: string;
|
|
26
|
-
llmService?: string;
|
|
27
|
-
usage_metadata?: {
|
|
28
|
-
input_tokens: number;
|
|
29
|
-
output_tokens: number;
|
|
30
|
-
total_tokens: number;
|
|
31
|
-
};
|
|
32
|
-
autoCallTools?: string[];
|
|
33
|
-
};
|
|
34
|
-
reference?: {
|
|
35
|
-
title: string;
|
|
36
|
-
url: string;
|
|
37
|
-
}[];
|
|
38
|
-
reasoning?: {
|
|
39
|
-
status: string;
|
|
40
|
-
content: string;
|
|
41
|
-
};
|
|
42
|
-
subAgentConversations?: {
|
|
43
|
-
sessionId: string;
|
|
44
|
-
toolCallId?: string;
|
|
45
|
-
status?: "completed" | "pending";
|
|
46
|
-
messages: import("../types").Message[];
|
|
47
|
-
}[];
|
|
48
|
-
from?: "main-agent" | "sub-agent";
|
|
49
|
-
};
|
|
50
|
-
messageRender?: (content: {
|
|
51
|
-
content: unknown;
|
|
52
|
-
ref?: import("react").MutableRefObject<unknown>;
|
|
53
|
-
type?: import("../types").MessageType;
|
|
54
|
-
messageId?: string;
|
|
55
|
-
attachments?: import("../types").Attachment[];
|
|
56
|
-
workContext?: import("../types").ContextItem[];
|
|
57
|
-
tool_calls?: import("../types").ToolCall<unknown>[];
|
|
58
|
-
metadata?: {
|
|
59
|
-
model: string;
|
|
60
|
-
provider: string;
|
|
61
|
-
llmService?: string;
|
|
62
|
-
usage_metadata?: {
|
|
63
|
-
input_tokens: number;
|
|
64
|
-
output_tokens: number;
|
|
65
|
-
total_tokens: number;
|
|
66
|
-
};
|
|
67
|
-
autoCallTools?: string[];
|
|
68
|
-
};
|
|
69
|
-
reference?: {
|
|
70
|
-
title: string;
|
|
71
|
-
url: string;
|
|
72
|
-
}[];
|
|
73
|
-
reasoning?: {
|
|
74
|
-
status: string;
|
|
75
|
-
content: string;
|
|
76
|
-
};
|
|
77
|
-
subAgentConversations?: {
|
|
78
|
-
sessionId: string;
|
|
79
|
-
toolCallId?: string;
|
|
80
|
-
status?: "completed" | "pending";
|
|
81
|
-
messages: import("../types").Message[];
|
|
82
|
-
}[];
|
|
83
|
-
from?: "main-agent" | "sub-agent";
|
|
84
|
-
}) => import("react").ReactNode;
|
|
85
|
-
loadingRender?: () => import("react").ReactNode;
|
|
86
|
-
}>;
|
|
87
|
-
export declare const aiEmployeeRole: (aiEmployee: AIEmployee) => Omit<import("@ant-design/x").BubbleProps<import("@ant-design/x/es/bubble/interface").BubbleContentType> & {
|
|
88
|
-
ref?: import("react").Ref<import("@ant-design/x/es/bubble/Bubble").BubbleRef>;
|
|
89
|
-
}, "content" | "messageRender" | "loadingRender"> & {
|
|
90
|
-
nickname?: string;
|
|
91
|
-
content?: {
|
|
92
|
-
content: unknown;
|
|
93
|
-
ref?: import("react").MutableRefObject<unknown>;
|
|
94
|
-
type?: import("../types").MessageType;
|
|
95
|
-
messageId?: string;
|
|
96
|
-
attachments?: import("../types").Attachment[];
|
|
97
|
-
workContext?: import("../types").ContextItem[];
|
|
98
|
-
tool_calls?: import("../types").ToolCall<unknown>[];
|
|
99
|
-
metadata?: {
|
|
100
|
-
model: string;
|
|
101
|
-
provider: string;
|
|
102
|
-
llmService?: string;
|
|
103
|
-
usage_metadata?: {
|
|
104
|
-
input_tokens: number;
|
|
105
|
-
output_tokens: number;
|
|
106
|
-
total_tokens: number;
|
|
107
|
-
};
|
|
108
|
-
autoCallTools?: string[];
|
|
109
|
-
};
|
|
110
|
-
reference?: {
|
|
111
|
-
title: string;
|
|
112
|
-
url: string;
|
|
113
|
-
}[];
|
|
114
|
-
reasoning?: {
|
|
115
|
-
status: string;
|
|
116
|
-
content: string;
|
|
117
|
-
};
|
|
118
|
-
subAgentConversations?: {
|
|
119
|
-
sessionId: string;
|
|
120
|
-
toolCallId?: string;
|
|
121
|
-
status?: "completed" | "pending";
|
|
122
|
-
messages: import("../types").Message[];
|
|
123
|
-
}[];
|
|
124
|
-
from?: "main-agent" | "sub-agent";
|
|
125
|
-
};
|
|
126
|
-
messageRender?: (content: {
|
|
127
|
-
content: unknown;
|
|
128
|
-
ref?: import("react").MutableRefObject<unknown>;
|
|
129
|
-
type?: import("../types").MessageType;
|
|
130
|
-
messageId?: string;
|
|
131
|
-
attachments?: import("../types").Attachment[];
|
|
132
|
-
workContext?: import("../types").ContextItem[];
|
|
133
|
-
tool_calls?: import("../types").ToolCall<unknown>[];
|
|
134
|
-
metadata?: {
|
|
135
|
-
model: string;
|
|
136
|
-
provider: string;
|
|
137
|
-
llmService?: string;
|
|
138
|
-
usage_metadata?: {
|
|
139
|
-
input_tokens: number;
|
|
140
|
-
output_tokens: number;
|
|
141
|
-
total_tokens: number;
|
|
142
|
-
};
|
|
143
|
-
autoCallTools?: string[];
|
|
144
|
-
};
|
|
145
|
-
reference?: {
|
|
146
|
-
title: string;
|
|
147
|
-
url: string;
|
|
148
|
-
}[];
|
|
149
|
-
reasoning?: {
|
|
150
|
-
status: string;
|
|
151
|
-
content: string;
|
|
152
|
-
};
|
|
153
|
-
subAgentConversations?: {
|
|
154
|
-
sessionId: string;
|
|
155
|
-
toolCallId?: string;
|
|
156
|
-
status?: "completed" | "pending";
|
|
157
|
-
messages: import("../types").Message[];
|
|
158
|
-
}[];
|
|
159
|
-
from?: "main-agent" | "sub-agent";
|
|
160
|
-
}) => import("react").ReactNode;
|
|
161
|
-
loadingRender?: () => import("react").ReactNode;
|
|
162
|
-
};
|
|
10
|
+
export declare const defaultRoles: Record<string, import("./components/MessageRenderers").ChatBubbleRole>;
|
|
11
|
+
export declare const aiEmployeeRole: (aiEmployee: AIEmployee) => import("./components/MessageRenderers").ChatBubbleRole;
|
|
@@ -7,59 +7,74 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
/// <reference types="react" />
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
10
|
+
import type { Sender } from '@ant-design/x';
|
|
11
|
+
import type { GetRef } from 'antd';
|
|
12
12
|
import type { AIEmployee } from '../../types';
|
|
13
|
-
type
|
|
13
|
+
import type { ChatBubbleRole } from '../components/MessageRenderers';
|
|
14
|
+
import type { ChatSenderModel } from './chat-sender';
|
|
15
|
+
type RoleMap = Record<string, ChatBubbleRole>;
|
|
16
|
+
type ChatBoxTaskVariables = {
|
|
17
|
+
variables?: Record<string, unknown>;
|
|
18
|
+
localVariables?: Record<string, unknown>;
|
|
19
|
+
};
|
|
14
20
|
export interface ModelRef {
|
|
15
21
|
llmService: string;
|
|
16
22
|
model: string;
|
|
17
23
|
}
|
|
18
|
-
|
|
24
|
+
export declare class ChatBoxModel {
|
|
25
|
+
private senderModel?;
|
|
26
|
+
legacySenderValue: string;
|
|
27
|
+
legacySenderPlaceholder: string;
|
|
28
|
+
legacyIsEditingMessage: boolean;
|
|
29
|
+
legacyEditingMessageId: string | null | undefined;
|
|
30
|
+
legacySenderRef: React.MutableRefObject<GetRef<typeof Sender> | null> | null;
|
|
31
|
+
legacyIsShowSenderHint: boolean;
|
|
19
32
|
open: boolean;
|
|
20
33
|
expanded: boolean;
|
|
21
34
|
collapsed: boolean;
|
|
22
35
|
showConversations: boolean;
|
|
23
36
|
minimize: boolean;
|
|
24
|
-
currentEmployee
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
taskVariables: {
|
|
29
|
-
variables?: Record<string, unknown>;
|
|
30
|
-
localVariables?: Record<string, unknown>;
|
|
31
|
-
};
|
|
32
|
-
isEditingMessage: boolean;
|
|
33
|
-
editingMessageId?: string;
|
|
34
|
-
chatBoxRef: React.MutableRefObject<HTMLDivElement> | null;
|
|
35
|
-
senderRef: React.MutableRefObject<GetRef<typeof Sender>> | null;
|
|
37
|
+
currentEmployee: AIEmployee | null | undefined;
|
|
38
|
+
roles: RoleMap;
|
|
39
|
+
taskVariables: ChatBoxTaskVariables;
|
|
40
|
+
chatBoxRef: React.MutableRefObject<HTMLDivElement | null> | null;
|
|
36
41
|
showCodeHistory: boolean;
|
|
37
|
-
model
|
|
42
|
+
model: ModelRef | null | undefined;
|
|
38
43
|
showDebugPanel: boolean;
|
|
39
44
|
readonly: boolean;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
constructor();
|
|
46
|
+
get senderValue(): string;
|
|
47
|
+
set senderValue(value: string);
|
|
48
|
+
get senderPlaceholder(): string;
|
|
49
|
+
set senderPlaceholder(placeholder: string);
|
|
50
|
+
get isEditingMessage(): boolean;
|
|
51
|
+
set isEditingMessage(isEditing: boolean);
|
|
52
|
+
get editingMessageId(): string | null | undefined;
|
|
53
|
+
set editingMessageId(id: string | null | undefined);
|
|
54
|
+
get senderRef(): React.MutableRefObject<GetRef<typeof Sender> | null> | null;
|
|
55
|
+
set senderRef(ref: React.MutableRefObject<GetRef<typeof Sender> | null> | null);
|
|
56
|
+
get isShowSenderHint(): boolean;
|
|
57
|
+
set isShowSenderHint(isShowSenderHint: boolean);
|
|
58
|
+
attachSenderModel: (senderModel: ChatSenderModel) => void;
|
|
43
59
|
setOpen: (open: boolean) => void;
|
|
44
60
|
setExpanded: (expanded: boolean) => void;
|
|
45
61
|
setCollapsed: (collapsed: boolean) => void;
|
|
46
62
|
setShowConversations: (show: boolean) => void;
|
|
47
|
-
setMinimize: (
|
|
48
|
-
setCurrentEmployee: (
|
|
63
|
+
setMinimize: (minimize: boolean) => void;
|
|
64
|
+
setCurrentEmployee: (employee?: AIEmployee | ((prev: AIEmployee | null | undefined) => AIEmployee | null | undefined)) => void;
|
|
49
65
|
setSenderValue: (value: string) => void;
|
|
50
66
|
setSenderPlaceholder: (placeholder: string) => void;
|
|
51
|
-
setTaskVariables: (variables:
|
|
52
|
-
setRoles: (roles:
|
|
53
|
-
addRole: (name: string, role:
|
|
67
|
+
setTaskVariables: (variables: ChatBoxTaskVariables) => void;
|
|
68
|
+
setRoles: (roles: RoleMap | ((prev: RoleMap) => RoleMap)) => void;
|
|
69
|
+
addRole: (name: string, role: RoleMap[string]) => void;
|
|
54
70
|
setIsEditingMessage: (isEditing: boolean) => void;
|
|
55
|
-
setEditingMessageId: (id?: string) => void;
|
|
56
|
-
setChatBoxRef: (ref: React.MutableRefObject<HTMLDivElement> | null) => void;
|
|
57
|
-
setSenderRef: (ref: React.MutableRefObject<GetRef<typeof Sender
|
|
71
|
+
setEditingMessageId: (id?: string | null) => void;
|
|
72
|
+
setChatBoxRef: (ref: React.MutableRefObject<HTMLDivElement | null> | null) => void;
|
|
73
|
+
setSenderRef: (ref: React.MutableRefObject<GetRef<typeof Sender> | null> | null) => void;
|
|
58
74
|
setShowCodeHistory: (show: boolean) => void;
|
|
59
|
-
setModel: (model: ModelRef | null) => void;
|
|
75
|
+
setModel: (model: ModelRef | null | undefined) => void;
|
|
60
76
|
setShowDebugPanel: (show: boolean) => void;
|
|
61
77
|
setReadonly: (readonly: boolean) => void;
|
|
62
|
-
setShowSenderHint: (
|
|
78
|
+
setShowSenderHint: (isShowSenderHint: boolean) => void;
|
|
63
79
|
}
|
|
64
|
-
export declare const useChatBoxStore: import("./create-selectors").ObservableStore<ChatBoxState & ChatBoxActions>;
|
|
65
80
|
export {};
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import type { Conversation } from '../../types';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type ChatConversationStateUpdater<T> = T | ((prev: T) => T);
|
|
11
|
+
export declare class ChatConversationModel {
|
|
12
|
+
currentConversation: string | undefined;
|
|
12
13
|
conversations: Conversation[];
|
|
13
14
|
keyword: string;
|
|
14
15
|
webSearch: boolean;
|
|
15
16
|
conversationSegmented: string;
|
|
16
17
|
unreadCount: number;
|
|
17
|
-
|
|
18
|
-
interface ChatConversationsActions {
|
|
18
|
+
constructor();
|
|
19
19
|
setCurrentConversation: (id: string | undefined) => void;
|
|
20
20
|
setKeyword: (keyword: string) => void;
|
|
21
|
-
setConversations: (conversations: Conversation[]
|
|
21
|
+
setConversations: (conversations: ChatConversationStateUpdater<Conversation[]>) => void;
|
|
22
|
+
setConversationRead: (sessionId: string, read: boolean) => void;
|
|
22
23
|
markConversationRead: (sessionId: string) => void;
|
|
23
24
|
setWebSearch: (webSearch: boolean) => void;
|
|
24
25
|
setConversationSegmented: (conversationSegmented: string) => void;
|
|
25
|
-
setUnreadCount: (unreadCount: number
|
|
26
|
+
setUnreadCount: (unreadCount: ChatConversationStateUpdater<number>) => void;
|
|
26
27
|
}
|
|
27
|
-
export declare const useChatConversationsStore: import("./create-selectors").ObservableStore<ChatConversationsState & ChatConversationsActions>;
|
|
28
28
|
export {};
|
|
@@ -21,38 +21,44 @@ export type ChatSessionState = {
|
|
|
21
21
|
contextItems: ContextItem[];
|
|
22
22
|
systemMessage: string;
|
|
23
23
|
responseLoading: boolean;
|
|
24
|
-
abortController?: AbortController;
|
|
25
|
-
skillSettings?: SkillSettings;
|
|
26
|
-
webSearching?: WebSearching;
|
|
24
|
+
abortController?: AbortController | null;
|
|
25
|
+
skillSettings?: SkillSettings | null;
|
|
26
|
+
webSearching?: WebSearching | null;
|
|
27
27
|
backgroundWorking: boolean;
|
|
28
28
|
resumeStreamFailed: boolean;
|
|
29
29
|
};
|
|
30
30
|
export declare const CHAT_EMPTY_SESSION_STATE: ChatSessionState;
|
|
31
|
-
type ChatMessagesState = {
|
|
32
|
-
sessions: Record<string, ChatSessionState>;
|
|
33
|
-
editorRef?: Record<string, ChatEditorRef | null>;
|
|
34
|
-
currentEditorRefUid?: string;
|
|
35
|
-
flowContext?: unknown;
|
|
36
|
-
};
|
|
37
31
|
type SessionStateUpdater<T> = T | ((prev: T) => T);
|
|
38
|
-
export
|
|
32
|
+
export declare class ChatMessageModel {
|
|
33
|
+
sessions: Record<string, ChatSessionState>;
|
|
34
|
+
editorRef: Record<string, ChatEditorRef | null>;
|
|
35
|
+
currentEditorRefUid: string | null | undefined;
|
|
36
|
+
flowContext: unknown;
|
|
37
|
+
constructor();
|
|
38
|
+
private resolveSessionState;
|
|
39
|
+
private ensureSessionState;
|
|
40
|
+
private updateSessionState;
|
|
39
41
|
setEditorRef: (uid: string, editorRef: ChatEditorRef | null) => void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
unregisterEditorRef: (uid: string, editorRef: ChatEditorRef) => void;
|
|
43
|
+
setCurrentEditorRefUid: (uid: string | null | undefined) => void;
|
|
44
|
+
setFlowContext: (flowContext: unknown) => void;
|
|
42
45
|
getSessionState: (sessionId?: string) => ChatSessionState;
|
|
43
46
|
resetSessionState: (sessionId?: string, patch?: Partial<ChatSessionState>) => void;
|
|
44
47
|
migrateSessionState: (fromSessionId: string | undefined, toSessionId: string) => void;
|
|
45
48
|
setSessionMessages: (sessionId: string | undefined, messages: SessionStateUpdater<Message[]>) => void;
|
|
46
49
|
setSessionMessagesLoading: (sessionId: string | undefined, loading: boolean) => void;
|
|
47
50
|
setSessionMessagesError: (sessionId: string | undefined, error: unknown) => void;
|
|
48
|
-
setSessionMessagesMeta: (sessionId: string | undefined, meta:
|
|
51
|
+
setSessionMessagesMeta: (sessionId: string | undefined, meta: {
|
|
52
|
+
cursor?: string;
|
|
53
|
+
hasMore?: boolean;
|
|
54
|
+
} | ((prev: ChatSessionState['messagesMeta']) => ChatSessionState['messagesMeta'])) => void;
|
|
49
55
|
setSessionAttachments: (sessionId: string | undefined, attachments: SessionStateUpdater<Attachment[]>) => void;
|
|
50
56
|
setSessionContextItems: (sessionId: string | undefined, items: SessionStateUpdater<ContextItem[]>) => void;
|
|
51
57
|
setSessionSystemMessage: (sessionId: string | undefined, msg: string | ((prev: string) => string)) => void;
|
|
52
58
|
setSessionResponseLoading: (sessionId: string | undefined, loading: boolean) => void;
|
|
53
59
|
setSessionBackgroundWorking: (sessionId: string | undefined, backgroundWorking: boolean) => void;
|
|
54
60
|
setSessionResumeStreamFailed: (sessionId: string | undefined, resumeStreamFailed: boolean) => void;
|
|
55
|
-
addSessionMessage: (sessionId: string | undefined,
|
|
61
|
+
addSessionMessage: (sessionId: string | undefined, message: Message) => void;
|
|
56
62
|
addSessionMessages: (sessionId: string | undefined, msgs: Message[]) => void;
|
|
57
63
|
updateSessionLastMessage: (sessionId: string | undefined, updater: (msg: Message) => Message) => void;
|
|
58
64
|
removeSessionMessage: (sessionId: string | undefined, key: string) => void;
|
|
@@ -61,13 +67,12 @@ export interface ChatMessagesActions {
|
|
|
61
67
|
addSessionContextItems: (sessionId: string | undefined, items: ContextItem | ContextItem[]) => void;
|
|
62
68
|
addContextItems: (items: ContextItem | ContextItem[]) => void;
|
|
63
69
|
removeSessionContextItem: (sessionId: string | undefined, type: string, uid: string) => void;
|
|
64
|
-
setSessionAbortController: (sessionId: string | undefined, controller: AbortController | undefined) => void;
|
|
65
|
-
setSessionSkillSettings: (sessionId: string | undefined, settings: SkillSettings | undefined) => void;
|
|
66
|
-
setSessionWebSearching: (sessionId: string | undefined, webSearching: WebSearching) => void;
|
|
70
|
+
setSessionAbortController: (sessionId: string | undefined, controller: AbortController | undefined | null) => void;
|
|
71
|
+
setSessionSkillSettings: (sessionId: string | undefined, settings: SkillSettings | undefined | null) => void;
|
|
72
|
+
setSessionWebSearching: (sessionId: string | undefined, webSearching: WebSearching | null | undefined) => void;
|
|
67
73
|
addSessionSubAgentMessage: (sessionId: string | undefined, subSessionId: string, msg: Message) => void;
|
|
68
74
|
addSessionSubAgentMessages: (sessionId: string | undefined, subSessionId: string, msgs: Message[]) => void;
|
|
69
75
|
updateSessionLastSubAgentMessage: (sessionId: string | undefined, subSessionId: string, username: string, updater: (msg: Message) => Message) => void;
|
|
70
76
|
updateSessionSubAgentConversationStatus: (sessionId: string | undefined, subSessionId: string, status: 'pending' | 'completed') => void;
|
|
71
77
|
}
|
|
72
|
-
export declare const useChatMessagesStore: import("./create-selectors").ObservableStore<ChatMessagesState & ChatMessagesActions>;
|
|
73
78
|
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
import type { Sender } from '@ant-design/x';
|
|
11
|
+
import type { GetRef } from 'antd';
|
|
12
|
+
import type { Attachment, ContextItem, SkillSettings } from '../../types';
|
|
13
|
+
export type ChatSenderRef = React.MutableRefObject<GetRef<typeof Sender> | null>;
|
|
14
|
+
type ChatSenderStateUpdater<T> = T | ((prev: T) => T);
|
|
15
|
+
export declare class ChatSenderModel {
|
|
16
|
+
senderValue: string;
|
|
17
|
+
senderPlaceholder: string;
|
|
18
|
+
senderRef: ChatSenderRef | null;
|
|
19
|
+
isShowSenderHint: boolean;
|
|
20
|
+
isEditingMessage: boolean;
|
|
21
|
+
editingMessageId: string | null | undefined;
|
|
22
|
+
attachments: Attachment[];
|
|
23
|
+
contextItems: ContextItem[];
|
|
24
|
+
systemMessage: string;
|
|
25
|
+
skillSettings: SkillSettings | null | undefined;
|
|
26
|
+
constructor();
|
|
27
|
+
setSenderValue: (value: string) => void;
|
|
28
|
+
setSenderPlaceholder: (placeholder: string) => void;
|
|
29
|
+
setSenderRef: (ref: ChatSenderRef | null) => void;
|
|
30
|
+
setShowSenderHint: (isShowSenderHint: boolean) => void;
|
|
31
|
+
setIsEditingMessage: (isEditing: boolean) => void;
|
|
32
|
+
setEditingMessageId: (id?: string | null) => void;
|
|
33
|
+
setAttachments: (attachments: ChatSenderStateUpdater<Attachment[]>) => void;
|
|
34
|
+
addAttachments: (attachments: Attachment | Attachment[]) => void;
|
|
35
|
+
removeAttachment: (filename: string) => void;
|
|
36
|
+
setContextItems: (items: ChatSenderStateUpdater<ContextItem[]>) => void;
|
|
37
|
+
addContextItems: (items: ContextItem | ContextItem[]) => void;
|
|
38
|
+
removeContextItem: (type: string, uid: string) => void;
|
|
39
|
+
setSystemMessage: (msg: string | ((prev: string) => string)) => void;
|
|
40
|
+
setSkillSettings: (settings: SkillSettings | null | undefined) => void;
|
|
41
|
+
reset: () => void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -14,17 +14,18 @@ export type ChatToolCallSessionState = {
|
|
|
14
14
|
toolCalls: Record<string, ToolCallInvokeState[]>;
|
|
15
15
|
};
|
|
16
16
|
export declare const CHAT_EMPTY_TOOL_CALL_SESSION_STATE: ChatToolCallSessionState;
|
|
17
|
-
|
|
17
|
+
export declare class ChatToolCallModel {
|
|
18
18
|
sessions: Record<string, ChatToolCallSessionState>;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
constructor();
|
|
20
|
+
private resolveSessionState;
|
|
21
|
+
private ensureSessionState;
|
|
22
|
+
private updateSessionState;
|
|
21
23
|
getSessionState: (sessionId: string) => ChatToolCallSessionState;
|
|
22
24
|
resetSessionState: (sessionId: string) => void;
|
|
23
25
|
migrateSessionState: (fromSessionId: string, toSessionId: string) => void;
|
|
24
26
|
updateToolCallInvokeStatus: (sessionId: string, messageId: string, toolCallId: string, invokeStatus: string) => void;
|
|
25
27
|
isAllWaiting: (sessionId: string, messageId: string) => boolean;
|
|
26
28
|
isInterrupted: (sessionId: string, messageId: string, toolCallId: string) => boolean;
|
|
27
|
-
getInvokeStatus: (sessionId: string, messageId: string, toolCallId: string) => string
|
|
29
|
+
getInvokeStatus: (sessionId: string, messageId: string, toolCallId: string) => string;
|
|
28
30
|
}
|
|
29
|
-
export declare const useChatToolCallStore: import("./create-selectors").ObservableStore<ChatToolCallState & ChatToolCallActions>;
|
|
30
31
|
export {};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import type { Message, ToolCall } from '../../types';
|
|
10
|
-
|
|
10
|
+
type ChatToolsState = {
|
|
11
11
|
toolsByName: Record<string, (ToolCall<unknown> & {
|
|
12
12
|
messageId?: string;
|
|
13
13
|
})[]>;
|
|
@@ -18,13 +18,19 @@ interface ChatToolsState {
|
|
|
18
18
|
activeTool?: ToolCall<unknown>;
|
|
19
19
|
activeMessageId?: string;
|
|
20
20
|
adjustArgs?: Record<string, unknown>;
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
};
|
|
22
|
+
export declare class ChatToolModel {
|
|
23
|
+
toolsByName: ChatToolsState['toolsByName'];
|
|
24
|
+
toolsByMessageId: ChatToolsState['toolsByMessageId'];
|
|
25
|
+
openToolModal: boolean;
|
|
26
|
+
activeTool: ToolCall<unknown> | null | undefined;
|
|
27
|
+
activeMessageId: string;
|
|
28
|
+
adjustArgs: Record<string, unknown>;
|
|
29
|
+
constructor();
|
|
23
30
|
updateTools: (messages: Message[]) => void;
|
|
24
31
|
setOpenToolModal: (open: boolean) => void;
|
|
25
|
-
setActiveTool: (tool: ToolCall<unknown>) => void;
|
|
32
|
+
setActiveTool: (tool: ToolCall<unknown> | null | undefined) => void;
|
|
26
33
|
setActiveMessageId: (messageId: string) => void;
|
|
27
34
|
setAdjustArgs: (args: Record<string, unknown>) => void;
|
|
28
35
|
}
|
|
29
|
-
export declare const useChatToolsStore: import("./create-selectors").ObservableStore<ChatToolsState & ChatToolsActions>;
|
|
30
36
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { ClearOptions, ContextItem, TriggerTaskOptions } from '../../types';
|
|
10
|
+
import type { ChatBoxRuntime } from './runtime';
|
|
11
|
+
export type MountedChatBoxEntry = {
|
|
12
|
+
uid: string;
|
|
13
|
+
runtime: ChatBoxRuntime;
|
|
14
|
+
triggerTask: (options: TriggerTaskOptions) => Promise<void>;
|
|
15
|
+
clear: (options?: ClearOptions, sessionId?: string | undefined) => void;
|
|
16
|
+
syncContextItems: (items: ContextItem[]) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const registerMountedChatBox: (entry: MountedChatBoxEntry) => () => void;
|
|
19
|
+
export declare const getMountedChatBox: (uid: string) => MountedChatBoxEntry;
|
|
20
|
+
export declare const clearMountedChatBoxes: () => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { ChatBoxModel } from './chat-box';
|
|
11
|
+
import { ChatConversationModel } from './chat-conversations';
|
|
12
|
+
import { ChatMessageModel } from './chat-messages';
|
|
13
|
+
import { ChatSenderModel } from './chat-sender';
|
|
14
|
+
import { ChatToolCallModel } from './chat-tool-call';
|
|
15
|
+
import { ChatToolModel } from './chat-tools';
|
|
16
|
+
import { WorkflowTaskModel } from './workflow-tasks';
|
|
17
|
+
export type ChatBoxRuntimeMode = 'global' | 'block';
|
|
18
|
+
export type ChatBoxScopeOperation = 'list' | 'create';
|
|
19
|
+
export type ChatBoxScopeResolverOptions = {
|
|
20
|
+
operation?: ChatBoxScopeOperation;
|
|
21
|
+
};
|
|
22
|
+
export type ChatBoxScopeResolver = (options?: ChatBoxScopeResolverOptions) => Promise<string | undefined>;
|
|
23
|
+
export type ChatBoxRuntime = {
|
|
24
|
+
mode: ChatBoxRuntimeMode;
|
|
25
|
+
getScope?: ChatBoxScopeResolver;
|
|
26
|
+
chatBoxModel: ChatBoxModel;
|
|
27
|
+
chatSenderModel: ChatSenderModel;
|
|
28
|
+
chatConversationModel: ChatConversationModel;
|
|
29
|
+
chatMessageModel: ChatMessageModel;
|
|
30
|
+
chatToolCallModel: ChatToolCallModel;
|
|
31
|
+
chatToolModel: ChatToolModel;
|
|
32
|
+
workflowTaskModel: WorkflowTaskModel;
|
|
33
|
+
};
|
|
34
|
+
export declare const createChatBoxRuntime: (runtime?: Partial<ChatBoxRuntime>) => ChatBoxRuntime;
|
|
35
|
+
export declare const getGlobalChatBoxRuntime: () => ChatBoxRuntime;
|
|
36
|
+
export declare const ChatBoxContext: React.Context<ChatBoxRuntime>;
|
|
37
|
+
export declare const ChatBoxRuntimeProvider: React.FC<{
|
|
38
|
+
runtime: ChatBoxRuntime;
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const useChatBoxRuntime: () => ChatBoxRuntime;
|
|
42
|
+
export declare const useResolvedChatBoxRuntime: (runtime?: ChatBoxRuntime) => ChatBoxRuntime;
|
|
43
|
+
export declare const resolveChatBoxScope: (runtime: ChatBoxRuntime, options?: ChatBoxScopeResolverOptions) => Promise<string>;
|