@ibiz-template-plugin/ai-chat 0.0.115 → 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.
Files changed (27) hide show
  1. package/dist/index.es.js +25128 -11446
  2. package/dist/index.legacy.js +28 -1
  3. package/dist/polyfills.legacy.js +2 -2
  4. package/dist/style.css +26 -1
  5. package/dist/types/components/chat-container/chat-container.d.ts +8 -1
  6. package/dist/types/components/chat-file-preview/chat-file-preview.d.ts +18 -0
  7. package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +2 -2
  8. package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +8 -1
  9. package/dist/types/components/common/drawer/drawer.d.ts +28 -0
  10. package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +11 -1
  11. package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +6 -0
  12. package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +1 -0
  13. package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +18 -1
  14. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +27 -13
  15. package/dist/types/controller/file-system/file-system.controller.d.ts +85 -0
  16. package/dist/types/controller/index.d.ts +2 -0
  17. package/dist/types/controller/overlay/drawer-overlay.controller.d.ts +34 -0
  18. package/dist/types/controller/overlay/index.d.ts +1 -0
  19. package/dist/types/controller/overlay/overlay.controller.d.ts +61 -0
  20. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +5 -11
  21. package/dist/types/interface/i-file-item/i-file-item.d.ts +67 -0
  22. package/dist/types/interface/i-file-system-options/i-file-system-options.d.ts +61 -0
  23. package/dist/types/interface/index.d.ts +2 -1
  24. package/dist/types/locale/en/index.d.ts +1 -1
  25. package/dist/types/locale/zh-CN/index.d.ts +1 -1
  26. package/package.json +2 -1
  27. package/dist/types/interface/i-project/i-project.d.ts +0 -40
@@ -290,6 +290,13 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
290
290
  * @type {ContainerContext}
291
291
  */
292
292
  containerContext: ContainerContext;
293
+ /**
294
+ * 同步 props 到容器上下文(引用仅在值变化时替换,保证消费者按需重渲染)
295
+ *
296
+ * @return {*}
297
+ * @memberof ChatContainer
298
+ */
299
+ syncContainerContext(): void;
293
300
  /**
294
301
  * 计算AI窗口样式
295
302
  *
@@ -407,7 +414,7 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
407
414
  */
408
415
  handleSidebarResizeEnd: () => void;
409
416
  /**
410
- * 将侧栏宽度校正到合理区间 [200, 容器宽度/2, 右侧最小宽]
417
+ * 将侧栏宽度校正到合理区间 [200, 容器宽度/3, 容器宽度-右侧最小宽]
411
418
  */
412
419
  clampSidebarWidth(width: number): number;
413
420
  /**
@@ -0,0 +1,18 @@
1
+ import { FileSystemController } from '../../controller';
2
+
3
+ interface ChatFilePreviewProps {
4
+ /**
5
+ * @description 文件路径
6
+ * @type {IFile}
7
+ * @memberof ChatFilePreviewProps
8
+ */
9
+ filePath?: string;
10
+ /**
11
+ * @description 系统文件控制器
12
+ * @type {FileSystemController}
13
+ * @memberof ChatFilePreviewProps
14
+ */
15
+ controller: FileSystemController;
16
+ }
17
+ export declare const ChatFilePreview: (props: ChatFilePreviewProps) => import("preact").JSX.Element;
18
+ export {};
@@ -1,7 +1,7 @@
1
- import { AiChatController } from '../../controller';
1
+ import { FileSystemController } from '../../controller';
2
2
 
3
3
  interface ChatNetDiskProps {
4
- controller: AiChatController;
4
+ controller: FileSystemController;
5
5
  }
6
6
  export declare const ChatNetDisk: (props: ChatNetDiskProps) => import("preact").JSX.Element;
7
7
  export {};
@@ -1,12 +1,19 @@
1
1
 
