@ibiz-template-plugin/ai-chat 0.0.113 → 0.0.115

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 (37) hide show
  1. package/dist/index.es.js +9014 -7961
  2. package/dist/index.legacy.js +1 -1
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/chat-action-panel/chat-action-panel.d.ts +19 -0
  5. package/dist/types/components/chat-container/chat-container.d.ts +81 -4
  6. package/dist/types/components/chat-editor/node/mention-node.d.ts +3 -0
  7. package/dist/types/components/chat-messages/chat-messages.d.ts +2 -1
  8. package/dist/types/components/chat-messages/use-virtual-list.d.ts +31 -0
  9. package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +7 -0
  10. package/dist/types/components/chat-scrollbar/chat-scrollbar.d.ts +102 -0
  11. package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +16 -0
  12. package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +59 -0
  13. package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +26 -1
  14. package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +39 -0
  15. package/dist/types/components/index.d.ts +1 -0
  16. package/dist/types/constants/index.d.ts +8 -0
  17. package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +102 -0
  18. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +34 -11
  19. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +13 -3
  20. package/dist/types/controller/chat/chat-base.controller.d.ts +7 -0
  21. package/dist/types/controller/index.d.ts +1 -0
  22. package/dist/types/entity/ai-agent/ai-agent.d.ts +1 -0
  23. package/dist/types/icons/arrow-down.d.ts +3 -1
  24. package/dist/types/icons/index.d.ts +2 -1
  25. package/dist/types/icons/project-svg.d.ts +1 -0
  26. package/dist/types/icons/workspace-svg.d.ts +1 -0
  27. package/dist/types/index.d.ts +1 -1
  28. package/dist/types/interface/i-action-panel/i-action-panel.d.ts +24 -0
  29. package/dist/types/interface/i-ai-agent/i-ai-agent.d.ts +6 -0
  30. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +30 -3
  31. package/dist/types/interface/i-project/i-project.d.ts +26 -0
  32. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +6 -0
  33. package/dist/types/interface/index.d.ts +2 -1
  34. package/dist/types/locale/en/index.d.ts +9 -1
  35. package/dist/types/locale/zh-CN/index.d.ts +9 -1
  36. package/package.json +1 -1
  37. package/dist/types/icons/solid-down-svg.d.ts +0 -1
@@ -1,8 +1,9 @@
1
1
  import { Signal } from '@preact/signals';
2
2
  import { QXEvent } from 'qx-util';
3
3
  import { AIAgent, ChatMessage, KnowledgeBase } from '../../entity';
4
- import { ITopic, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, IChatSuggestion, IResourceOptions, IChatMessageUsage, ITopicOptions } from '../../interface';
4
+ import { ITopic, IProject, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, IProjectParams, IChatSuggestion, IResourceOptions, IChatMessageUsage, ITopicOptions } from '../../interface';
5
5
  import { AiTopicController } from '../ai-topic/ai-topic.controller';
6
+ import { AiActionPanelController } from '../ai-action-panel/ai-action-panel.controller';
6
7
 
7
8
  /**
8
9
  * 聊天逻辑控制器
@@ -107,6 +108,10 @@ export declare class AiChatController {
107
108
  * @type {Signal<boolean>}
108
109
  */
109
110
  readonly enableRecallConfigSetting: Signal<boolean>;
111
+ /**
112
+ * 是否显示项目选择组件(当前激活智能体的 flow_mode 为 SKILL 时才显示)
113
+ */
114
+ readonly enableChatProject: Signal<boolean>;
110
115
  /**
111
116
  * 是否允许切换AI代理
112
117
  */
