@ibiz-template-plugin/ai-chat 0.0.112 → 0.0.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/index.es.js +7561 -5813
  2. package/dist/index.legacy.js +1 -1
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/chat-container/chat-container.d.ts +1 -1
  5. package/dist/types/components/chat-group-topics/chat-group-topics.d.ts +13 -0
  6. package/dist/types/components/chat-messages/chat-messages.d.ts +2 -1
  7. package/dist/types/components/chat-messages/use-virtual-list.d.ts +36 -0
  8. package/dist/types/components/chat-project/chat-project.d.ts +12 -0
  9. package/dist/types/components/chat-scrollbar/chat-scrollbar.d.ts +102 -0
  10. package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +92 -0
  11. package/dist/types/constants/index.d.ts +16 -0
  12. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +25 -1
  13. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +208 -24
  14. package/dist/types/controller/chat/chat-base.controller.d.ts +10 -0
  15. package/dist/types/entity/ai-agent/ai-agent.d.ts +1 -0
  16. package/dist/types/entity/chart-topic/chart-topic.d.ts +2 -0
  17. package/dist/types/icons/arrow-down.d.ts +3 -1
  18. package/dist/types/icons/index.d.ts +2 -0
  19. package/dist/types/icons/plus-svg.d.ts +1 -0
  20. package/dist/types/icons/untop-svg.d.ts +1 -0
  21. package/dist/types/interface/i-ai-agent/i-ai-agent.d.ts +6 -0
  22. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +20 -1
  23. package/dist/types/interface/i-project/i-project.d.ts +14 -0
  24. package/dist/types/interface/i-remote-resource/i-remote-resource.d.ts +6 -0
  25. package/dist/types/interface/i-resource-options/i-resource-options.d.ts +21 -0
  26. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +118 -11
  27. package/dist/types/interface/index.d.ts +3 -1
  28. package/dist/types/locale/en/index.d.ts +20 -1
  29. package/dist/types/locale/zh-CN/index.d.ts +20 -1
  30. package/package.json +1 -1
@@ -8,6 +8,7 @@ import { IKnowledgeBase } from '../i-knowledge-base/i-knowledge-base';
8
8
  import { ISpeechRecognition } from '../i-speech-recognition/i-speech-recognition';
9
9
  import { Locale } from '../../locale';
10
10
  import { IConfirmUtil, IMessageUtil, INotificationUtil } from '../util';
11
+ import { IProject } from '../i-project/i-project';
11
12
 
12
13
  /**
13
14
  * 聊天数据
@@ -222,6 +223,12 @@ export interface IChatOptions extends IChat {
222
223
  * @type {boolean}
223
224
  */
224
225
  enableKnowledgeBaseSelect: boolean;
226
+ /**
227
+ * @description 是否启用AI项目功能
228
+ * @type {boolean}
229
+ * @memberof IChatOptions
230
+ */
231
+ enableAIProject: boolean;
225
232
  /**
226
233
  * 话题标题计算模式
227
234
  *
@@ -307,7 +314,7 @@ export interface IChatOptions extends IChat {
307
314
  * @param {IChatMessage[]} question 提问历史内容(包含当前提问)
308
315
  * @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
309
316
  */
310
- question(aiChat: AiChatController, context: object, params: object, otherParams: object, question: IChatMessage[], sessionid: string, srfaiagent: string | undefined, srfmode: string | undefined, srfscope: string | undefined, srfaiknowledgebases: string | undefined, srfaiagentconfig: IAIAgentConfig | undefined, appendcurdata: object | undefined, srfmcpservers: string | undefined, srfsessionmeta: object | undefined): Promise<boolean>;
317
+ question(aiChat: AiChatController, context: object, params: object, otherParams: object, question: IChatMessage[], sessionid: string, srfaiagent: string | undefined, srfmode: string | undefined, srfscope: string | undefined, srfaiknowledgebases: string | undefined, srfaiagentconfig: IAIAgentConfig | undefined, appendcurdata: object | undefined, srfmcpservers: string | undefined, srfsessionmeta: object | undefined, srfproject: string | undefined): Promise<boolean>;
311
318
  /**
312
319
  * 中断消息
313
320
  * @param aiChat
@@ -387,6 +394,18 @@ export interface IChatOptions extends IChat {
387
394
  query?: string;
388
395
  knowledgebases?: string;
389
396
  }) => Promise<IKnowledgeBase[]>;
397
+ /**
398
+ * @description 查询项目
399
+ * @memberof IChatOptions
400
+ */
401
+ fetchProject?: (context: object, params: object, other: {
402
+ srfaiagent: string;
403
+ sessionid: string;
404
+ pattern: string;
405
+ file_path: string;
406
+ max_depth: number;
407
+ only_dirs: boolean;
408
+ }) => Promise<IProject[]>;
390
409
  /**
391
410
  * 文件上传配置
392
411
  *
@@ -0,0 +1,14 @@
1
+ export interface IProject {
2
+ /**
3
+ * 项目名称
4
+ */
5
+ name: string;
6
+ /**
7
+ * 项目类型
8
+ */
9
+ type: string;
10
+ /**
11
+ * 子项目
12
+ */
13
+ children?: IProject[];
14
+ }
@@ -28,6 +28,12 @@ export interface IRemoteSession {
28
28
  * @description 会话元数据
29
29
  */
30
30
  ui_meta: string;
31
+ /**
32
+ * @description 作用域
33
+ * @type {string}
34
+ * @memberof IRemoteSession
35
+ */
36
+ scope: string;
31
37
  }