2
2
  interface BreadcrumbProps {
3
3
  /**
4
- * 当前路径(根 -> 当前层)
4
+ * 当前路径(非根 -> 当前层)
5
5
  */
6
6
  path: {
7
7
  id: string;
8
8
  label: string;
9
9
  }[];
10
+ /**
11
+ * 根节点
12
+ */
13
+ root?: {
14
+ id: string;
15
+ label: string;
16
+ };
10
17
  /**
11
18
  * 点击某一层跳转,-1 表示回到根
12
19
  */
@@ -0,0 +1,28 @@
1
+ import { h } from 'preact';
2
+
3
+ interface DrawerProps {
4
+ /** 抽屉内容组件(函数组件 / 类组件) */
5
+ content: any;
6
+ /** 传递给内容组件的参数(onClose 会被自动注入) */
7
+ contentProps?: Record<string, any>;
8
+ /** 弹出方向 */
9
+ placement?: 'left' | 'right' | 'top' | 'bottom';
10
+ /** 宽(左右)/ 高(上下),number(px) 或 字符串(如 '50%') */
11
+ size?: number | string;
12
+ /** 指定容器(DOM 元素),不传则默认 body */
13
+ container?: HTMLElement;
14
+ /** 关闭回调(由 DrawerManager 注入) */
15
+ onClose?: () => void;
16
+ /** 是否显示遮罩,默认 true */
17
+ mask?: boolean;
18
+ /** 是否显示右上角关闭按钮,默认 true */
19
+ showClose?: boolean;
20
+ /** 点击遮罩是否关闭,默认 true */
21
+ maskClosable?: boolean;
22
+ /** 外部扩展类名 */
23
+ className?: string;
24
+ /** 标题 */
25
+ title?: string;
26
+ }
27
+ export declare const Drawer: (props: DrawerProps) => h.JSX.Element;
28
+ export {};
@@ -55,5 +55,15 @@ interface LazyListTreeProps {
55
55
  */
56
56
  draggable?: boolean;
57
57
  }
58
- export declare const LazyListTree: (props: LazyListTreeProps) => import("preact").JSX.Element;
58
+ export interface LazyListTreeRef {
59
+ /**
60
+ * 重载节点
61
+ * @param node
62
+ * @returns
63
+ */
64
+ overloadNode: (node: LazyTreeNode) => Promise<void>;
65
+ }
66
+ export declare const LazyListTree: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<LazyListTreeProps> & {
67
+ ref?: import('preact').Ref<LazyListTreeRef> | undefined;
68
+ }>;
59
69
  export {};
@@ -44,6 +44,12 @@ export interface LazyTreeNode {
44
44
  * 原始数据
45
45
  */
46
46
  data: Record<string, any>;
47
+ /**
48
+ * @description 根节点标识
49
+ * @type {string}
50
+ * @memberof LazyTreeNode
51
+ */
52
+ rootId: string;
47
53
  }
48
54
  interface LazyTreeProps {
49
55
  /**
@@ -65,6 +65,7 @@ export interface FlatChatContainerProps {
65
65
  interface FlatContainerContext {
66
66
  enableBackFill: boolean;
67
67
  }
68
+ export declare const DEFAULT_FLAT_CONTAINER_CONTEXT: FlatContainerContext;
68
69
  export declare const FlatContainerContext: import('preact').Context<FlatContainerContext>;
69
70
  /**
70
71
  * 平铺聊天容器,无拖拽/缩放/全屏/最小化,铺满外部容器
@@ -38,6 +38,10 @@ export declare class AiActionPanelController {
38
38
  * 内容组件额外参数
39
39
  */
40
40
  readonly params: Signal<Record<string, any> | undefined>;
41
+ /**
42
+ * 当前业务域key(渲染内容组件时作为key传入,不同业务域切换时强制重挂载)
43
+ */
44
+ readonly key: Signal<string>;
41
45
  /**
42
46
  * 组件外层容器id(用于宽度缓存隔离)
43
47
  */
@@ -50,9 +54,22 @@ export declare class AiActionPanelController {
50
54
  * @param {string} caption 标题
51
55
  * @param {TActionPanelComponent} component 内容组件
52
56
  * @param {Record<string, any>} [params] 额外参数(作为内容组件props传入)
57
+ * @param {string} [key] 业务域key(内容组件渲染key,不同业务域切换时强制重挂载)
58
+ * @memberof AiActionPanelController
59
+ */
60
+ open(caption: string, component: TActionPanelComponent, params?: Record<string, any>, key?: string): void;
61
+ /**
62
+ * 刷新面板内容(会话切换时调用)
63
+ * - 面板未打开时不做处理(下次 open 会生成全新参数)
64
+ * - 新旧 key 一致时跳过刷新(同一业务域无需重挂载)
65
+ * - params 中包含 controller 时替换为激活会话的控制器
66
+ * - 重置 key 强制内容组件重挂载并重新加载数据
67
+ *
68
+ * @param {string} [key] 业务域key(未传时生成 uuid 强制刷新)
69
+ * @param {unknown} [controller] 激活会话的聊天控制器
53
70
  * @memberof AiActionPanelController
54
71
  */
55
- open(caption: string, component: TActionPanelComponent, params?: Record<string, any>): void;
72
+ refresh(key?: string, controller?: unknown): void;
56
73
  /**
57
74
  * 关闭操作区面板(收起动画由容器 CSS 过渡完成)
58
75
  *
@@ -1,9 +1,10 @@
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, IProject, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, IProjectParams, IChatSuggestion, IResourceOptions, IChatMessageUsage, ITopicOptions } from '../../interface';
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
6
  import { AiActionPanelController } from '../ai-action-panel/ai-action-panel.controller';
7
+ import { FileSystemController } from '../file-system/file-system.controller';
7
8
 
8
9
  /**
9
10
  * 聊天逻辑控制器
@@ -232,6 +233,12 @@ export declare class AiChatController {
232
233
  * @memberof AiChatController
233
234
  */
234
235
  inited: Signal<boolean>;
236
+ /**
237
+ * @description 系统文件控制器
238
+ * @type {FileSystemController}
239
+ * @memberof AiChatController
240
+ */
241
+ fileSystem: FileSystemController;
235
242
  /**
236
243
  * @description 增强提问配置
237
244
  * @type {Signal<{ enable: boolean; message: string }>}
@@ -423,6 +430,13 @@ export declare class AiChatController {
423
430
  * @memberof AiChatController
424
431
  */
425
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;
426
440
  /**
427
441
  * 终止消息
428
442
  *
@@ -500,16 +514,23 @@ export declare class AiChatController {
500
514
  */
501
515
  backfill(message: IChatMessage): void;
502
516
  /**
503
- *
504
- * 删除指定消息,如果是用户提问的刷新调用的删除,则需要删除从问题开始到最后的所有记录
517
+ * @description 远程模式批量删除消息
518
+ * @param {IChatMessage[]} msgs 待删除的消息
519
+ * @return {*} {Promise<void>}
520
+ * @memberof AiChatController
521
+ */
522
+ private deleteRemoteMessages;
523
+ /**
524
+ * @description 删除消息
505
525
  * @param {IChatMessage} message
506
- * @param {boolean} [isuser=false]
526
+ * @return {*} {Promise<void>}
507
527
  * @memberof AiChatController
508
528
  */
509
529
  deleteMessage(message: IChatMessage): Promise<void>;
510
530
  /**
511
- * 刷新当前消息
512
- *
531
+ * @description 刷新当前消息
532
+ * @param {IChatMessage} message
533
+ * @param {boolean} [isuser=false] 是否是用户消息刷新
513
534
  * @memberof AiChatController
514
535
  */
515
536
  refreshMessage(message: IChatMessage, isuser?: boolean): Promise<void>;
@@ -634,13 +655,6 @@ export declare class AiChatController {
634
655
  * @returns
635
656
  */
636
657
  searchAIAgent(query: string): Promise<AIAgent[]>;
637
- /**
638
- * @description 搜索项目
639
- * @param {IProjectParams} params 查询参数
640
- * @returns {*} {Promise<IProject[]>}
641
- * @memberof AiChatController
642
- */
643
- searchProject(params: IProjectParams): Promise<IProject[]>;
644
658
  /**
645
659
  * @description 设置选中项目目录
646
660
  * @param {(string | undefined)} id
@@ -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
+ }
@@ -4,3 +4,5 @@ export { AiActionPanelController } from './ai-action-panel/ai-action-panel.contr
4
4
  export { AIMaterialFactory } from './ai-material/ai-material-factory';
5
5
  export { ModalChatController, chat } from './chat/modal-chat.controller';
6
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
+ }
@@ -9,7 +9,7 @@ import { IKnowledgeBase } from '../i-knowledge-base/i-knowledge-base';
9
9
  import { ISpeechRecognition } from '../i-speech-recognition/i-speech-recognition';
10
10
  import { Locale } from '../../locale';
11
11
  import { IConfirmUtil, IMessageUtil, INotificationUtil } from '../util';
12
- import { IProject } from '../i-project/i-project';
12
+ import { IFileSystemOptions } from '../i-file-system-options/i-file-system-options';
13
13
 
14
14
  /**
15
15
  * 聊天数据
@@ -329,7 +329,7 @@ export interface IChatOptions extends IChat {
329
329
  * @param {IChatMessage[]} question 提问历史内容(包含当前提问)
330
330
  * @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
331
331
  */
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>;
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
333
  /**
334
334
  * @description 恢复会话
335
335
  * @param {AiChatController} aiChat
@@ -421,17 +421,11 @@ export interface IChatOptions extends IChat {
421
421
  knowledgebases?: string;
422
422
  }) => Promise<IKnowledgeBase[]>;
423
423
  /**
424
- * @description 查询项目
424
+ * @description 文件系统参数
425
+ * @type {IFileSystemOptions}
425
426
  * @memberof IChatOptions
426
427
  */
427
- fetchProject?: (context: object, params: object, other: {
428
- srfaiagent: string;
429
- sessionid: string;
430
- max_depth: number;
431
- pattern?: string;
432
- file_path?: string;
433
- only_dirs?: boolean;
434
- }) => Promise<IProject[]>;
428
+ fileSystemOptions: IFileSystemOptions;
435
429
  /**
436
430
  * 文件上传配置
437
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 {};
@@ -25,5 +25,6 @@ export type { IAIQuesitionItem, IAIQuesition, IAIQuesitionAnswer, } from './i-ai
25
25
  export type { IExtensionOptions } from './i-extension-options/i-extension-options';
26
26
  export type { IActionPanelContentProps, TActionPanelComponent, } from './i-action-panel/i-action-panel';
27
27
  export type { ISpeechRecognition } from './i-speech-recognition/i-speech-recognition';
28
- export type { IProject, IProjectParams } from './i-project/i-project';
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';
29
30
  export * from './deep-research';
@@ -154,7 +154,7 @@ export declare const EN: {
154
154
  workSpace: string;
155
155
  listMode: string;
156
156
  treeMode: string;
157
- rootDirectory: string;
157
+ notYetSupported: string;
158
158
  fileName: string;
159
159
  size: string;
160
160
  type: string;
@@ -154,7 +154,7 @@ export declare const ZH_CN: {
154
154
  workSpace: string;
155
155
  listMode: string;
156
156
  treeMode: string;
157
- rootDirectory: string;
157
+ notYetSupported: string;
158
158
  fileName: string;
159
159
  size: string;
160
160
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.115",
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",