@@ -167,6 +172,10 @@ export declare class AiChatController {
167
172
  * 话题控制器
168
173
  */
169
174
  readonly aiTopic: AiTopicController | undefined;
175
+ /**
176
+ * 操作区面板控制器(容器级单例,由聊天总控制器注入)
177
+ */
178
+ readonly actionPanel: AiActionPanelController | undefined;
170
179
  /**
171
180
  * @description 聊天sessionid
172
181
  * @type {string}
@@ -200,7 +209,7 @@ export declare class AiChatController {
200
209
  /**
201
210
  * 选中项目
202
211
  */
203
- selectionProject: string | undefined;
212
+ activeAIProjectId: string | undefined;
204
213
  /**
205
214
  * 当前可选知识库
206
215
  */
@@ -286,6 +295,10 @@ export declare class AiChatController {
286
295
  * 初始化AI知识库
287
296
  */
288
297
  private initAIChatKnowledge;
298
+ /**
299
+ * 计算项目选择组件是否显示(当前激活智能体的 flow_mode 为 SKILL 时才显示)
300
+ */
301
+ private computeEnableChatProject;
289
302
  /**
290
303
  * 计算选中知识库
291
304
  */
@@ -345,7 +358,16 @@ export declare class AiChatController {
345
358
  */
346
359
  loadHistoryMore(): Promise<void>;
347
360
  /**
348
- * 获取历史记录后续处理
361
+ * @description 尝试恢复会话(如果会话存在异步行为标识才恢复,没有则认为会话已经完成,不需要恢复)
362
+ * @author tony001
363
+ * @date 2026-10-14 18:10:07
364
+ * @private
365
+ * @returns {*} {Promise<void>}
366
+ * @memberof AiChatController
367
+ */
368
+ private tryResumeChat;
369
+ /**
370
+ * 获取历史记录后续处理(仅查询history接口时调用)
349
371
  */
350
372
  private afterFecthHistory;
351
373
  /**
@@ -614,16 +636,17 @@ export declare class AiChatController {
614
636
  searchAIAgent(query: string): Promise<AIAgent[]>;
615
637
  /**
616
638
  * @description 搜索项目
617
- * @param {string} [file_path='']
618
- * @param {string} [pattern='']
619
- * @returns {*} {Promise<{ id: string; label: string; isLeaf: boolean }[]>}
639
+ * @param {IProjectParams} params 查询参数
640
+ * @returns {*} {Promise<IProject[]>}
620
641
  * @memberof AiChatController
621
642
  */
622
- searchProject(file_path?: string, pattern?: string): Promise<{
623
- id: string;
624
- label: string;
625
- isLeaf: boolean;
626
- }[]>;
643
+ searchProject(params: IProjectParams): Promise<IProject[]>;
644
+ /**
645
+ * @description 设置选中项目目录
646
+ * @param {(string | undefined)} id
647
+ * @memberof AiChatController
648
+ */
649
+ setActiveAIProjectID(id: string | undefined): void;
627
650
  /**
628
651
  * 设置选中知识库
629
652
  * @param ids
@@ -105,6 +105,12 @@ export declare class AiTopicController {
105
105
  * @memberof AiTopicController
106
106
  */
107
107
  workMode: 'DEFAULT' | 'WORKSPACE';
108
+ /**
109
+ * @description 是否禁用选择业务域(WORKSPACE 工作模式使用)
110
+ * @type {boolean}
111
+ * @memberof AiTopicController
112
+ */
113
+ disableSelectScope: boolean;
108
114
  /**
109
115
  * @description 业务域列表(WORKSPACE 工作模式使用)
110
116
  * @type {IScopeItem[]}
@@ -146,10 +152,14 @@ export declare class AiTopicController {
146
152
  */
147
153
  setActivedTopic(topic: ChatTopic | undefined): void;
148
154
  /**
149
- * 注入组件外层容器id
150
- * @param compWrapperId
155
+ * @description 注入基础资源
156
+ * @param {string} compWrapperId
157
+ * @param {('DEFAULT' | 'WORKSPACE')} workMode
158
+ * @param {boolean} [disableSelectScope]
159
+ * @param {IScopeItem[]} [scopeList]
160
+ * @memberof AiTopicController
151
161
  */
152
- injectBasicResources(compWrapperId: string, workMode: 'DEFAULT' | 'WORKSPACE', scopeList?: IScopeItem[]): void;
162
+ injectBasicResources(compWrapperId: string, workMode: 'DEFAULT' | 'WORKSPACE', disableSelectScope?: boolean, scopeList?: IScopeItem[]): void;
153
163
  /**
154
164
  * 注入资源选项
155
165
  * @param resourceOptions
@@ -2,6 +2,7 @@ import { ChatTopic } from '../../entity';
2
2
  import { IChatController, IContainerOptions, IResourceOptions } from '../../interface';
3
3
  import { AiChatController } from '../ai-chat/ai-chat.controller';
4
4
  import { AiTopicController } from '../ai-topic/ai-topic.controller';
5
+ import { AiActionPanelController } from '../ai-action-panel/ai-action-panel.controller';
5
6
 
6
7
  /**
7
8
  * @description 聊天总控制器基类
@@ -45,6 +46,12 @@ export declare abstract class ChatBaseController implements IChatController {
45
46
  * @memberof ChatBaseController
46
47
  */
47
48
  aiTopic: AiTopicController;
49
+ /**
50
+ * @description 操作区面板控制器(容器级单例,切话题不重建)
51
+ * @type {AiActionPanelController}
52
+ * @memberof ChatBaseController
53
+ */
54
+ actionPanel: AiActionPanelController;
48
55
  /**
49
56
  * @description 聊天控制器
50
57
  * @author tony001
@@ -1,5 +1,6 @@
1
1
  export { AiChatController } from './ai-chat/ai-chat.controller';
2
2
  export { AiTopicController } from './ai-topic/ai-topic.controller';
3
+ export { AiActionPanelController } from './ai-action-panel/ai-action-panel.controller';
3
4
  export { AIMaterialFactory } from './ai-material/ai-material-factory';
4
5
  export { ModalChatController, chat } from './chat/modal-chat.controller';
5
6
  export { FlatChatController, createFlatChat, } from './chat/flat-chat.controller';
@@ -20,6 +20,7 @@ export declare class AIAgent implements IAIAgent {
20
20
  get maxchunks(): number | undefined;
21
21
  get chunkthreshold(): number | undefined;
22
22
  get chunkpageindex(): 0 | 1 | undefined;
23
+ get flow_mode(): 'SKILL' | 'DEFAULT' | 'DE' | 'HUB' | 'SCRIPT' | undefined;
23
24
  constructor(agent: IAIAgent, defaultConfig: {
24
25
  chunkrerank: 0 | 1 | 2;
25
26
  maxchunks?: number;
@@ -1 +1,3 @@
1
- export declare const ArrowDown: () => import("preact").JSX.Element;
1
+ export declare const ArrowDown: (props?: {
2
+ className?: string;
3
+ }) => import("preact").JSX.Element;
@@ -53,4 +53,5 @@ export { ToolCallCountSvg } from './statistics/tool-call-count-svg';
53
53
  export { ListCheckBoxSvg } from './list-checkbox-svg';
54
54
  export { UnTopSvg } from './untop-svg';
55
55
  export { PlusSvg } from './plus-svg';
56
- export { SolidDownSvg } from './solid-down-svg';
56
+ export { ProjectSvg } from './project-svg';
57
+ export { WorlSpaceSvg } from './workspace-svg';
@@ -0,0 +1 @@
1
+ export declare const ProjectSvg: () => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const WorlSpaceSvg: () => import("preact").JSX.Element;
@@ -1,4 +1,4 @@
1
1
 
2
2
  export { ChatContainer, FlatChatContainer } from './components';
3
3
  export { chat, createFlatChat } from './controller';
4
- export type { IChatToolbarItem } from './interface';
4
+ export type { IChatToolbarItem, IActionPanelContentProps, TActionPanelComponent, } from './interface';
@@ -0,0 +1,24 @@
1
+ import { ComponentType } from 'preact';
2
+
3
+ /**
4
+ * 操作区内容组件props约定
5
+ *
6
+ * @export
7
+ * @interface IActionPanelContentProps
8
+ */
9
+ export interface IActionPanelContentProps {
10
+ /**
11
+ * 关闭当前操作区面板(内容组件自关闭能力)
12
+ */
13
+ closePanel: () => void;
14
+ /**
15
+ * 额外参数(openActionPanel 第三参原样展开传入)
16
+ */
17
+ [key: string]: any;
18
+ }
19
+ /**
20
+ * 操作区内容组件类型
21
+ * - 内容组件 props 为 IActionPanelContentProps(closePanel + 额外参数展开),
22
+ * 但具体组件可能声明自己的必传 props,故放宽为 any 以兼容
23
+ */
24
+ export type TActionPanelComponent = ComponentType<any>;
@@ -75,4 +75,10 @@ export interface IAIAgent {
75
75
  * 页面目录召回
76
76
  */
77
77
  chunkpageindex?: 0 | 1;
78
+ /**
79
+ * @description 智能体模式
80
+ * @type {('SKILL' | 'DEFAULT' | 'DE' | 'HUB' | 'SCRIPT')} 可执行SKILL模式 | 简单Prompt模式 | 工作流模式 | 分角色总线模式 | 脚本代码模式
81
+ * @memberof IAIAgent
82
+ */
83
+ flow_mode?: 'SKILL' | 'DEFAULT' | 'DE' | 'HUB' | 'SCRIPT';
78
84
  }
@@ -1,4 +1,5 @@
1
1
  import { AiChatController, AiTopicController } from '../../controller';
2
+ import { AiActionPanelController } from '../../controller/ai-action-panel/ai-action-panel.controller';
2
3
  import { IAIAgent, IAIAgentConfig } from '../i-ai-agent/i-ai-agent';
3
4
  import { IChatMessage } from '../i-chat-message/i-chat-message';
4
5
  import { IChatToolbarItem } from '../i-chat-toolbar-item/i-chat-toolbar-item';
@@ -148,6 +149,10 @@ export interface IChat {
148
149
  * 选中知识库ID
149
150
  */
150
151
  selectAIKnowledgeBaseId?: string;
152
+ /**
153
+ * 选中项目目录ID
154
+ */
155
+ selectAIProjectId?: string;
151
156
  /**
152
157
  * 模式参数,用于业务区分
153
158
  */
@@ -156,6 +161,10 @@ export interface IChat {
156
161
  * 作用域参数
157
162
  */
158
163
  srfScope?: string;
164
+ /**
165
+ * @description 当前会话最近一次交谈异步任务id
166
+ */
167
+ activeAsyncAcitonID?: string;
159
168
  /**
160
169
  * map参数
161
170
  */
@@ -211,6 +220,12 @@ export interface IChatOptions extends IChat {
211
220
  * @type {AiTopicController}
212
221
  */
213
222
  aiTopic?: AiTopicController;
223
+ /**
224
+ * 操作区面板控制器(容器级单例,由聊天总控制器注入)
225
+ *
226
+ * @type {AiActionPanelController}
227
+ */
228
+ actionPanel?: AiActionPanelController;
214
229
  /**
215
230
  * 摘要最大长度
216
231
  *
@@ -314,7 +329,18 @@ export interface IChatOptions extends IChat {
314
329
  * @param {IChatMessage[]} question 提问历史内容(包含当前提问)
315
330
  * @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
316
331
  */
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>;
332
+ question(aiChat: AiChatController, context: object, params: object, otherParams: object, messages: 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>;
333
+ /**
334
+ * @description 恢复会话
335
+ * @param {AiChatController} aiChat
336
+ * @param {object} context
337
+ * @param {object} params
338
+ * @param {object} otherParams
339
+ * @param {IChatMessage[]} messages
340
+ * @returns {*} {Promise<boolean>}
341
+ * @memberof IChatOptions
342
+ */
343
+ resumeQuestion(aiChat: AiChatController, context: object, params: object, otherParams: object, messages: IChatMessage[]): Promise<boolean>;
318
344
  /**
319
345
  * 中断消息
320
346
  * @param aiChat
@@ -401,9 +427,10 @@ export interface IChatOptions extends IChat {
401
427
  fetchProject?: (context: object, params: object, other: {
402
428
  srfaiagent: string;
403
429
  sessionid: string;
404
- pattern: string;
405
- file_path: string;
406
430
  max_depth: number;
431
+ pattern?: string;
432
+ file_path?: string;
433
+ only_dirs?: boolean;
407
434
  }) => Promise<IProject[]>;
408
435
  /**
409
436
  * 文件上传配置
@@ -12,3 +12,29 @@ export interface IProject {
12
12
  */
13
13
  children?: IProject[];
14
14
  }
15
+ export interface IProjectParams {
16
+ /**
17
+ * @description 文件路径
18
+ * @type {string}
19
+ * @memberof IProjectParams
20
+ */
21
+ file_path?: string;
22
+ /**
23
+ * @description 匹配
24
+ * @type {string}
25
+ * @memberof IProjectParams
26
+ */
27
+ pattern?: string;
28
+ /**
29
+ * @description 最大层级
30
+ * @type {number}
31
+ * @memberof IProjectParams
32
+ */
33
+ max_depth: number;
34
+ /**
35
+ * @description 是否只查询目录
36
+ * @type {boolean}
37
+ * @memberof IProjectParams
38
+ */
39
+ only_dirs?: boolean;
40
+ }
@@ -227,6 +227,12 @@ export interface ITopicOptions extends ITopic {
227
227
  * 工作模式,默认值,会话数据以列表显示; WORKSPACE:工作区,会话数据分为域(scope)、会话分组分层显示
228
228
  */
229
229
  workMode?: 'DEFAULT' | 'WORKSPACE';
230
+ /**
231
+ * @description 禁用选择业务域,仅WORKSPACE模式下生效,默认不禁用
232
+ * @type {boolean}
233
+ * @memberof ITopicOptions
234
+ */
235
+ disableSelectScope?: boolean;
230
236
  /**
231
237
  * @description 域列表,当工作模式为WORKSPACE时必填
232
238
  * @type {IScopeItem[]}
@@ -23,6 +23,7 @@ export type { IChatMessageUsage } from './i-chat-message-usage/i-chat-message-us
23
23
  export type { IChatController } from './i-chat-controller/i-chat-controller';
24
24
  export type { IAIQuesitionItem, IAIQuesition, IAIQuesitionAnswer, } from './i-ai-quesition/i-ai-quesition';
25
25
  export type { IExtensionOptions } from './i-extension-options/i-extension-options';
26
+ export type { IActionPanelContentProps, TActionPanelComponent, } from './i-action-panel/i-action-panel';
26
27
  export type { ISpeechRecognition } from './i-speech-recognition/i-speech-recognition';
27
- export type { IProject } from './i-project/i-project';
28
+ export type { IProject, IProjectParams } from './i-project/i-project';
28
29
  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;
@@ -151,4 +151,12 @@ export declare const EN: {
151
151
  noTextReportContent: string;
152
152
  chatInputPlaceholder: string;
153
153
  projectPlaceholder: string;
154
+ workSpace: string;
155
+ listMode: string;
156
+ treeMode: string;
157
+ rootDirectory: string;
158
+ fileName: string;
159
+ size: string;
160
+ type: string;
161
+ folder: string;
154
162
  };
@@ -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;
@@ -151,4 +151,12 @@ export declare const ZH_CN: {
151
151
  noTextReportContent: string;
152
152
  chatInputPlaceholder: string;
153
153
  projectPlaceholder: string;
154
+ workSpace: string;
155
+ listMode: string;
156
+ treeMode: string;
157
+ rootDirectory: string;
158
+ fileName: string;
159
+ size: string;
160
+ type: string;
161
+ folder: string;
154
162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.113",
3
+ "version": "0.0.115",
4
4
  "description": "iBiz AI交互框插件",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
@@ -1 +0,0 @@
1
- export declare const SolidDownSvg: () => import("preact").JSX.Element;