@ibiz-template-plugin/ai-chat 0.0.120 → 0.0.121

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.
@@ -5,14 +5,6 @@ export interface ChatTopicItemProps {
5
5
  hasMoreThanOne: boolean;
6
6
  controller: AiTopicController;
7
7
  topic: ChatTopic;
8
- /**
9
- * 是否处于多选模式
10
- */
11
- isSelectMode?: boolean;
12
- /**
13
- * 多选模式下是否被选中
14
- */
15
- isSelected?: boolean;
16
8
  onClick: () => void;
17
9
  onAction: (action: string, event: MouseEvent) => void;
18
10
  }
@@ -0,0 +1,21 @@
1
+ import { AiTopicController } from '../../../../controller';
2
+
3
+ export interface BatchModeTopicProps {
4
+ /**
5
+ * 话题控制器
6
+ *
7
+ * @author tony001
8
+ * @date 2025-02-20 17:02:49
9
+ * @type {AiTopicController}
10
+ */
11
+ controller: AiTopicController;
12
+ /**
13
+ * 进入多选模式时默认选中的话题id
14
+ */
15
+ defaultSelectedTopicId?: string;
16
+ /**
17
+ * 抽屉关闭回调(由 Drawer 自动注入)
18
+ */
19
+ onClose?: () => void;
20
+ }
21
+ export declare const BatchModeTopic: (props: BatchModeTopicProps) => import("preact").JSX.Element;
@@ -73,7 +73,32 @@ export declare enum AIGroupChatConst {
73
73
  */
74
74
  NONE_SCOPE_ID = "__NONE__",
75
75
  /**
76
- * 无分类虚拟节点标识(与 AiTopicController.computeGroupTree 约定一致)
76
+ * 无分类虚拟节点标识(与 AiTopicController.computeWorkSpaceTree 约定一致)
77
77
  */
78
- NONE_SCOPE_KEY = "scope:__NONE__"
78
+ NONE_SCOPE_KEY = "scope:__NONE__",
79
+ /**
80
+ * 无分类虚拟分组节点标识(默认模式,与 AiTopicController.computeGroupTree 约定一致)
81
+ */
82
+ NONE_GROUP_KEY = "group:__NONE__"
83
+ }
84
+ /**
85
+ * @description 话题数据存储类型常量(configService 的 storageType 参数)
86
+ */
87
+ export declare enum AIChatStorageType {
88
+ /**
89
+ * 会话数据
90
+ */
91
+ TOPICS = "aitopics",
92
+ /**
93
+ * 自定义分组(WORKSPACE 工作模式)
94
+ */
95
+ GROUPS = "aigroups",
96
+ /**
97
+ * 分组(默认工作模式)
98
+ */
99
+ BASIC_GROUPS = "basicgroups",
100
+ /**
101
+ * 业务域(WORKSPACE 工作模式)
102
+ */
103
+ SCOPES = "aiscopes"
79
104
  }
@@ -1,6 +1,6 @@
1
1
  import { Signal } from '@preact/signals';
2
2
  import { ChatTopic } from '../../entity';
3
- import { ITopic, ITopicOptions, IResourceOptions, IChatController, IGroupItem, IScopeOption, IScopeItem, ITopicGroupNode } from '../../interface';
3
+ import { ITopic, ITopicOptions, IResourceOptions, IChatController, IGroupItem, IScopeOption, IScopeItem, ITopicGroupNode, IBasicGroupItem, IBasicTopicGroupNode } from '../../interface';
4
4
  import { AiChatController } from '../ai-chat/ai-chat.controller';
5
5
 
6
6
  /**
@@ -111,6 +111,12 @@ export declare class AiTopicController {
111
111
  * @memberof AiTopicController
112
112
  */
113
113
  disableSelectScope: boolean;
114
+ /**
115
+ * @description 是否启用基础分组
116
+ * @type {boolean}
117
+ * @memberof AiTopicController
118
+ */
119
+ enableBasicGroup: boolean;
114
120
  /**
115
121
  * @description 业务域列表(WORKSPACE 工作模式使用)
116
122
  * @type {IScopeOption[]}
@@ -129,6 +135,12 @@ export declare class AiTopicController {
129
135
  * @memberof AiTopicController
130
136
  */
