@ibiz-template-plugin/ai-chat 0.0.115 → 0.0.117
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 +40981 -24965
- 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-container/chat-container.d.ts +33 -25
- package/dist/types/components/chat-file-preview/chat-file-preview.d.ts +18 -0
- package/dist/types/components/chat-group-topics/components/selected-mode-topic/selected-mode-topic.d.ts +21 -0
- package/dist/types/components/chat-group-topics/components/show-hidden-setting/show-hidden-setting.d.ts +17 -0
- package/dist/types/components/chat-group-topics/components/topic-batch-action/topic-batch-action.d.ts +21 -0
- package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +2 -2
- package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +8 -1
- package/dist/types/components/common/drawer/drawer.d.ts +28 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +11 -1
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +6 -0
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +1 -0
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +18 -1
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +39 -13
- package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +83 -5
- 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 +36 -0
- package/dist/types/controller/overlay/index.d.ts +1 -0
- package/dist/types/controller/overlay/overlay.controller.d.ts +67 -0
- package/dist/types/controller/tiptap/config/file-node-config.d.ts +3 -0
- package/dist/types/controller/tiptap/tiptap.controller.d.ts +50 -0
- package/dist/types/entity/chart-topic/chart-topic.d.ts +1 -0
- package/dist/types/entity/chat-message/chat-message.d.ts +1 -0
- package/dist/types/icons/eye-svg.d.ts +1 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/icons/new-folder-svg.d.ts +1 -0
- package/dist/types/icons/system-file/archive.d.ts +1 -0
- package/dist/types/icons/system-file/audio.d.ts +1 -0
- package/dist/types/icons/system-file/excel.d.ts +4 -0
- package/dist/types/icons/system-file/image.d.ts +1 -0
- package/dist/types/icons/system-file/index.d.ts +10 -0
- package/dist/types/icons/system-file/other.d.ts +2 -0
- package/dist/types/icons/system-file/ppt.d.ts +5 -0
- package/dist/types/icons/system-file/program.d.ts +1 -0
- package/dist/types/icons/system-file/text.d.ts +17 -0
- package/dist/types/icons/system-file/video.d.ts +5 -0
- package/dist/types/icons/system-file/word.d.ts +1 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +6 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +5 -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/i-remote-resource/i-remote-resource.d.ts +6 -0
- package/dist/types/interface/i-tiptap/i-tiptap.d.ts +51 -0
- package/dist/types/interface/i-topic-options/i-topic-options.d.ts +50 -5
- package/dist/types/interface/index.d.ts +4 -2
- package/dist/types/locale/en/index.d.ts +8 -2
- package/dist/types/locale/zh-CN/index.d.ts +8 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/util/system-file.d.ts +10 -0
- package/dist/types/utils/util/util.d.ts +2 -1
- package/package.json +2 -1
- package/dist/types/components/chat-editor/node/mention-node.d.ts +0 -3
- package/dist/types/interface/i-project/i-project.d.ts +0 -40
|
@@ -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,6 @@ 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';
|
|
9
|
+
export { tipTapController } from './tiptap/tiptap.controller';
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
event?: MouseEvent;
|
|
26
|
+
}
|
|
27
|
+
declare class DrawerOverlayController extends OverlayController {
|
|
28
|
+
constructor();
|
|
29
|
+
/**
|
|
30
|
+
* @description 打开抽屉
|
|
31
|
+
* @param {DrawerOpenOptions} options
|
|
32
|
+
*/
|
|
33
|
+
open(options: DrawerOpenOptions): void;
|
|
34
|
+
}
|
|
35
|
+
export declare const drawerController: DrawerOverlayController;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { drawerController } from './drawer-overlay.controller';
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
* @protected
|
|
32
|
+
* @param {(HTMLElement | string | null)} [container] 容器:DOM 元素或选择器,不传默认 body
|
|
33
|
+
* @param {(EventTarget | null)} [origin] 事件源,传入后会优先从事件源所在组件根内查找容器
|
|
34
|
+
* @param {string} [rootSelector='.ibiz-ai-chat'] 组件根选择器,从事件源向上定位作用域,默认 '.ibiz-ai-chat'
|
|
35
|
+
* @returns {*} {HTMLElement}
|
|
36
|
+
* @memberof OverlayController
|
|
37
|
+
*/
|
|
38
|
+
protected resolveContainer(container?: HTMLElement | string | null, origin?: EventTarget | null, rootSelector?: string): HTMLElement;
|
|
39
|
+
/**
|
|
40
|
+
* @description 确保容器有定位上下文
|
|
41
|
+
*/
|
|
42
|
+
protected ensurePosition(container: HTMLElement): void;
|
|
43
|
+
/**
|
|
44
|
+
* @description 创建挂载点
|
|
45
|
+
*/
|
|
46
|
+
protected createMountPoint(container: HTMLElement): HTMLElement;
|
|
47
|
+
/**
|
|
48
|
+
* @description 渲染浮层内容(子类调用,传入 VNode 与关闭回调)
|
|
49
|
+
*/
|
|
50
|
+
protected mount(mountPoint: HTMLElement, vnode: VNode): void;
|
|
51
|
+
/**
|
|
52
|
+
* @description 销毁当前浮层(立即)
|
|
53
|
+
*/
|
|
54
|
+
destroy(): void;
|
|
55
|
+
/**
|
|
56
|
+
* @description 关闭当前浮层(默认走动画,子类可覆盖)
|
|
57
|
+
*/
|
|
58
|
+
close(): void;
|
|
59
|
+
/**
|
|
60
|
+
* @description 是否已打开
|
|
61
|
+
*/
|
|
62
|
+
isOpen(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @description 获取当前实例
|
|
65
|
+
*/
|
|
66
|
+
getActiveInstance(): OverlayInstance | null;
|
|
67
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Editor, Node } from '@tiptap/core';
|
|
2
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
3
|
+
import { TipTapNodeConfig } from '../../interface';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description tiptap控制器
|
|
7
|
+
* @export
|
|
8
|
+
* @class TipTapController
|
|
9
|
+
*/
|
|
10
|
+
declare class TipTapController {
|
|
11
|
+
/**
|
|
12
|
+
* @description 节点
|
|
13
|
+
* @private
|
|
14
|
+
* @type {{ [key: string]: Node }}
|
|
15
|
+
* @memberof TipTapController
|
|
16
|
+
*/
|
|
17
|
+
private nodes;
|
|
18
|
+
/**
|
|
19
|
+
* 获取所有已注册的节点,用于传给 Editor 的 extensions
|
|
20
|
+
*/
|
|
21
|
+
getExtensions(): Node[];
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of TipTapController.
|
|
24
|
+
* @memberof TipTapController
|
|
25
|
+
*/
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* @description 创建节点
|
|
29
|
+
* - 必须在AI组件初始化之前执行
|
|
30
|
+
* @param {TipTapNodeConfig} config 节点配置
|
|
31
|
+
* @memberof TipTapController
|
|
32
|
+
*/
|
|
33
|
+
createNode(config: TipTapNodeConfig): void;
|
|
34
|
+
/**
|
|
35
|
+
* @description 处理放置
|
|
36
|
+
* @param {EditorView} view 视图
|
|
37
|
+
* @param {DragEvent} event 事件源
|
|
38
|
+
* @memberof TipTapController
|
|
39
|
+
*/
|
|
40
|
+
handleDrop(editor: Editor, view: EditorView, event: DragEvent): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* @description 获取html字符串
|
|
43
|
+
* @param {Editor} editor
|
|
44
|
+
* @returns {*} {string}
|
|
45
|
+
* @memberof TipTapController
|
|
46
|
+
*/
|
|
47
|
+
getHTML(editor: Editor): string;
|
|
48
|
+
}
|
|
49
|
+
export declare const tipTapController: TipTapController;
|
|
50
|
+
export {};
|
|
@@ -50,6 +50,7 @@ export declare class ChatMessage implements IChatMessage {
|
|
|
50
50
|
get agent_tag(): IChatMessage['agent_tag'];
|
|
51
51
|
get create_time(): IChatMessage['create_time'];
|
|
52
52
|
set create_time(value: string);
|
|
53
|
+
get iswaiting(): IChatMessage['iswaiting'];
|
|
53
54
|
constructor(msg: IChatMessage);
|
|
54
55
|
/**
|
|
55
56
|
* 更新消息
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EyeSvg: () => import("preact").JSX.Element;
|
|
@@ -55,3 +55,5 @@ export { UnTopSvg } from './untop-svg';
|
|
|
55
55
|
export { PlusSvg } from './plus-svg';
|
|
56
56
|
export { ProjectSvg } from './project-svg';
|
|
57
57
|
export { WorlSpaceSvg } from './workspace-svg';
|
|
58
|
+
export { NewFolderSvg } from './new-folder-svg';
|
|
59
|
+
export { EyeSvg } from './eye-svg';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NewFolderSvg: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const archive: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const audio: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const image: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './other';
|
|
2
|
+
export * from './text';
|
|
3
|
+
export * from './excel';
|
|
4
|
+
export * from './ppt';
|
|
5
|
+
export * from './video';
|
|
6
|
+
export * from './image';
|
|
7
|
+
export * from './word';
|
|
8
|
+
export * from './audio';
|
|
9
|
+
export * from './program';
|
|
10
|
+
export * from './archive';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ppt: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const pptx: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const pptm: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const _ppt: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const pdf: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const program: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const txt: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const md: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const log: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const csv: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const tsv: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const xml: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const json: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const yaml: () => import("preact").JSX.Element;
|
|
9
|
+
export declare const yml: () => import("preact").JSX.Element;
|
|
10
|
+
export declare const ini: () => import("preact").JSX.Element;
|
|
11
|
+
export declare const cfg: () => import("preact").JSX.Element;
|
|
12
|
+
export declare const conf: () => import("preact").JSX.Element;
|
|
13
|
+
export declare const html: () => import("preact").JSX.Element;
|
|
14
|
+
export declare const css: () => import("preact").JSX.Element;
|
|
15
|
+
export declare const jsx: () => import("preact").JSX.Element;
|
|
16
|
+
export declare const tsx: () => import("preact").JSX.Element;
|
|
17
|
+
export declare const vue: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const video: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const mp4: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const m4v: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const mkv: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const avi: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const word: () => import("preact").JSX.Element;
|
|
@@ -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 {
|
|
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
|
-
|
|
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 {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { NodeConfig } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description TipTap扩展节点类型
|
|
5
|
+
* @export
|
|
6
|
+
* @enum {number}
|
|
7
|
+
*/
|
|
8
|
+
export declare enum TipTapNodeType {
|
|
9
|
+
FILE = "file"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @description TipTap拖拽数据
|
|
13
|
+
* @export
|
|
14
|
+
* @interface ITipTapDropData
|
|
15
|
+
*/
|
|
16
|
+
export interface ITipTapDropData {
|
|
17
|
+
/**
|
|
18
|
+
* @description 拖拽类型
|
|
19
|
+
* @type {TipTapNodeType}
|
|
20
|
+
* @memberof ITipTapDropData
|
|
21
|
+
*/
|
|
22
|
+
type: TipTapNodeType;
|
|
23
|
+
/**
|
|
24
|
+
* @description 数据标识
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof ITipTapDropData
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description 数据标题
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof ITipTapDropData
|
|
33
|
+
*/
|
|
34
|
+
label: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 扩展的节点配置:在 Tiptap NodeConfig 基础上增加清洗相关配置
|
|
38
|
+
*/
|
|
39
|
+
export interface TipTapNodeConfig extends NodeConfig {
|
|
40
|
+
/**
|
|
41
|
+
* @description 节点在 getHTML() 输出中的表示
|
|
42
|
+
* @param el 该节点对应的 DOM 元素
|
|
43
|
+
* @returns 指定的html字符串
|
|
44
|
+
*/
|
|
45
|
+
getHTML?: (el: Element) => string;
|
|
46
|
+
/**
|
|
47
|
+
* @description 用于定位该节点 DOM 的选择器
|
|
48
|
+
* 不传时默认使用 [data-type="节点名"]
|
|
49
|
+
*/
|
|
50
|
+
htmlSelector?: string;
|
|
51
|
+
}
|