@ibiz-template-plugin/ai-chat 0.0.114 → 0.0.116
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/index.es.js +23284 -8717
- package/dist/index.legacy.js +28 -1
- package/dist/polyfills.legacy.js +2 -2
- package/dist/style.css +26 -1
- package/dist/types/components/chat-action-panel/chat-action-panel.d.ts +19 -0
- package/dist/types/components/chat-container/chat-container.d.ts +89 -5
- package/dist/types/components/chat-editor/node/mention-node.d.ts +3 -0
- package/dist/types/components/chat-file-preview/chat-file-preview.d.ts +18 -0
- package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +7 -0
- package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +23 -0
- package/dist/types/components/common/drawer/drawer.d.ts +28 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +69 -0
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +32 -1
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +40 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/constants/index.d.ts +8 -0
- package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +119 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +44 -15
- package/dist/types/controller/chat/chat-base.controller.d.ts +7 -0
- package/dist/types/controller/file-system/file-system.controller.d.ts +85 -0
- package/dist/types/controller/index.d.ts +3 -0
- package/dist/types/controller/overlay/drawer-overlay.controller.d.ts +34 -0
- package/dist/types/controller/overlay/index.d.ts +1 -0
- package/dist/types/controller/overlay/overlay.controller.d.ts +61 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/icons/project-svg.d.ts +1 -0
- package/dist/types/icons/workspace-svg.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interface/i-action-panel/i-action-panel.d.ts +24 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +31 -11
- package/dist/types/interface/i-file-item/i-file-item.d.ts +67 -0
- package/dist/types/interface/i-file-system-options/i-file-system-options.d.ts +61 -0
- package/dist/types/interface/index.d.ts +3 -1
- package/dist/types/locale/en/index.d.ts +8 -0
- package/dist/types/locale/zh-CN/index.d.ts +8 -0
- package/package.json +2 -1
- package/dist/types/interface/i-project/i-project.d.ts +0 -14
|
@@ -3,6 +3,8 @@ import { QXEvent } from 'qx-util';
|
|
|
3
3
|
import { AIAgent, ChatMessage, KnowledgeBase } from '../../entity';
|
|
4
4
|
import { ITopic, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, 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';
|
|
7
|
+
import { FileSystemController } from '../file-system/file-system.controller';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* 聊天逻辑控制器
|
|
@@ -171,6 +173,10 @@ export declare class AiChatController {
|
|
|
171
173
|
* 话题控制器
|
|
172
174
|
*/
|
|
173
175
|
readonly aiTopic: AiTopicController | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* 操作区面板控制器(容器级单例,由聊天总控制器注入)
|
|
178
|
+
*/
|
|
179
|
+
readonly actionPanel: AiActionPanelController | undefined;
|
|
174
180
|
/**
|
|
175
181
|
* @description 聊天sessionid
|
|
176
182
|
* @type {string}
|
|
@@ -204,7 +210,7 @@ export declare class AiChatController {
|
|
|
204
210
|
/**
|
|
205
211
|
* 选中项目
|
|
206
212
|
*/
|
|
207
|
-
|
|
213
|
+
activeAIProjectId: string | undefined;
|
|
208
214
|
/**
|
|
209
215
|
* 当前可选知识库
|
|
210
216
|
*/
|
|
@@ -227,6 +233,12 @@ export declare class AiChatController {
|
|
|
227
233
|
* @memberof AiChatController
|
|
228
234
|
*/
|
|
229
235
|
inited: Signal<boolean>;
|
|
236
|
+
/**
|
|
237
|
+
* @description 系统文件控制器
|
|
238
|
+
* @type {FileSystemController}
|
|
239
|
+
* @memberof AiChatController
|
|
240
|
+
*/
|
|
241
|
+
fileSystem: FileSystemController;
|
|
230
242
|
/**
|
|
231
243
|
* @description 增强提问配置
|
|
232
244
|
* @type {Signal<{ enable: boolean; message: string }>}
|
|
@@ -352,6 +364,15 @@ export declare class AiChatController {
|
|
|
352
364
|
* 加载更早的历史消息(滚动到列表顶部时调用)
|
|
353
365
|
*/
|
|
354
366
|
loadHistoryMore(): Promise<void>;
|
|
367
|
+
/**
|
|
368
|
+
* @description 尝试恢复会话(如果会话存在异步行为标识才恢复,没有则认为会话已经完成,不需要恢复)
|
|
369
|
+
* @author tony001
|
|
370
|
+
* @date 2026-10-14 18:10:07
|
|
371
|
+
* @private
|
|
372
|
+
* @returns {*} {Promise<void>}
|
|
373
|
+
* @memberof AiChatController
|
|
374
|
+
*/
|
|
375
|
+
private tryResumeChat;
|
|
355
376
|
/**
|
|
356
377
|
* 获取历史记录后续处理(仅查询history接口时调用)
|
|
357
378
|
*/
|
|
@@ -409,6 +430,13 @@ export declare class AiChatController {
|
|
|
409
430
|
* @memberof AiChatController
|
|
410
431
|
*/
|
|
411
432
|
updateMsgUsage(messageid: string, usage: IChatMessageUsage): void;
|
|
433
|
+
/**
|
|
434
|
+
* @description 基于消息ID更新消息的远程消息标识
|
|
435
|
+
* @param {string} messageid 本地消息ID
|
|
436
|
+
* @param {string} realmessageid 远程消息ID
|
|
437
|
+
* @memberof AiChatController
|
|
438
|
+
*/
|
|
439
|
+
updateMsgRealMessageID(messageid: string, realmessageid: string): void;
|
|
412
440
|
/**
|
|
413
441
|
* 终止消息
|
|
414
442
|
*
|
|
@@ -486,16 +514,23 @@ export declare class AiChatController {
|
|
|
486
514
|
*/
|
|
487
515
|
backfill(message: IChatMessage): void;
|
|
488
516
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
517
|
+
* @description 远程模式批量删除消息
|
|
518
|
+
* @param {IChatMessage[]} msgs 待删除的消息
|
|
519
|
+
* @return {*} {Promise<void>}
|
|
520
|
+
* @memberof AiChatController
|
|
521
|
+
*/
|
|
522
|
+
private deleteRemoteMessages;
|
|
523
|
+
/**
|
|
524
|
+
* @description 删除消息
|
|
491
525
|
* @param {IChatMessage} message
|
|
492
|
-
* @
|
|
526
|
+
* @return {*} {Promise<void>}
|
|
493
527
|
* @memberof AiChatController
|
|
494
528
|
*/
|
|
495
529
|
deleteMessage(message: IChatMessage): Promise<void>;
|
|
496
530
|
/**
|
|
497
|
-
* 刷新当前消息
|
|
498
|
-
*
|
|
531
|
+
* @description 刷新当前消息
|
|
532
|
+
* @param {IChatMessage} message
|
|
533
|
+
* @param {boolean} [isuser=false] 是否是用户消息刷新
|
|
499
534
|
* @memberof AiChatController
|
|
500
535
|
*/
|
|
501
536
|
refreshMessage(message: IChatMessage, isuser?: boolean): Promise<void>;
|
|
@@ -621,17 +656,11 @@ export declare class AiChatController {
|
|
|
621
656
|
*/
|
|
622
657
|
searchAIAgent(query: string): Promise<AIAgent[]>;
|
|
623
658
|
/**
|
|
624
|
-
* @description
|
|
625
|
-
* @param {string}
|
|
626
|
-
* @param {string} [pattern='']
|
|
627
|
-
* @returns {*} {Promise<{ id: string; label: string; isLeaf: boolean }[]>}
|
|
659
|
+
* @description 设置选中项目目录
|
|
660
|
+
* @param {(string | undefined)} id
|
|
628
661
|
* @memberof AiChatController
|
|
629
662
|
*/
|
|
630
|
-
|
|
631
|
-
id: string;
|
|
632
|
-
label: string;
|
|
633
|
-
isLeaf: boolean;
|
|
634
|
-
}[]>;
|
|
663
|
+
setActiveAIProjectID(id: string | undefined): void;
|
|
635
664
|
/**
|
|
636
665
|
* 设置选中知识库
|
|
637
666
|
* @param ids
|
|
@@ -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
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IFile, IFileItem, IFileItemParams, IFileUploadPrams, IFileSystemOptions, FileUploaderOptions } from '../../interface';
|
|
2
|
+
import { AiChatController } from '../ai-chat/ai-chat.controller';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description 系统文件控制器
|
|
6
|
+
* @export
|
|
7
|
+
* @class FileSystemController
|
|
8
|
+
*/
|
|
9
|
+
export declare class FileSystemController {
|
|
10
|
+
private opts;
|
|
11
|
+
private uploader;
|
|
12
|
+
private aiChat;
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of FileSystemController.
|
|
15
|
+
* @param {IFileSystemOptions} opts
|
|
16
|
+
* @param {FileUploaderOptions<object>} uploader
|
|
17
|
+
* @param {{
|
|
18
|
+
* context: object;
|
|
19
|
+
* params: object;
|
|
20
|
+
* sessionid: string;
|
|
21
|
+
* srfscope?: string;
|
|
22
|
+
* appDataEntityId: string;
|
|
23
|
+
* }} others
|
|
24
|
+
* @memberof FileSystemController
|
|
25
|
+
*/
|
|
26
|
+
constructor(opts: IFileSystemOptions, uploader: FileUploaderOptions<object>, aiChat: AiChatController);
|
|
27
|
+
/**
|
|
28
|
+
* @description 绑定函数this指向
|
|
29
|
+
* @private
|
|
30
|
+
* @memberof FileSystemController
|
|
31
|
+
*/
|
|
32
|
+
private bindFunction;
|
|
33
|
+
/**
|
|
34
|
+
* @description 查询系统文件
|
|
35
|
+
* @param {IFileItemParams} params
|
|
36
|
+
* @returns {*} {(Promise<IFileItem | undefined>)}
|
|
37
|
+
* @memberof FileSystemController
|
|
38
|
+
*/
|
|
39
|
+
fetch(params: IFileItemParams): Promise<IFileItem | undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* @description 文件上传
|
|
42
|
+
* @param {IFileUploadPrams} params
|
|
43
|
+
* @returns {*} {(Promise<IFile | undefined>)}
|
|
44
|
+
* @memberof FileSystemController
|
|
45
|
+
*/
|
|
46
|
+
uploadFile(params: IFileUploadPrams): Promise<IFile | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* @description 获取文件内容
|
|
49
|
+
* @param {string} id
|
|
50
|
+
* @param {string} type
|
|
51
|
+
* @param {string} cat
|
|
52
|
+
* @returns {*} {(Promise<string | object | undefined>)}
|
|
53
|
+
* @memberof FileSystemController
|
|
54
|
+
*/
|
|
55
|
+
getContent(id: string, type: string, cat: string): Promise<string | object | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* @description 获取图片内容
|
|
58
|
+
* @param {string} id
|
|
59
|
+
* @param {string} type
|
|
60
|
+
* @param {string} cat
|
|
61
|
+
* @returns {*} {Promise<string>}
|
|
62
|
+
* @memberof FileSystemController
|
|
63
|
+
*/
|
|
64
|
+
getImgContent(id: string, type: string, cat: string): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* @description 上传文件至oss
|
|
67
|
+
* @param {string} url
|
|
68
|
+
* @returns {*} {Promise<{ id: string; name: string; cat: string }>}
|
|
69
|
+
* @memberof FileSystemController
|
|
70
|
+
*/
|
|
71
|
+
upLoadFileToOss(_url: string): Promise<{
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
cat: string;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* @description 文件下载
|
|
78
|
+
* @param {string} id
|
|
79
|
+
* @param {string} name
|
|
80
|
+
* @param {string} cat
|
|
81
|
+
* @returns {*} {Promise<void>}
|
|
82
|
+
* @memberof FileSystemController
|
|
83
|
+
*/
|
|
84
|
+
downLoadFile(fileid: string, filename: string, cat: string): Promise<void>;
|
|
85
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
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';
|
|
7
|
+
export { drawerController } from './overlay';
|
|
8
|
+
export { FileSystemController } from './file-system/file-system.controller';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OverlayController } from './overlay.controller';
|
|
2
|
+
|
|
3
|
+
interface DrawerOpenOptions {
|
|
4
|
+
/** 容器(DOM 元素或选择器),不传默认 body */
|
|
5
|
+
container?: HTMLElement | string;
|
|
6
|
+
/** 弹出方向 */
|
|
7
|
+
placement?: 'left' | 'right' | 'top' | 'bottom';
|
|
8
|
+
/** 宽 / 高 */
|
|
9
|
+
size?: number | string;
|
|
10
|
+
/** 内容组件(函数 / 类组件) */
|
|
11
|
+
component: any;
|
|
12
|
+
/** 传递给内容组件的参数 */
|
|
13
|
+
props?: Record<string, any>;
|
|
14
|
+
/** 是否显示遮罩,默认 true */
|
|
15
|
+
mask?: boolean;
|
|
16
|
+
/** 是否显示右上角关闭按钮,默认 true */
|
|
17
|
+
showClose?: boolean;
|
|
18
|
+
/** 点击遮罩是否关闭,默认 true */
|
|
19
|
+
maskClosable?: boolean;
|
|
20
|
+
/** 外部扩展类名 */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** 标题 */
|
|
23
|
+
title?: string;
|
|
24
|
+
}
|
|
25
|
+
declare class DrawerOverlayController extends OverlayController {
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* @description 打开抽屉
|
|
29
|
+
* @param {DrawerOpenOptions} options
|
|
30
|
+
*/
|
|
31
|
+
open(options: DrawerOpenOptions): void;
|
|
32
|
+
}
|
|
33
|
+
export declare const drawerController: DrawerOverlayController;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { drawerController } from './drawer-overlay.controller';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
export interface OverlayInstance {
|
|
4
|
+
/** 挂载点 DOM */
|
|
5
|
+
mountPoint: HTMLElement;
|
|
6
|
+
/** 触发关闭(带动画) */
|
|
7
|
+
close: () => void;
|
|
8
|
+
/** 立即销毁(无动画) */
|
|
9
|
+
destroy: () => void;
|
|
10
|
+
/** 元数据,便于扩展 */
|
|
11
|
+
meta?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export interface OverlayOpenResult<T extends OverlayInstance = OverlayInstance> {
|
|
14
|
+
instance: T | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @description 浮层通用管理器(抽屉 / 模态 / 气泡等共用)
|
|
18
|
+
* - 单例:同一时刻只允许一个同类浮层打开
|
|
19
|
+
* - 容器:未指定时默认 body,并自动补齐 position: relative
|
|
20
|
+
* - 挂载:在容器内创建一个独立 mountPoint,避免污染容器原有结构
|
|
21
|
+
* - 渲染:通过 Preact render 渲染,销毁时 render(null) 再移除节点
|
|
22
|
+
*/
|
|
23
|
+
export declare class OverlayController {
|
|
24
|
+
/** 当前活动的浮层实例 */
|
|
25
|
+
protected activeInstance: OverlayInstance | null;
|
|
26
|
+
/** 用于扩展:子类可覆盖,比如记录类型 */
|
|
27
|
+
protected readonly name: string;
|
|
28
|
+
constructor(name?: string);
|
|
29
|
+
/**
|
|
30
|
+
* @description 解析容器
|
|
31
|
+
*/
|
|
32
|
+
protected resolveContainer(container?: HTMLElement | string | null): HTMLElement;
|
|
33
|
+
/**
|
|
34
|
+
* @description 确保容器有定位上下文
|
|
35
|
+
*/
|
|
36
|
+
protected ensurePosition(container: HTMLElement): void;
|
|
37
|
+
/**
|
|
38
|
+
* @description 创建挂载点
|
|
39
|
+
*/
|
|
40
|
+
protected createMountPoint(container: HTMLElement): HTMLElement;
|
|
41
|
+
/**
|
|
42
|
+
* @description 渲染浮层内容(子类调用,传入 VNode 与关闭回调)
|
|
43
|
+
*/
|
|
44
|
+
protected mount(mountPoint: HTMLElement, vnode: VNode): void;
|
|
45
|
+
/**
|
|
46
|
+
* @description 销毁当前浮层(立即)
|
|
47
|
+
*/
|
|
48
|
+
destroy(): void;
|
|
49
|
+
/**
|
|
50
|
+
* @description 关闭当前浮层(默认走动画,子类可覆盖)
|
|
51
|
+
*/
|
|
52
|
+
close(): void;
|
|
53
|
+
/**
|
|
54
|
+
* @description 是否已打开
|
|
55
|
+
*/
|
|
56
|
+
isOpen(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @description 获取当前实例
|
|
59
|
+
*/
|
|
60
|
+
getActiveInstance(): OverlayInstance | null;
|
|
61
|
+
}
|
|
@@ -53,3 +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 { 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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -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';
|
|
@@ -8,7 +9,7 @@ import { IKnowledgeBase } from '../i-knowledge-base/i-knowledge-base';
|
|
|
8
9
|
import { ISpeechRecognition } from '../i-speech-recognition/i-speech-recognition';
|
|
9
10
|
import { Locale } from '../../locale';
|
|
10
11
|
import { IConfirmUtil, IMessageUtil, INotificationUtil } from '../util';
|
|
11
|
-
import {
|
|
12
|
+
import { IFileSystemOptions } from '../i-file-system-options/i-file-system-options';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 聊天数据
|
|
@@ -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,
|
|
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, messageid: string): 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
|
|
@@ -395,17 +421,11 @@ export interface IChatOptions extends IChat {
|
|
|
395
421
|
knowledgebases?: string;
|
|
396
422
|
}) => Promise<IKnowledgeBase[]>;
|
|
397
423
|
/**
|
|
398
|
-
* @description
|
|
424
|
+
* @description 文件系统参数
|
|
425
|
+
* @type {IFileSystemOptions}
|
|
399
426
|
* @memberof IChatOptions
|
|
400
427
|
*/
|
|
401
|
-
|
|
402
|
-
srfaiagent: string;
|
|
403
|
-
sessionid: string;
|
|
404
|
-
pattern: string;
|
|
405
|
-
file_path: string;
|
|
406
|
-
max_depth: number;
|
|
407
|
-
only_dirs: boolean;
|
|
408
|
-
}) => Promise<IProject[]>;
|
|
428
|
+
fileSystemOptions: IFileSystemOptions;
|
|
409
429
|
/**
|
|
410
430
|
* 文件上传配置
|
|
411
431
|
*
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface IFileItem {
|
|
2
|
+
/**
|
|
3
|
+
* 项目名称
|
|
4
|
+
*/
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* 项目类型
|
|
8
|
+
*/
|
|
9
|
+
type: string;
|
|
10
|
+
/**
|
|
11
|
+
* 大小
|
|
12
|
+
*/
|
|
13
|
+
size?: number;
|
|
14
|
+
/**
|
|
15
|
+
* 根路径
|
|
16
|
+
*/
|
|
17
|
+
path?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 子项目
|
|
20
|
+
*/
|
|
21
|
+
children?: IFileItem[];
|
|
22
|
+
}
|
|
23
|
+
export interface IFileItemParams {
|
|
24
|
+
/**
|
|
25
|
+
* @description 智能体
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof IFileItemParams
|
|
28
|
+
*/
|
|
29
|
+
srfaiagent?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @description 文件路径
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof IFileItemParams
|
|
34
|
+
*/
|
|
35
|
+
file_path?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description 匹配
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof IFileItemParams
|
|
40
|
+
*/
|
|
41
|
+
pattern?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @description 最大层级
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @memberof IFileItemParams
|
|
46
|
+
*/
|
|
47
|
+
max_depth?: number;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否只查询目录
|
|
50
|
+
* @type {boolean}
|
|
51
|
+
* @memberof IFileItemParams
|
|
52
|
+
*/
|
|
53
|
+
only_dirs?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface IFileUploadPrams {
|
|
56
|
+
/**
|
|
57
|
+
* @description 文件路径
|
|
58
|
+
* @type {string}
|
|
59
|
+
* @memberof IFileUploadPrams
|
|
60
|
+
*/
|
|
61
|
+
file_path: string;
|
|
62
|
+
}
|
|
63
|
+
export interface IFile {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
cat: string;
|
|
67
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { IFileItem } from '../i-file-item/i-file-item';
|
|
2
|
+
|
|
3
|
+
interface IFileSystemParams {
|
|
4
|
+
sessionid: string;
|
|
5
|
+
srfaiagent?: string;
|
|
6
|
+
srfscope?: string;
|
|
7
|
+
max_depth?: number;
|
|
8
|
+
pattern?: string;
|
|
9
|
+
file_path?: string;
|
|
10
|
+
only_dirs?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IFileSystemUploadParams {
|
|
13
|
+
sessionid: string;
|
|
14
|
+
file_path: string;
|
|
15
|
+
srfaiagent?: string;
|
|
16
|
+
srfscope?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description 文件系统操作参数
|
|
20
|
+
* @export
|
|
21
|
+
* @interface IFileSystemOptions
|
|
22
|
+
*/
|
|
23
|
+
export interface IFileSystemOptions {
|
|
24
|
+
/**
|
|
25
|
+
* @description 获取文件清单
|
|
26
|
+
* @memberof IFileSystemOptions
|
|
27
|
+
*/
|
|
28
|
+
getFileList: (context: object, params: object, other: IFileSystemParams) => Promise<IFileItem | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* @description 上传文件
|
|
31
|
+
* @memberof IFileSystemOptions
|
|
32
|
+
*/
|
|
33
|
+
uploadFile: (context: object, params: object, other: IFileSystemUploadParams) => Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
folder: string;
|
|
37
|
+
} | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* @description 获取文件内容
|
|
40
|
+
* @param {object} ctx
|
|
41
|
+
* @param {object} param
|
|
42
|
+
* @param {string} id
|
|
43
|
+
* @param {string} type
|
|
44
|
+
* @param {string} cat
|
|
45
|
+
* @returns {*} {(Promise<string | object | undefined>)}
|
|
46
|
+
* @memberof IFileSystemOptions
|
|
47
|
+
*/
|
|
48
|
+
getContent(ctx: object, param: object, id: string, type: string, cat: string): Promise<string | object | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* @description 获取图片内容
|
|
51
|
+
* @param {object} ctx
|
|
52
|
+
* @param {object} param
|
|
53
|
+
* @param {string} id
|
|
54
|
+
* @param {string} type
|
|
55
|
+
* @param {string} cat
|
|
56
|
+
* @returns {*} {Promise<string>}
|
|
57
|
+
* @memberof IFileSystemOptions
|
|
58
|
+
*/
|
|
59
|
+
getImgContent(ctx: object, param: object, id: string, type: string, cat: string): Promise<string>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -23,6 +23,8 @@ 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 {
|
|
28
|
+
export type { IFile, IFileItem, IFileItemParams, IFileUploadPrams, } from './i-file-item/i-file-item';
|
|
29
|
+
export type { IFileSystemOptions } from './i-file-system-options/i-file-system-options';
|
|
28
30
|
export * from './deep-research';
|
|
@@ -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
|
+
notYetSupported: string;
|
|
158
|
+
fileName: string;
|
|
159
|
+
size: string;
|
|
160
|
+
type: string;
|
|
161
|
+
folder: string;
|
|
154
162
|
};
|
|
@@ -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
|
+
notYetSupported: 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.
|
|
3
|
+
"version": "0.0.116",
|
|
4
4
|
"description": "iBiz AI交互框插件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
@@ -29,6 +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.26",
|
|
32
33
|
"@ibiz-template/scss-utils": "^0.0.2",
|
|
33
34
|
"@preact/signals": "^1.2.1",
|
|
34
35
|
"@tiptap/core": "^3.11.1",
|