131
137
  readonly scopes: Signal<IScopeItem[]>;
138
+ /**
139
+ * @description 用户自定义分组清单(默认工作模式,存储于 'basicgroups')
140
+ * @type {Signal<IBasicGroupItem[]>}
141
+ * @memberof AiTopicController
142
+ */
143
+ readonly basicGroups: Signal<IBasicGroupItem[]>;
132
144
  /**
133
145
  * @description 分组存储服务实例('aigroups',与会话数据 'aitopics' 区分)
134
146
  * @private
@@ -170,9 +182,10 @@ export declare class AiTopicController {
170
182
  * @param {('DEFAULT' | 'WORKSPACE')} workMode
171
183
  * @param {boolean} [disableSelectScope]
172
184
  * @param {IScopeOption[]} [scopeList]
185
+ * @param {boolean} [enableBasicGroup]
173
186
  * @memberof AiTopicController
174
187
  */
175
- injectBasicResources(compWrapperId: string, workMode: 'DEFAULT' | 'WORKSPACE', disableSelectScope?: boolean, scopeList?: IScopeOption[]): void;
188
+ injectBasicResources(compWrapperId: string, workMode: 'DEFAULT' | 'WORKSPACE', disableSelectScope?: boolean, scopeList?: IScopeOption[], enableBasicGroup?: boolean): void;
176
189
  /**
177
190
  * 注入资源选项
178
191
  * @param resourceOptions
@@ -277,6 +290,7 @@ export declare class AiTopicController {
277
290
  newTopic(topicid: string, args: Record<string, any>, extra?: {
278
291
  scope?: string | number;
279
292
  groupid?: string;
293
+ base_groupid?: string;
280
294
  }): Promise<void>;
281
295
  /**
282
296
  * 清空话题
@@ -361,8 +375,10 @@ export declare class AiTopicController {
361
375
  switchTopicSidebarCollapse(): void;
362
376
  /**
363
377
  * 全局新建会话
378
+ * - WORKSPACE 模式:scope 为业务域标识,groupid 为自定义分组标识
379
+ * - 默认模式:groupid 为自定义分组标识(写入 base_groupid),不传落入无分类会话
364
380
  * @param scope 业务域标识(WORKSPACE 工作模式)
365
- * @param groupid 自定义分组标识(WORKSPACE 工作模式)
381
+ * @param groupid 自定义分组标识
366
382
  * @returns
367
383
  */
368
384
  globalNewTopic(scope?: string | number, groupid?: string): void;