32
38
  /**
33
39
  * @description 远程消息接口
@@ -56,6 +56,27 @@ export interface IResourceOptions {
56
56
  * @param excludeSessionID 排除会话的会话id
57
57
  */
58
58
  clearAllSession(excludeSessionID: string): Promise<boolean>;
59
+ /**
60
+ * @description 批量删除会话
61
+ * @param {string[]} realIDs 会话真实id集合
62
+ * @returns {*} {Promise<boolean>}
63
+ * @memberof IResourceOptions
64
+ */
65
+ batchDeleteSession(realIDs: string[]): Promise<boolean>;
66
+ /**
67
+ * @description 批量置顶会话
68
+ * @param {string[]} realIDs 会话真实id集合
69
+ * @returns {*} {Promise<boolean>}
70
+ * @memberof IResourceOptions
71
+ */
72
+ batchTopSession(realIDs: string[]): Promise<boolean>;
73
+ /**
74
+ * @description 批量取消置顶会话
75
+ * @param {string[]} realIDs 会话真实id集合
76
+ * @returns {*} {Promise<boolean>}
77
+ * @memberof IResourceOptions
78
+ */
79
+ batchUnTopSession(realIDs: string[]): Promise<boolean>;
59
80
  /**
60
81
  * 清空指定会话的所有消息
61
82
  * @param realID
@@ -1,6 +1,90 @@
1
1
  import { IChat } from '../i-chat-options/i-chat-options';
2
2
  import { IConfigService } from '../i-config-service/i-config-service';
3
3
 
4
+ /**
5
+ * @description 业务域数据
6
+ * @export
7
+ * @interface IScopeItem
8
+ */
9
+ export interface IScopeItem {
10
+ /**
11
+ * @description 值
12
+ * @type {(string | number)}
13
+ * @memberof IScopeItem
14
+ */
15
+ id: string | number;
16
+ /**
17
+ * @description 文本
18
+ * @type {string}
19
+ * @memberof IScopeItem
20
+ */
21
+ text: string;
22
+ }
23
+ /**
24
+ * 会话分组数据
25
+ *
26
+ * @export
27
+ * @interface IGroup
28
+ */
29
+ export interface IGroupItem {
30
+ /**
31
+ * @description 值
32
+ * @type {string}
33
+ * @memberof IGroupItem
34
+ */
35
+ id: string;
36
+ /**
37
+ * @description 文本
38
+ * @type {string}
39
+ * @memberof IGroupItem
40
+ */
41
+ text: string;
42
+ /**
43
+ * @description 业务域标识
44
+ * @type {(string | number)}
45
+ * @memberof IGroupItem
46
+ */
47
+ scopeid: string | number;
48
+ /**
49
+ * @description 是否折叠,缺省展开
50
+ * @type {boolean}
51
+ * @memberof IGroupItem
52
+ */
53
+ collapsed?: boolean;
54
+ }
55
+ /**
56
+ * 分组树节点(WORKSPACE 工作模式)
57
+ *
58
+ * @export
59
+ * @interface ITopicGroupNode
60
+ */
61
+ export interface ITopicGroupNode {
62
+ /**
63
+ * 节点标识,'scope:<id>',无分类为 'scope:__NONE__'
64
+ */
65
+ key: string;
66
+ /**
67
+ * 业务域标识,无分类虚拟节点为 undefined
68
+ */
69
+ scopeid: string | number | undefined;
70
+ /**
71
+ * 显示文本
72
+ */
73
+ text: string;
74
+ /**
75
+ * 自定义分组子节点
76
+ */
77
+ groups: Array<{
78
+ id: string;
79
+ text: string;
80
+ collapsed?: boolean;
81
+ topics: ITopic[];
82
+ }>;
83
+ /**
84
+ * 未归入自定义分组的话题
85
+ */
86
+ ungroupedTopics: ITopic[];
87
+ }
4
88
  /**
5
89
  * 话题数据
6
90
  *
@@ -93,6 +177,18 @@ export interface ITopic {
93
177
  * 是否忽略显示,默认显示
94
178
  */
