@nocobase/plugin-ai 2.1.0-beta.46 → 2.1.0-beta.47
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/api/cli/config/delete.md +7 -5
- package/dist/ai/docs/nocobase/api/cli/config/get.md +7 -5
- package/dist/ai/docs/nocobase/api/cli/config/index.md +38 -18
- package/dist/ai/docs/nocobase/api/cli/config/set.md +9 -7
- package/dist/ai/docs/nocobase/api/cli/env/index.md +19 -20
- package/dist/ai/docs/nocobase/api/cli/env/update.md +72 -72
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/current.md +33 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/generate.md +54 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/index.md +60 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/info.md +42 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/reload.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/restart.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/start.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/status.md +36 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/stop.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/caddy/use.md +38 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/index.md +124 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/current.md +33 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/generate.md +62 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/index.md +60 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/info.md +43 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/reload.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/restart.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/start.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/status.md +36 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/stop.md +32 -0
- package/dist/ai/docs/nocobase/api/cli/proxy/nginx/use.md +38 -0
- package/dist/ai/docs/nocobase/ops-management/version-control/index.md +73 -0
- package/dist/ai/docs/nocobase/quickstart/production/index.md +75 -69
- package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/caddy.md +211 -80
- package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/index.md +72 -53
- package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/nginx.md +186 -89
- package/dist/client/{290.0888139e33c9b7cb.js → 290.0f7f441d8a94f03c.js} +1 -1
- package/dist/client/{428.431a00d29107058e.js → 428.fdd0cc3cfd1632ef.js} +1 -1
- package/dist/client/ai-employees/chatbox/hooks/useChat.d.ts +14 -14
- package/dist/client/ai-employees/chatbox/stores/chat-box.d.ts +1 -105
- package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +1 -37
- package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +1 -109
- package/dist/client/index.js +3 -3
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +113 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +45 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +118 -0
- package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +18 -0
- package/dist/client-v2/ai-employees/chatbox/stores/global-store.d.ts +9 -0
- package/dist/client-v2/ai-employees/types.d.ts +151 -0
- package/dist/client-v2/index.d.ts +8 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/repositories/AIConfigRepository.d.ts +81 -0
- package/dist/client-v2/repositories/hooks/useAIConfigRepository.d.ts +10 -0
- package/dist/collections/ai-context-datasource.js +1 -0
- package/dist/externalVersion.js +16 -16
- 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/collections/ai-conversations.js +1 -0
- package/dist/server/collections/ai-employees.js +1 -0
- package/dist/server/collections/ai-files.js +1 -0
- package/dist/server/collections/ai-messages.js +1 -0
- package/dist/server/collections/ai-settings.js +1 -0
- package/dist/server/collections/ai-tool-messages.js +1 -0
- package/dist/server/collections/lc-checkpoint-blobs.js +1 -0
- package/dist/server/collections/lc-checkpoint-writes.js +1 -0
- package/dist/server/collections/lc-checkpoints.js +1 -0
- package/dist/server/collections/llm-services.js +1 -0
- package/dist/server/collections/users-ai-employees.js +1 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/api/cli/env/proxy/caddy.md +0 -108
- package/dist/ai/docs/nocobase/api/cli/env/proxy/index.md +0 -54
- package/dist/ai/docs/nocobase/api/cli/env/proxy/nginx.md +0 -104
|
@@ -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
|
+
import type { AIEmployee, ClearOptions, TriggerTaskOptions } from '../../types';
|
|
10
|
+
export declare const useChatBoxActions: () => {
|
|
11
|
+
clear: (options?: ClearOptions) => void;
|
|
12
|
+
startNewConversation: () => void;
|
|
13
|
+
switchAIEmployee: (aiEmployee: AIEmployee, options?: {
|
|
14
|
+
clear?: ClearOptions;
|
|
15
|
+
}) => void;
|
|
16
|
+
triggerTask: (options: TriggerTaskOptions) => Promise<void>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
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 { Bubble, Sender } from '@ant-design/x';
|
|
11
|
+
import type { GetProp, GetRef } from 'antd';
|
|
12
|
+
import type { AIEmployee } from '../../types';
|
|
13
|
+
type RolesType = GetProp<typeof Bubble.List, 'roles'>;
|
|
14
|
+
export interface ModelRef {
|
|
15
|
+
llmService: string;
|
|
16
|
+
model: string;
|
|
17
|
+
}
|
|
18
|
+
interface ChatBoxState {
|
|
19
|
+
open: boolean;
|
|
20
|
+
expanded: boolean;
|
|
21
|
+
collapsed: boolean;
|
|
22
|
+
showConversations: boolean;
|
|
23
|
+
minimize: boolean;
|
|
24
|
+
currentEmployee?: AIEmployee;
|
|
25
|
+
senderValue: string;
|
|
26
|
+
senderPlaceholder: string;
|
|
27
|
+
roles: GetProp<typeof Bubble.List, 'roles'>;
|
|
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;
|
|
36
|
+
showCodeHistory: boolean;
|
|
37
|
+
model?: ModelRef | null;
|
|
38
|
+
showDebugPanel: boolean;
|
|
39
|
+
readonly: boolean;
|
|
40
|
+
isShowSenderHint: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface ChatBoxActions {
|
|
43
|
+
setOpen: (open: boolean) => void;
|
|
44
|
+
setExpanded: (expanded: boolean) => void;
|
|
45
|
+
setCollapsed: (collapsed: boolean) => void;
|
|
46
|
+
setShowConversations: (show: boolean) => void;
|
|
47
|
+
setMinimize: (minus: boolean) => void;
|
|
48
|
+
setCurrentEmployee: (aiEmployee?: AIEmployee | ((prev: AIEmployee) => AIEmployee)) => void;
|
|
49
|
+
setSenderValue: (value: string) => void;
|
|
50
|
+
setSenderPlaceholder: (placeholder: string) => void;
|
|
51
|
+
setTaskVariables: (variables: ChatBoxState['taskVariables']) => void;
|
|
52
|
+
setRoles: (roles: RolesType | ((prev: RolesType) => RolesType)) => void;
|
|
53
|
+
addRole: (name: string, role: unknown) => void;
|
|
54
|
+
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>> | null) => void;
|
|
58
|
+
setShowCodeHistory: (show: boolean) => void;
|
|
59
|
+
setModel: (model: ModelRef | null) => void;
|
|
60
|
+
setShowDebugPanel: (show: boolean) => void;
|
|
61
|
+
setReadonly: (readonly: boolean) => void;
|
|
62
|
+
setShowSenderHint: (show: boolean) => void;
|
|
63
|
+
}
|
|
64
|
+
export declare const useChatBoxStore: {
|
|
65
|
+
(): ChatBoxState & ChatBoxActions;
|
|
66
|
+
<U>(selector: (state: ChatBoxState & ChatBoxActions) => U): U;
|
|
67
|
+
} & import("zustand").StoreApi<ChatBoxState & ChatBoxActions> & {
|
|
68
|
+
use: {
|
|
69
|
+
open: () => boolean;
|
|
70
|
+
expanded: () => boolean;
|
|
71
|
+
collapsed: () => boolean;
|
|
72
|
+
showConversations: () => boolean;
|
|
73
|
+
minimize: () => boolean;
|
|
74
|
+
currentEmployee?: () => AIEmployee;
|
|
75
|
+
senderValue: () => string;
|
|
76
|
+
senderPlaceholder: () => string;
|
|
77
|
+
roles: () => GetProp<import("react").ForwardRefExoticComponent<import("@ant-design/x/es/bubble/BubbleList").BubbleListProps & import("react").RefAttributes<import("@ant-design/x/es/bubble/BubbleList").BubbleListRef>>, "roles">;
|
|
78
|
+
taskVariables: () => {
|
|
79
|
+
variables?: Record<string, unknown>;
|
|
80
|
+
localVariables?: Record<string, unknown>;
|
|
81
|
+
};
|
|
82
|
+
isEditingMessage: () => boolean;
|
|
83
|
+
editingMessageId?: () => string;
|
|
84
|
+
chatBoxRef: () => import("react").MutableRefObject<HTMLDivElement>;
|
|
85
|
+
senderRef: () => import("react").MutableRefObject<import("@ant-design/x/es/sender").SenderRef>;
|
|
86
|
+
showCodeHistory: () => boolean;
|
|
87
|
+
model?: () => ModelRef;
|
|
88
|
+
showDebugPanel: () => boolean;
|
|
89
|
+
readonly: () => boolean;
|
|
90
|
+
isShowSenderHint: () => boolean;
|
|
91
|
+
setOpen: () => (open: boolean) => void;
|
|
92
|
+
setExpanded: () => (expanded: boolean) => void;
|
|
93
|
+
setCollapsed: () => (collapsed: boolean) => void;
|
|
94
|
+
setShowConversations: () => (show: boolean) => void;
|
|
95
|
+
setMinimize: () => (minus: boolean) => void;
|
|
96
|
+
setCurrentEmployee: () => (aiEmployee?: AIEmployee | ((prev: AIEmployee) => AIEmployee)) => void;
|
|
97
|
+
setSenderValue: () => (value: string) => void;
|
|
98
|
+
setSenderPlaceholder: () => (placeholder: string) => void;
|
|
99
|
+
setTaskVariables: () => (variables: ChatBoxState['taskVariables']) => void;
|
|
100
|
+
setRoles: () => (roles: RolesType | ((prev: RolesType) => RolesType)) => void;
|
|
101
|
+
addRole: () => (name: string, role: unknown) => void;
|
|
102
|
+
setIsEditingMessage: () => (isEditing: boolean) => void;
|
|
103
|
+
setEditingMessageId: () => (id?: string) => void;
|
|
104
|
+
setChatBoxRef: () => (ref: React.MutableRefObject<HTMLDivElement> | null) => void;
|
|
105
|
+
setSenderRef: () => (ref: React.MutableRefObject<GetRef<typeof Sender>> | null) => void;
|
|
106
|
+
setShowCodeHistory: () => (show: boolean) => void;
|
|
107
|
+
setModel: () => (model: ModelRef | null) => void;
|
|
108
|
+
setShowDebugPanel: () => (show: boolean) => void;
|
|
109
|
+
setReadonly: () => (readonly: boolean) => void;
|
|
110
|
+
setShowSenderHint: () => (show: boolean) => void;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { Conversation } from '../../types';
|
|
10
|
+
interface ChatConversationsState {
|
|
11
|
+
currentConversation?: string;
|
|
12
|
+
conversations: Conversation[];
|
|
13
|
+
keyword: string;
|
|
14
|
+
webSearch: boolean;
|
|
15
|
+
conversationSegmented: string;
|
|
16
|
+
unreadCount: number;
|
|
17
|
+
}
|
|
18
|
+
interface ChatConversationsActions {
|
|
19
|
+
setCurrentConversation: (id: string | undefined) => void;
|
|
20
|
+
setKeyword: (keyword: string) => void;
|
|
21
|
+
setConversations: (conversations: Conversation[] | ((prev: Conversation[]) => Conversation[])) => void;
|
|
22
|
+
setWebSearch: (webSearch: boolean) => void;
|
|
23
|
+
setConversationSegmented: (conversationSegmented: string) => void;
|
|
24
|
+
setUnreadCount: (unreadCount: number | ((prev: number) => number)) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const useChatConversationsStore: {
|
|
27
|
+
(): ChatConversationsState & ChatConversationsActions;
|
|
28
|
+
<U>(selector: (state: ChatConversationsState & ChatConversationsActions) => U): U;
|
|
29
|
+
} & import("zustand").StoreApi<ChatConversationsState & ChatConversationsActions> & {
|
|
30
|
+
use: {
|
|
31
|
+
currentConversation?: () => string;
|
|
32
|
+
conversations: () => Conversation[];
|
|
33
|
+
keyword: () => string;
|
|
34
|
+
webSearch: () => boolean;
|
|
35
|
+
conversationSegmented: () => string;
|
|
36
|
+
unreadCount: () => number;
|
|
37
|
+
setCurrentConversation: () => (id: string | undefined) => void;
|
|
38
|
+
setKeyword: () => (keyword: string) => void;
|
|
39
|
+
setConversations: () => (conversations: Conversation[] | ((prev: Conversation[]) => Conversation[])) => void;
|
|
40
|
+
setWebSearch: () => (webSearch: boolean) => void;
|
|
41
|
+
setConversationSegmented: () => (conversationSegmented: string) => void;
|
|
42
|
+
setUnreadCount: () => (unreadCount: number | ((prev: number) => number)) => void;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
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 { Attachment, ChatEditorRef, ContextItem, Message, SkillSettings, WebSearching } from '../../types';
|
|
10
|
+
export declare const CHAT_DEFAULT_SESSION_KEY = "__draft__";
|
|
11
|
+
export declare const getChatSessionKey: (sessionId?: string) => string;
|
|
12
|
+
export type ChatSessionState = {
|
|
13
|
+
messages: Message[];
|
|
14
|
+
messagesLoading: boolean;
|
|
15
|
+
messagesError?: unknown;
|
|
16
|
+
messagesMeta: {
|
|
17
|
+
cursor?: string;
|
|
18
|
+
hasMore?: boolean;
|
|
19
|
+
};
|
|
20
|
+
attachments: Attachment[];
|
|
21
|
+
contextItems: ContextItem[];
|
|
22
|
+
systemMessage: string;
|
|
23
|
+
responseLoading: boolean;
|
|
24
|
+
abortController?: AbortController;
|
|
25
|
+
skillSettings?: SkillSettings;
|
|
26
|
+
webSearching?: WebSearching;
|
|
27
|
+
backgroundWorking: boolean;
|
|
28
|
+
resumeStreamFailed: boolean;
|
|
29
|
+
};
|
|
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
|
+
type SessionStateUpdater<T> = T | ((prev: T) => T);
|
|
38
|
+
export interface ChatMessagesActions {
|
|
39
|
+
setEditorRef: (uid: string, editorRef: ChatEditorRef | null) => void;
|
|
40
|
+
setCurrentEditorRefUid: (uid: string) => void;
|
|
41
|
+
setFlowContext: (ctx: unknown) => void;
|
|
42
|
+
getSessionState: (sessionId?: string) => ChatSessionState;
|
|
43
|
+
resetSessionState: (sessionId?: string, patch?: Partial<ChatSessionState>) => void;
|
|
44
|
+
migrateSessionState: (fromSessionId: string | undefined, toSessionId: string) => void;
|
|
45
|
+
setSessionMessages: (sessionId: string | undefined, messages: SessionStateUpdater<Message[]>) => void;
|
|
46
|
+
setSessionMessagesLoading: (sessionId: string | undefined, loading: boolean) => void;
|
|
47
|
+
setSessionMessagesError: (sessionId: string | undefined, error: unknown) => void;
|
|
48
|
+
setSessionMessagesMeta: (sessionId: string | undefined, meta: ChatSessionState['messagesMeta'] | ((prev: ChatSessionState['messagesMeta']) => ChatSessionState['messagesMeta'])) => void;
|
|
49
|
+
setSessionAttachments: (sessionId: string | undefined, attachments: SessionStateUpdater<Attachment[]>) => void;
|
|
50
|
+
setSessionContextItems: (sessionId: string | undefined, items: SessionStateUpdater<ContextItem[]>) => void;
|
|
51
|
+
setSessionSystemMessage: (sessionId: string | undefined, msg: string | ((prev: string) => string)) => void;
|
|
52
|
+
setSessionResponseLoading: (sessionId: string | undefined, loading: boolean) => void;
|
|
53
|
+
setSessionBackgroundWorking: (sessionId: string | undefined, backgroundWorking: boolean) => void;
|
|
54
|
+
setSessionResumeStreamFailed: (sessionId: string | undefined, resumeStreamFailed: boolean) => void;
|
|
55
|
+
addSessionMessage: (sessionId: string | undefined, msg: Message) => void;
|
|
56
|
+
addSessionMessages: (sessionId: string | undefined, msgs: Message[]) => void;
|
|
57
|
+
updateSessionLastMessage: (sessionId: string | undefined, updater: (msg: Message) => Message) => void;
|
|
58
|
+
removeSessionMessage: (sessionId: string | undefined, key: string) => void;
|
|
59
|
+
addSessionAttachments: (sessionId: string | undefined, attachments: Attachment | Attachment[]) => void;
|
|
60
|
+
removeSessionAttachment: (sessionId: string | undefined, filename: string) => void;
|
|
61
|
+
addSessionContextItems: (sessionId: string | undefined, items: ContextItem | ContextItem[]) => void;
|
|
62
|
+
addContextItems: (items: ContextItem | ContextItem[]) => void;
|
|
63
|
+
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;
|
|
67
|
+
addSessionSubAgentMessage: (sessionId: string | undefined, subSessionId: string, msg: Message) => void;
|
|
68
|
+
addSessionSubAgentMessages: (sessionId: string | undefined, subSessionId: string, msgs: Message[]) => void;
|
|
69
|
+
updateSessionLastSubAgentMessage: (sessionId: string | undefined, subSessionId: string, username: string, updater: (msg: Message) => Message) => void;
|
|
70
|
+
updateSessionSubAgentConversationStatus: (sessionId: string | undefined, subSessionId: string, status: 'pending' | 'completed') => void;
|
|
71
|
+
}
|
|
72
|
+
export declare const useChatMessagesStore: {
|
|
73
|
+
(): ChatMessagesState & ChatMessagesActions;
|
|
74
|
+
<U>(selector: (state: ChatMessagesState & ChatMessagesActions) => U): U;
|
|
75
|
+
} & import("zustand").StoreApi<ChatMessagesState & ChatMessagesActions> & {
|
|
76
|
+
use: {
|
|
77
|
+
sessions: () => Record<string, ChatSessionState>;
|
|
78
|
+
editorRef?: () => Record<string, ChatEditorRef>;
|
|
79
|
+
currentEditorRefUid?: () => string;
|
|
80
|
+
flowContext?: () => unknown;
|
|
81
|
+
setEditorRef: () => (uid: string, editorRef: ChatEditorRef | null) => void;
|
|
82
|
+
setCurrentEditorRefUid: () => (uid: string) => void;
|
|
83
|
+
setFlowContext: () => (ctx: unknown) => void;
|
|
84
|
+
getSessionState: () => (sessionId?: string) => ChatSessionState;
|
|
85
|
+
resetSessionState: () => (sessionId?: string, patch?: Partial<ChatSessionState>) => void;
|
|
86
|
+
migrateSessionState: () => (fromSessionId: string | undefined, toSessionId: string) => void;
|
|
87
|
+
setSessionMessages: () => (sessionId: string | undefined, messages: SessionStateUpdater<Message[]>) => void;
|
|
88
|
+
setSessionMessagesLoading: () => (sessionId: string | undefined, loading: boolean) => void;
|
|
89
|
+
setSessionMessagesError: () => (sessionId: string | undefined, error: unknown) => void;
|
|
90
|
+
setSessionMessagesMeta: () => (sessionId: string | undefined, meta: {
|
|
91
|
+
cursor?: string;
|
|
92
|
+
hasMore?: boolean;
|
|
93
|
+
} | ((prev: ChatSessionState['messagesMeta']) => ChatSessionState['messagesMeta'])) => void;
|
|
94
|
+
setSessionAttachments: () => (sessionId: string | undefined, attachments: SessionStateUpdater<Attachment[]>) => void;
|
|
95
|
+
setSessionContextItems: () => (sessionId: string | undefined, items: SessionStateUpdater<ContextItem[]>) => void;
|
|
96
|
+
setSessionSystemMessage: () => (sessionId: string | undefined, msg: string | ((prev: string) => string)) => void;
|
|
97
|
+
setSessionResponseLoading: () => (sessionId: string | undefined, loading: boolean) => void;
|
|
98
|
+
setSessionBackgroundWorking: () => (sessionId: string | undefined, backgroundWorking: boolean) => void;
|
|
99
|
+
setSessionResumeStreamFailed: () => (sessionId: string | undefined, resumeStreamFailed: boolean) => void;
|
|
100
|
+
addSessionMessage: () => (sessionId: string | undefined, msg: Message) => void;
|
|
101
|
+
addSessionMessages: () => (sessionId: string | undefined, msgs: Message[]) => void;
|
|
102
|
+
updateSessionLastMessage: () => (sessionId: string | undefined, updater: (msg: Message) => Message) => void;
|
|
103
|
+
removeSessionMessage: () => (sessionId: string | undefined, key: string) => void;
|
|
104
|
+
addSessionAttachments: () => (sessionId: string | undefined, attachments: Attachment | Attachment[]) => void;
|
|
105
|
+
removeSessionAttachment: () => (sessionId: string | undefined, filename: string) => void;
|
|
106
|
+
addSessionContextItems: () => (sessionId: string | undefined, items: ContextItem | ContextItem[]) => void;
|
|
107
|
+
addContextItems: () => (items: ContextItem | ContextItem[]) => void;
|
|
108
|
+
removeSessionContextItem: () => (sessionId: string | undefined, type: string, uid: string) => void;
|
|
109
|
+
setSessionAbortController: () => (sessionId: string | undefined, controller: AbortController | undefined) => void;
|
|
110
|
+
setSessionSkillSettings: () => (sessionId: string | undefined, settings: SkillSettings | undefined) => void;
|
|
111
|
+
setSessionWebSearching: () => (sessionId: string | undefined, webSearching: WebSearching) => void;
|
|
112
|
+
addSessionSubAgentMessage: () => (sessionId: string | undefined, subSessionId: string, msg: Message) => void;
|
|
113
|
+
addSessionSubAgentMessages: () => (sessionId: string | undefined, subSessionId: string, msgs: Message[]) => void;
|
|
114
|
+
updateSessionLastSubAgentMessage: () => (sessionId: string | undefined, subSessionId: string, username: string, updater: (msg: Message) => Message) => void;
|
|
115
|
+
updateSessionSubAgentConversationStatus: () => (sessionId: string | undefined, subSessionId: string, status: 'pending' | 'completed') => void;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { StoreApi, UseBoundStore } from 'zustand';
|
|
10
|
+
type WithSelectors<S> = S extends {
|
|
11
|
+
getState: () => infer T;
|
|
12
|
+
} ? S & {
|
|
13
|
+
use: {
|
|
14
|
+
[K in keyof T]: () => T[K];
|
|
15
|
+
};
|
|
16
|
+
} : never;
|
|
17
|
+
export declare const createSelectors: <S extends UseBoundStore<StoreApi<object>>>(_store: S) => WithSelectors<S>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getOrCreateGlobalStore: <T>(key: string, createStore: () => T) => T;
|
|
@@ -6,6 +6,8 @@
|
|
|
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
|
+
import type { BubbleProps } from '@ant-design/x';
|
|
9
11
|
export type AIEmployee = {
|
|
10
12
|
username: string;
|
|
11
13
|
nickname?: string;
|
|
@@ -13,8 +15,157 @@ export type AIEmployee = {
|
|
|
13
15
|
avatar?: string;
|
|
14
16
|
bio?: string;
|
|
15
17
|
greeting?: string;
|
|
18
|
+
userConfig?: {
|
|
19
|
+
prompt?: string;
|
|
20
|
+
};
|
|
21
|
+
skillSettings?: {
|
|
22
|
+
tools?: {
|
|
23
|
+
name: string;
|
|
24
|
+
autoCall?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
skills?: string[];
|
|
27
|
+
};
|
|
28
|
+
chatSettings?: {
|
|
29
|
+
systemPromptMode?: 'default' | 'raw' | 'none';
|
|
30
|
+
enableSkills?: boolean;
|
|
31
|
+
enableTools?: boolean;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
builtIn?: boolean;
|
|
35
|
+
webSearch?: boolean;
|
|
36
|
+
toolsConflict?: boolean;
|
|
16
37
|
category?: string;
|
|
38
|
+
deprecated?: boolean;
|
|
39
|
+
modelSettings?: {
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
llmService?: string;
|
|
42
|
+
model?: string;
|
|
43
|
+
models?: {
|
|
44
|
+
llmService?: string;
|
|
45
|
+
model?: string;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type SkillSettings = {
|
|
50
|
+
toolsVersion?: number;
|
|
51
|
+
skillsVersion?: number;
|
|
52
|
+
tools?: string[];
|
|
53
|
+
skills?: string[];
|
|
54
|
+
};
|
|
55
|
+
export type Conversation = {
|
|
56
|
+
sessionId: string;
|
|
57
|
+
title: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
aiEmployee: AIEmployee;
|
|
60
|
+
read: boolean;
|
|
61
|
+
options?: {
|
|
62
|
+
modelSettings?: {
|
|
63
|
+
llmService?: string;
|
|
64
|
+
model?: string;
|
|
65
|
+
};
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type ContextItem = {
|
|
70
|
+
type: string;
|
|
71
|
+
uid: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
content?: unknown;
|
|
74
|
+
};
|
|
75
|
+
export type ToolCall<T = unknown> = {
|
|
76
|
+
id: string;
|
|
77
|
+
type: string;
|
|
78
|
+
name: string;
|
|
79
|
+
status?: 'success' | 'error';
|
|
80
|
+
invokeStatus: 'init' | 'interrupted' | 'waiting' | 'pending' | 'done' | 'confirmed';
|
|
81
|
+
auto: boolean;
|
|
82
|
+
args: T;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
export type Attachment = any;
|
|
86
|
+
export type MessageType = 'text' | 'greeting';
|
|
87
|
+
export type Message = Omit<BubbleProps, 'content'> & {
|
|
88
|
+
key?: string | number;
|
|
89
|
+
role?: string;
|
|
90
|
+
createdAt?: string | Date;
|
|
91
|
+
content: {
|
|
92
|
+
content: any;
|
|
93
|
+
ref?: React.MutableRefObject<any>;
|
|
94
|
+
type?: MessageType;
|
|
95
|
+
messageId?: string;
|
|
96
|
+
attachments?: Attachment[];
|
|
97
|
+
workContext?: ContextItem[];
|
|
98
|
+
tool_calls?: 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?: 'pending' | 'completed';
|
|
122
|
+
messages: Message[];
|
|
123
|
+
}[];
|
|
124
|
+
from?: 'main-agent' | 'sub-agent';
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export type TaskMessage = {
|
|
128
|
+
user?: string;
|
|
129
|
+
system?: string;
|
|
130
|
+
attachments?: Attachment[];
|
|
131
|
+
workContext?: ContextItem[];
|
|
17
132
|
};
|
|
18
133
|
export type Task = {
|
|
19
134
|
title?: string;
|
|
135
|
+
message?: TaskMessage;
|
|
136
|
+
autoSend?: boolean;
|
|
137
|
+
skillSettings?: SkillSettings;
|
|
138
|
+
webSearch?: boolean;
|
|
139
|
+
model?: {
|
|
140
|
+
llmService: string;
|
|
141
|
+
model: string;
|
|
142
|
+
} | null;
|
|
143
|
+
};
|
|
144
|
+
export type TriggerTaskOptions = {
|
|
145
|
+
aiEmployee?: AIEmployee;
|
|
146
|
+
tasks?: Task[];
|
|
147
|
+
auto?: boolean;
|
|
148
|
+
};
|
|
149
|
+
export type ClearOptions = {
|
|
150
|
+
sender?: boolean;
|
|
151
|
+
systemMessage?: boolean;
|
|
152
|
+
attachments?: boolean;
|
|
153
|
+
contextItems?: boolean;
|
|
154
|
+
taskVariables?: boolean;
|
|
155
|
+
toolModal?: boolean;
|
|
156
|
+
activeTool?: boolean;
|
|
157
|
+
activeMessageId?: boolean;
|
|
158
|
+
skillSettings?: boolean;
|
|
159
|
+
};
|
|
160
|
+
export type WebSearching = {
|
|
161
|
+
type: string;
|
|
162
|
+
query: string;
|
|
20
163
|
};
|
|
164
|
+
export interface ChatEditorRef {
|
|
165
|
+
write(document: string): void;
|
|
166
|
+
read(): string;
|
|
167
|
+
run?(): Promise<unknown>;
|
|
168
|
+
buttonGroupHeight?: number;
|
|
169
|
+
snippetEntries: unknown[];
|
|
170
|
+
logs: unknown[];
|
|
171
|
+
}
|
|
@@ -8,10 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Plugin } from '@nocobase/client-v2';
|
|
10
10
|
export declare class PluginAIClientV2 extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
11
12
|
}
|
|
12
13
|
export default PluginAIClientV2;
|
|
13
14
|
export { AIEmployeeProfileCard } from './ai-employees/ProfileCard';
|
|
14
15
|
export { AIEmployeeShortcut } from './ai-employees/AIEmployeeShortcut';
|
|
15
16
|
export { avatars, avatarsMap } from './ai-employees/avatars';
|
|
16
|
-
export type { AIEmployee, Task } from './ai-employees/types';
|
|
17
|
+
export type { AIEmployee, Attachment, ChatEditorRef, ContextItem, Conversation, Message, SkillSettings, Task, TriggerTaskOptions, WebSearching, } from './ai-employees/types';
|
|
17
18
|
export { formatModelLabel } from './llm-services/model-label';
|
|
19
|
+
export { AIConfigRepository } from './repositories/AIConfigRepository';
|
|
20
|
+
export { useAIConfigRepository } from './repositories/hooks/useAIConfigRepository';
|
|
21
|
+
export { useChatMessagesStore } from './ai-employees/chatbox/stores/chat-messages';
|
|
22
|
+
export { useChatBoxStore } from './ai-employees/chatbox/stores/chat-box';
|
|
23
|
+
export { useChatConversationsStore } from './ai-employees/chatbox/stores/chat-conversations';
|
|
24
|
+
export { useChatBoxActions } from './ai-employees/chatbox/hooks/useChatBoxActions';
|