@@ -430,7 +446,7 @@ export declare class AiTopicController {
430
446
  */
431
447
  private deleteTopicsCore;
432
448
  /**
433
- * @description 获取分组存储服务实例('aigroups',与会话数据 'aitopics' 区分)
449
+ * @description 获取分组存储服务实例(WORKSPACE 模式 'aigroups',默认模式 'basicgroups',与会话数据 'aitopics' 区分)
434
450
  * @private
435
451
  * @param {ITopicOptions} options 话题配置
436
452
  * @returns {*} {IConfigService}
@@ -438,14 +454,14 @@ export declare class AiTopicController {
438
454
  */
439
455
  private getGroupConfig;
440
456
  /**
441
- * @description 加载用户自定义分组数据
457
+ * @description 加载分组数据(WORKSPACE 模式赋值 groups,默认模式赋值 basicGroups)
442
458
  * @param {ITopicOptions} options 话题配置
443
459
  * @returns {*} {Promise<void>}
444
460
  * @memberof AiTopicController
445
461
  */
446
462
  fetchGroups(options: ITopicOptions): Promise<void>;
447
463
  /**
448
- * @description 保存用户自定义分组数据
464
+ * @description 保存分组数据(WORKSPACE 模式存 groups,默认模式存 basicGroups)
449
465
  * @returns {*} {Promise<void>}
450
466
  * @memberof AiTopicController
451
467
  */
@@ -485,7 +501,15 @@ export declare class AiTopicController {
485
501
  * @returns {*} {ITopicGroupNode[]}
486
502
  * @memberof AiTopicController
487
503
  */
488
- computeGroupTree(query?: string): ITopicGroupNode[];
504
+ computeWorkSpaceTree(query?: string): ITopicGroupNode[];
505
+ /**
506
+ * @description 计算默认工作模式分组树:第一层分组('basicgroups'),第二层会话(base_groupid 匹配归属),
507
+ * 未匹配分组(含悬挂 base_groupid)的会话放入无分类虚拟节点
508
+ * @param {string} [query] 快速搜索值,仅匹配会话标题;搜索态下无匹配会话的分组不显示
509
+ * @returns {*} {IBasicTopicGroupNode[]}
510
+ * @memberof AiTopicController
511
+ */
512
+ computeGroupTree(query?: string): IBasicTopicGroupNode[];
489
513
  /**
490
514
  * @description 判断话题是否属于无分类(无scope、scope为空或scope不在scopeList中)
491
515
  * @private
@@ -560,6 +584,50 @@ export declare class AiTopicController {
560
584
  * @memberof AiTopicController
561
585
  */
562
586
  removeGroup(groupid: string): Promise<boolean>;
587
+ /**
588
+ * @description 新增默认工作模式分组
589
+ * @param {string} [text] 分组名称,不传使用国际化默认名
590
+ * @returns {*} {Promise<IBasicGroupItem | undefined>} 成功返回新建分组数据,持久化失败返回undefined
591
+ * @memberof AiTopicController
592
+ */
593
+ addBasicGroup(text?: string): Promise<IBasicGroupItem | undefined>;
594
+ /**
595
+ * @description 重命名默认工作模式分组
596
+ * @param {string} groupid 分组标识
597
+ * @param {string} text 新分组名称
598
+ * @returns {*} {Promise<IBasicGroupItem | undefined>} 成功返回更新后的分组数据,分组不存在、名称为空、未变化或持久化失败返回undefined
599
+ * @memberof AiTopicController
600
+ */
601
+ renameBasicGroup(groupid: string, text: string): Promise<IBasicGroupItem | undefined>;
602
+ /**
603
+ * @description 切换默认工作模式分组折叠状态(持久化)
604
+ * @param {string} groupid 分组标识
605
+ * @returns {*} {Promise<void>}
606
+ * @memberof AiTopicController
607
+ */
608
+ toggleBasicGroupCollapse(groupid: string): Promise<void>;
609
+ /**
610
+ * @description 切换默认工作模式分组置顶状态(持久化)
611
+ * @param {string} groupid 分组标识
612
+ * @returns {*} {Promise<void>}
613
+ * @memberof AiTopicController
614
+ */
615
+ toggleBasicGroupTop(groupid: string): Promise<void>;
616
+ /**
617
+ * @description 删除默认工作模式分组:真删该分组下所有会话数据
618
+ * @param {string} groupid 分组标识
619
+ * @returns {*} {Promise<boolean>} 是否删除成功
620
+ * @memberof AiTopicController
621
+ */
622
+ removeBasicGroup(groupid: string): Promise<boolean>;
623
+ /**
624
+ * @description 移动话题至指定自定义分组(默认工作模式拖拽),并持久化;groupid不传表示拖到无分类节点清空归属
625
+ * @param {string} topicid 话题标识
626
+ * @param {string} [groupid] 目标自定义分组标识
627
+ * @returns {*} {Promise<boolean>} 是否移动成功(归属未变化视为成功)
628
+ * @memberof AiTopicController
629
+ */
630
+ moveBasicTopic(topicid: string, groupid?: string): Promise<boolean>;
563
631
  /**
564
632
  * @description 移动话题至指定业务域或自定义分组(拖拽),并持久化
565
633
  * @param {string} topicid 话题标识
@@ -28,5 +28,6 @@ export declare class ChatTopic implements ITopic {
28
28
  get scope(): ITopic['scope'];
29
29
  get groupid(): ITopic['groupid'];
30
30
  get context_code_name(): ITopic['context_code_name'];
31
+ get base_groupid(): ITopic['base_groupid'];
31
32
  constructor(data: ITopic);
32
33
  }
@@ -0,0 +1 @@
1
+ export declare const BackSvg: () => import("preact").JSX.Element;
@@ -58,3 +58,4 @@ export { WorlSpaceSvg } from './workspace-svg';
58
58
  export { NewFolderSvg, NewFileSvg } from './new-folder-svg';
59
59
  export { EyeSvg } from './eye-svg';
60
60
  export { MoveFileSvg, UploadFileSvg } from './move-file-svg';
61
+ export { BackSvg } from './back-svg';
@@ -244,6 +244,12 @@ export interface IChatOptions extends IChat {
244
244
  * @memberof IChatOptions
245
245
  */
246
246
  enableAIProject: boolean;
247
+ /**
248
+ * @description 项目选择占位提示
249
+ * @type {string}
250
+ * @memberof IChatOptions
251
+ */
252
+ projectSelectPlaceholder?: string;
247
253
  /**
248
254
  * 话题标题计算模式
249
255
  *
@@ -48,36 +48,50 @@ export interface IScopeItem {
48
48
  istop: boolean;
49
49
  }
50
50
  /**
51
- * 会话分组数据
51
+ * 会话分组数据(默认模式)
52
52
  *
53
53
  * @export
54
- * @interface IGroup
54
+ * @interface IGroupItem
55
55
  */
56
- export interface IGroupItem {
56
+ export interface IBasicGroupItem {
57
57
  /**
58
58
  * @description 值
59
59
  * @type {string}
60
- * @memberof IGroupItem
60
+ * @memberof IBasicGroupItem
61
61
  */
62
62
  id: string;
63
63
  /**
64
64
  * @description 文本
65
65
  * @type {string}
66
- * @memberof IGroupItem
66
+ * @memberof IBasicGroupItem
67
67
  */
68
68
  text: string;
69
69
  /**
70
- * @description 业务域标识
71
- * @type {(string | number)}
72
- * @memberof IGroupItem
70
+ * @description 是否折叠,缺省展开
71
+ * @type {boolean}
72
+ * @memberof IBasicGroupItem
73
73
  */
74
- scopeid: string | number;
74
+ collapsed?: boolean;
75
75
  /**
76
- * @description 是否折叠,缺省展开
76
+ * @description 是否置顶
77
77
  * @type {boolean}
78
+ * @memberof IBasicGroupItem
79
+ */
80
+ istop?: boolean;
81
+ }
82
+ /**
83
+ * 会话分组数据(WORKSPACE模式)
84
+ *
85
+ * @export
86
+ * @interface IGroupItem
87
+ */
88
+ export interface IGroupItem extends IBasicGroupItem {
89
+ /**
90
+ * @description 业务域标识
91
+ * @type {(string | number)}
78
92
  * @memberof IGroupItem
79
93
  */
80
- collapsed?: boolean;
94
+ scopeid: string | number;
81
95
  }
82
96
  /**
83
97
  * 分组树节点(WORKSPACE 工作模式)
@@ -124,6 +138,38 @@ export interface ITopicGroupNode {
124
138
  */
125
139
  ungroupedTopics: ITopic[];
126
140
  }
141
+ /**
142
+ * 分组树节点(DEFAULT 默认工作模式)
143
+ *
144
+ * @export
145
+ * @interface IBasicTopicGroupNode
146
+ */
147
+ export interface IBasicTopicGroupNode {
148
+ /**
149
+ * 节点标识,'group:<id>',无分类为 'group:__NONE__'
150
+ */
151
+ key: string;
152
+ /**
153
+ * 分组标识,无分类虚拟节点为 undefined
154
+ */
155
+ groupid: string | undefined;
156
+ /**
157
+ * 显示文本
158
+ */
159
+ text: string;
160
+ /**
161
+ * 是否折叠(透传分组存储值,虚拟节点为 undefined)
162
+ */
163
+ collapsed?: boolean;
164
+ /**
165
+ * 分组是否置顶
166
+ */
167
+ istop: boolean;
168
+ /**
169
+ * 分组内会话(已排序:置顶优先、sequence 降序)
170
+ */
171
+ topics: ITopic[];
172
+ }
127
173
  /**
128
174
  * 话题数据
129
175
  *
@@ -217,17 +263,23 @@ export interface ITopic {
217
263
  */
218
264
  isShow?: boolean;
219
265
  /**
220
- * @description 所属业务域标识
266
+ * @description 所属业务域标识(WORKSPACE模式下识别)
221
267
  * @type {(string | number)}
222
268
  * @memberof ITopic
223
269
  */
224
270
  scope?: string | number;
225
271
  /**
226
- * @description 所属自定义分组标识
272
+ * @description 所属自定义分组标识(WORKSPACE模式下识别)
227
273
  * @type {string}
228
274
  * @memberof ITopic
229
275
  */
230
276
  groupid?: string;
277
+ /**
278
+ * @description 所属自定义分组标识(默认模式下识别)
279
+ * @type {string}
280
+ * @memberof ITopic
281
+ */
282
+ base_groupid?: string;
231
283
  /**
232
284
  * @description 绑定智能体标识
233
285
  * @type {string}
@@ -278,6 +330,18 @@ export interface ITopicOptions extends ITopic {
278
330
  * @memberof ITopicOptions
279
331
  */
280
332
  disableSelectScope?: boolean;
333
+ /**
334
+ * @description 是否启用基础分组(默认模式),默认启用,关闭后话题侧栏回退平铺列表展示
335
+ * @type {boolean}
336
+ * @memberof ITopicOptions
337
+ */
338
+ enableBasicGroup?: boolean;
339
+ /**
340
+ * @description AI聊天框新建话题附加参数(智能体、知识库、工作目录等参数)模式,可选值:DEFAULT、ACTIVATED,DEFAULT表示新建会话附加打开AI聊天框时传入的参数、ACTIVATED表示新建会话附加AI聊天框当前激活会话的参数,默认值为ACTIVATED
341
+ * @type {('DEFAULT' | 'ACTIVATED')}
342
+ * @memberof ITopicOptions
343
+ */
344
+ newTopicParamMode: 'DEFAULT' | 'ACTIVATED';
281
345
  /**
282
346
  * @description 域列表,当工作模式为WORKSPACE时必填
283
347
  * @type {IScopeOption[]}
@@ -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, IScopeOption, IScopeItem, IGroupItem, ITopicGroupNode, } from './i-topic-options/i-topic-options';
6
+ export type { ITopic, ITopicOptions, IScopeOption, IScopeItem, IGroupItem, ITopicGroupNode, IBasicGroupItem, IBasicTopicGroupNode, } 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';
@@ -180,5 +180,6 @@ export declare const EN: {
180
180
  uploadFile: string;
181
181
  fileContent: string;
182
182
  clear: string;
183
+ backPrevious: string;
183
184
  fileExists: string;
184
185
  };
@@ -180,5 +180,6 @@ export declare const ZH_CN: {
180
180
  uploadFile: string;
181
181
  fileContent: string;
182
182
  clear: string;
183
+ backPrevious: string;
183
184
  fileExists: string;
184
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.120",
3
+ "version": "0.0.121",
4
4
  "description": "iBiz AI交互框插件",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
@@ -29,7 +29,7 @@
29
29
  "publish:local": "npm run build && npm publish --access public --registry=http://172.16.240.221:8081/repository/local/"
30
30
  },
31
31
  "dependencies": {
32
- "@ibiz-template-plugin/ibiz-file-previewer": "^0.0.27",
32
+ "@ibiz-template-plugin/ibiz-file-previewer": "^0.0.28",
33
33
  "@ibiz-template/scss-utils": "^0.0.2",
34
34
  "@preact/signals": "^1.2.1",
35
35
  "@tiptap/core": "^3.11.1",