95
179
  isShow?: boolean;
180
+ /**
181
+ * @description 所属业务域标识
182
+ * @type {(string | number)}
183
+ * @memberof ITopic
184
+ */
185
+ scope?: string | number;
186
+ /**
187
+ * @description 所属自定义分组标识
188
+ * @type {string}
189
+ * @memberof ITopic
190
+ */
191
+ groupid?: string;
96
192
  /**
97
193
  * 上下文
98
194
  *
@@ -128,18 +224,29 @@ export interface ITopicOptions extends ITopic {
128
224
  */
129
225
  storageMode: 'DEFAULT' | 'REMOTESESSION';
130
226
  /**
131
- * 删除之前
132
- *
133
- * @author tony001
134
- * @date 2025-03-23 10:03:29
135
- * @param {object} context
136
- * @param {object} params
137
- * @param {ITopic} data
138
- * @param {MouseEvent} [event]
139
- * @param {boolean} [isBatch]
140
- * @return {*} {Promise<boolean>}
227
+ * 工作模式,默认值,会话数据以列表显示; WORKSPACE:工作区,会话数据分为域(scope)、会话分组分层显示
228
+ */
229
+ workMode?: 'DEFAULT' | 'WORKSPACE';
230
+ /**
231
+ * @description 禁用选择业务域,仅WORKSPACE模式下生效,默认不禁用
232
+ * @type {boolean}
233
+ * @memberof ITopicOptions
234
+ */
235
+ disableSelectScope?: boolean;
236
+ /**
237
+ * @description 域列表,当工作模式为WORKSPACE时必填
238
+ * @type {IScopeItem[]}
239
+ * @memberof ITopicOptions
240
+ */
241
+ scopeList?: IScopeItem[];
242
+ /**
243
+ * @description 删除之前提示
244
+ * @param {string} title
245
+ * @param {string} description
246
+ * @returns {*} {Promise<boolean>}
247
+ * @memberof ITopicOptions
141
248
  */
142
- beforeDelete?(context: object, params: object, data: ITopic, event?: MouseEvent, isBatch?: boolean): Promise<boolean>;
249
+ beforeDelete?(title: string, description: string): Promise<boolean>;
143
250
  /**
144
251
  * @description 话题行为
145
252
  * @param {string} action
@@ -3,7 +3,7 @@ export type { IChat, IChatOptions } from './i-chat-options/i-chat-options';
3
3
  export type { IMessageItemProvider } from './i-message-item-provider/i-message-item-provider';
4
4
  export type { IPortalAsyncAction } from './i-portal-async-action/i-portal-async-action';
5
5
  export type { IChatToolbarItem } from './i-chat-toolbar-item/i-chat-toolbar-item';
6
- export type { ITopic, ITopicOptions } from './i-topic-options/i-topic-options';
6
+ export type { ITopic, ITopicOptions, IScopeItem, IGroupItem, ITopicGroupNode, } from './i-topic-options/i-topic-options';
7
7
  export type { IContainerOptions } from './i-container-options/i-container-options';
8
8
  export type { IChatThink } from './i-chat-think/i-chat-think';
9
9
  export type { IMaterial } from './i-material/i-material';
@@ -13,6 +13,7 @@ export type { IChatSuggestion } from './i-chat-suggestion/i-chat-suggestion';
13
13
  export type { IChatToolCall } from './i-chat-tool-call/i-chat-tool-call';
14
14
  export type { IAIAgent, IAIAgentConfig, IAIKnowledgeBase, } from './i-ai-agent/i-ai-agent';
15
15
  export type { IResourceOptions } from './i-resource-options/i-resource-options';
16
+ export type { IConfigService } from './i-config-service/i-config-service';
16
17
  export type { IRemoteSession, IRemoteMessage, } from './i-remote-resource/i-remote-resource';
17
18
  export type { IChatStep } from './i-chat-step/i-chat-step';
18
19
  export type { IChatUIAction } from './i-chat-uiaction/i-chat-uiaction';
@@ -23,4 +24,5 @@ export type { IChatController } from './i-chat-controller/i-chat-controller';
23
24
  export type { IAIQuesitionItem, IAIQuesition, IAIQuesitionAnswer, } from './i-ai-quesition/i-ai-quesition';
24
25
  export type { IExtensionOptions } from './i-extension-options/i-extension-options';
25
26
  export type { ISpeechRecognition } from './i-speech-recognition/i-speech-recognition';
27
+ export type { IProject } from './i-project/i-project';
26
28
  export * from './deep-research';
@@ -4,7 +4,7 @@ export declare const EN: {
4
4
  automatic: string;
5
5
  customize: string;
6
6
  default: string;
7
- recallSettings: string;
7
+ settings: string;
8
8
  chunkRerank: string;
9
9
  chunkPageIndex: string;
10
10
  maxChunks: string;
@@ -84,9 +84,27 @@ export declare const EN: {
84
84
  searchTopics: string;
85
85
  noTopic: string;
86
86
  clearSession: string;
87
+ clearSessionConfirmTip: string;
88
+ clearSessionWithGroupConfirmTip: string;
89
+ deleteConversation: string;
90
+ deleteConversationConfirmTip: string;
91
+ batchDeleteConversation: string;
92
+ batchDeleteSession: string;
93
+ batchDeleteConversationConfirmTip: string;
87
94
  multiSelect: string;
88
95
  selectedCount: string;
89
96
  cancelMultiSelect: string;
97
+ unclassifiedTopic: string;
98
+ newGroup: string;
99
+ deleteGroup: string;
100
+ deleteGroupConfirmTip: string;
101
+ deleteScope: string;
102
+ deleteScopeConfirmTip: string;
103
+ selectScope: string;
104
+ selectScopePlaceholder: string;
105
+ selectScopeTip: string;
106
+ searchScopePlaceholder: string;
107
+ confirm: string;
90
108
  temporarySession: string;
91
109
  like: string;
92
110
  downvote: string;
@@ -132,4 +150,5 @@ export declare const EN: {
132
150
  deepResearchReport: string;
133
151
  noTextReportContent: string;
134
152
  chatInputPlaceholder: string;
153
+ projectPlaceholder: string;
135
154
  };
@@ -4,7 +4,7 @@ export declare const ZH_CN: {
4
4
  automatic: string;
5
5
  customize: string;
6
6
  default: string;
7
- recallSettings: string;
7
+ settings: string;
8
8
  chunkRerank: string;
9
9
  chunkPageIndex: string;
10
10
  maxChunks: string;
@@ -84,9 +84,27 @@ export declare const ZH_CN: {
84
84
  searchTopics: string;
85
85
  noTopic: string;
86
86
  clearSession: string;
87
+ clearSessionConfirmTip: string;
88
+ clearSessionWithGroupConfirmTip: string;
89
+ deleteConversation: string;
90
+ deleteConversationConfirmTip: string;
91
+ batchDeleteConversation: string;
92
+ batchDeleteSession: string;
93
+ batchDeleteConversationConfirmTip: string;
87
94
  multiSelect: string;
88
95
  selectedCount: string;
89
96
  cancelMultiSelect: string;
97
+ unclassifiedTopic: string;
98
+ newGroup: string;
99
+ deleteGroup: string;
100
+ deleteGroupConfirmTip: string;
101
+ deleteScope: string;
102
+ deleteScopeConfirmTip: string;
103
+ selectScope: string;
104
+ selectScopePlaceholder: string;
105
+ selectScopeTip: string;
106
+ searchScopePlaceholder: string;
107
+ confirm: string;
90
108
  temporarySession: string;
91
109
  like: string;
92
110
  downvote: string;
@@ -132,4 +150,5 @@ export declare const ZH_CN: {
132
150
  deepResearchReport: string;
133
151
  noTextReportContent: string;
134
152
  chatInputPlaceholder: string;
153
+ projectPlaceholder: string;
135
154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.112",
3
+ "version": "0.0.114",
4
4
  "description": "iBiz AI交互框插件",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",