@ibiz-template-plugin/ai-chat 0.0.117 → 0.0.118
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 +17438 -14536
- package/dist/index.legacy.js +2 -2
- package/dist/style.css +2 -2
- package/dist/types/components/chat-back-bottom/chat-back-bottom.d.ts +5 -3
- package/dist/types/components/chat-file-preview/components/custom-chat-file-preview/custom-chat-file-preview.d.ts +19 -0
- package/dist/types/components/chat-file-preview/components/default-chat-file-preview/default-chat-file-preview.d.ts +19 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +10 -9
- package/dist/types/components/chat-messages/use-message-renderer.d.ts +89 -0
- package/dist/types/components/chat-net-disk/file-move-panel/file-move-panel.d.ts +27 -0
- package/dist/types/components/common/actions/actions.d.ts +29 -0
- package/dist/types/components/common/context-menu/context-menu.d.ts +34 -0
- package/dist/types/components/common/drawer/drawer.d.ts +6 -1
- package/dist/types/components/common/index.d.ts +9 -0
- package/dist/types/components/common/inline-editor/inline-editor.d.ts +13 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +31 -3
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +46 -5
- package/dist/types/components/common/modal/modal.d.ts +37 -0
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +5 -1
- package/dist/types/components/popup/popup.d.ts +2 -1
- package/dist/types/controller/file-system/file-system.controller.d.ts +68 -1
- package/dist/types/controller/overlay/drawer-overlay.controller.d.ts +7 -0
- package/dist/types/controller/overlay/index.d.ts +1 -0
- package/dist/types/controller/overlay/modal-overlay.controller.d.ts +47 -0
- package/dist/types/icons/index.d.ts +2 -1
- package/dist/types/icons/move-file-svg.d.ts +1 -0
- package/dist/types/icons/new-folder-svg.d.ts +1 -0
- package/dist/types/icons/system-file/archive.d.ts +7 -0
- package/dist/types/icons/system-file/audio.d.ts +5 -0
- package/dist/types/icons/system-file/excel.d.ts +1 -1
- package/dist/types/icons/system-file/image.d.ts +7 -0
- package/dist/types/icons/system-file/ppt.d.ts +0 -1
- package/dist/types/icons/system-file/program.d.ts +17 -0
- package/dist/types/icons/system-file/text.d.ts +4 -0
- package/dist/types/icons/system-file/video.d.ts +6 -0
- package/dist/types/icons/system-file/word.d.ts +7 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +6 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +6 -0
- package/dist/types/interface/i-file-system-options/i-file-system-options.d.ts +156 -3
- package/dist/types/locale/en/index.d.ts +11 -0
- package/dist/types/locale/zh-CN/index.d.ts +11 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/util/system-file.d.ts +2 -0
- package/package.json +2 -2
- package/dist/types/components/chat-messages/use-virtual-list.d.ts +0 -156
- package/dist/types/components/chat-scrollbar/chat-scrollbar.d.ts +0 -102
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
import { OverlayController } from './overlay.controller';
|
|
3
|
+
|
|
4
|
+
interface ModalOpenOptions {
|
|
5
|
+
/** 头部图标 */
|
|
6
|
+
icon?: VNode;
|
|
7
|
+
/** 容器(DOM 元素或选择器),不传默认 body */
|
|
8
|
+
container?: HTMLElement | string;
|
|
9
|
+
/** 内容组件 */
|
|
10
|
+
component: any;
|
|
11
|
+
/** 传递给内容组件的参数 */
|
|
12
|
+
props?: Record<string, any>;
|
|
13
|
+
/** 是否显示遮罩,默认 true */
|
|
14
|
+
mask?: boolean;
|
|
15
|
+
/** 是否显示右上角关闭按钮,默认 true */
|
|
16
|
+
showClose?: boolean;
|
|
17
|
+
/** 点击遮罩是否关闭,默认 true */
|
|
18
|
+
maskClosable?: boolean;
|
|
19
|
+
/** 按 Esc 是否关闭,默认 true */
|
|
20
|
+
escClosable?: boolean;
|
|
21
|
+
/** 外部扩展类名 */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** 标题 */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** 宽度 */
|
|
26
|
+
width?: number | string;
|
|
27
|
+
/** 高度 */
|
|
28
|
+
height?: number | string;
|
|
29
|
+
/** 垂直居中,默认 true */
|
|
30
|
+
centered?: boolean;
|
|
31
|
+
/** 关闭回调 */
|
|
32
|
+
onClose?: (params?: {
|
|
33
|
+
ok: boolean;
|
|
34
|
+
data: any;
|
|
35
|
+
}) => void;
|
|
36
|
+
/** 事件源 */
|
|
37
|
+
event?: MouseEvent;
|
|
38
|
+
}
|
|
39
|
+
declare class ModalOverlayController extends OverlayController {
|
|
40
|
+
constructor();
|
|
41
|
+
/**
|
|
42
|
+
* @description 打开模态框
|
|
43
|
+
*/
|
|
44
|
+
open(options: ModalOpenOptions): void;
|
|
45
|
+
}
|
|
46
|
+
export declare const modalController: ModalOverlayController;
|
|
47
|
+
export {};
|
|
@@ -55,5 +55,6 @@ 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';
|
|
58
|
+
export { NewFolderSvg, NewFileSvg } from './new-folder-svg';
|
|
59
59
|
export { EyeSvg } from './eye-svg';
|
|
60
|
+
export { MoveFileSvg } from './move-file-svg';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MoveFileSvg: () => import("preact").JSX.Element;
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare const archive: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const zip: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const rar: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const _7z: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const tar: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const dmg: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const jar: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const apk: () => import("preact").JSX.Element;
|
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export declare const audio: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const mp3: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const wav: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const flac: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const aac: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const wma: () => import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const xls: () => import("preact").JSX.Element;
|
|
2
2
|
export declare const xlsx: () => import("preact").JSX.Element;
|
|
3
3
|
export declare const xlsm: () => import("preact").JSX.Element;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const numbers: () => import("preact").JSX.Element;
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare const image: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const jpeg: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const png: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const gif: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const bmp: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const webp: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const svg: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const ico: () => import("preact").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const ppt: () => import("preact").JSX.Element;
|
|
2
2
|
export declare const pptx: () => import("preact").JSX.Element;
|
|
3
3
|
export declare const pptm: () => import("preact").JSX.Element;
|
|
4
|
-
export declare const _ppt: () => import("preact").JSX.Element;
|
|
5
4
|
export declare const pdf: () => import("preact").JSX.Element;
|
|
@@ -1 +1,18 @@
|
|
|
1
1
|
export declare const program: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const exe: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const msi: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const cmd: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const sh: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const fish: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const js: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const ts: () => import("preact").JSX.Element;
|
|
9
|
+
export declare const app: () => import("preact").JSX.Element;
|
|
10
|
+
export declare const dylib: () => import("preact").JSX.Element;
|
|
11
|
+
export declare const _class: () => import("preact").JSX.Element;
|
|
12
|
+
export declare const py: () => import("preact").JSX.Element;
|
|
13
|
+
export declare const php: () => import("preact").JSX.Element;
|
|
14
|
+
export declare const go: () => import("preact").JSX.Element;
|
|
15
|
+
export declare const swift: () => import("preact").JSX.Element;
|
|
16
|
+
export declare const java: () => import("preact").JSX.Element;
|
|
17
|
+
export declare const sql: () => import("preact").JSX.Element;
|
|
18
|
+
export declare const groovy: () => import("preact").JSX.Element;
|
|
@@ -12,6 +12,10 @@ export declare const cfg: () => import("preact").JSX.Element;
|
|
|
12
12
|
export declare const conf: () => import("preact").JSX.Element;
|
|
13
13
|
export declare const html: () => import("preact").JSX.Element;
|
|
14
14
|
export declare const css: () => import("preact").JSX.Element;
|
|
15
|
+
export declare const scss: () => import("preact").JSX.Element;
|
|
15
16
|
export declare const jsx: () => import("preact").JSX.Element;
|
|
16
17
|
export declare const tsx: () => import("preact").JSX.Element;
|
|
17
18
|
export declare const vue: () => import("preact").JSX.Element;
|
|
19
|
+
export declare const text: () => import("preact").JSX.Element;
|
|
20
|
+
export declare const ftl: () => import("preact").JSX.Element;
|
|
21
|
+
export declare const hbs: () => import("preact").JSX.Element;
|
|
@@ -3,3 +3,9 @@ export declare const mp4: () => import("preact").JSX.Element;
|
|
|
3
3
|
export declare const m4v: () => import("preact").JSX.Element;
|
|
4
4
|
export declare const mkv: () => import("preact").JSX.Element;
|
|
5
5
|
export declare const avi: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const mov: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const wmv: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const flv: () => import("preact").JSX.Element;
|
|
9
|
+
export declare const f4v: () => import("preact").JSX.Element;
|
|
10
|
+
export declare const mpg: () => import("preact").JSX.Element;
|
|
11
|
+
export declare const mpeg: () => import("preact").JSX.Element;
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare const word: () => import("preact").JSX.Element;
|
|
2
|
+
export declare const doc: () => import("preact").JSX.Element;
|
|
3
|
+
export declare const docx: () => import("preact").JSX.Element;
|
|
4
|
+
export declare const docm: () => import("preact").JSX.Element;
|
|
5
|
+
export declare const dot: () => import("preact").JSX.Element;
|
|
6
|
+
export declare const odt: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const rtf: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const wps: () => import("preact").JSX.Element;
|
|
@@ -149,4 +149,10 @@ export interface IChatContainerOptions {
|
|
|
149
149
|
* @memberof IChatContainerOptions
|
|
150
150
|
*/
|
|
151
151
|
minimizeOptions: IMinimizeOptions;
|
|
152
|
+
/**
|
|
153
|
+
* @description 是否隐藏嵌入AI聊天框头部区域,仅嵌入AI聊天框生效
|
|
154
|
+
* @type {boolean}
|
|
155
|
+
* @memberof IChatContainerOptions
|
|
156
|
+
*/
|
|
157
|
+
isEmbedAiHeaderHidden?: boolean;
|
|
152
158
|
}
|
|
@@ -304,6 +304,12 @@ export interface IChatOptions extends IChat {
|
|
|
304
304
|
* @type {number}
|
|
305
305
|
*/
|
|
306
306
|
chatMessagePageSize: number;
|
|
307
|
+
/**
|
|
308
|
+
* @description AI聊天框是否启用工作空间(文件系统)相关操作,默认值为true,若为false,则无工作空间图标
|
|
309
|
+
* @type {boolean}
|
|
310
|
+
* @memberof IChatOptions
|
|
311
|
+
*/
|
|
312
|
+
enableWorkSpace: boolean;
|
|
307
313
|
/**
|
|
308
314
|
* 消息提示工具类工具
|
|
309
315
|
*/
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { IFileItem } from '../i-file-item/i-file-item';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @description 查询文件列表参数
|
|
5
|
+
* @interface IFileSystemListParams
|
|
6
|
+
*/
|
|
7
|
+
interface IFileSystemListParams {
|
|
4
8
|
sessionid: string;
|
|
5
9
|
srfaiagent?: string;
|
|
6
10
|
srfscope?: string;
|
|
@@ -9,28 +13,132 @@ interface IFileSystemParams {
|
|
|
9
13
|
file_path?: string;
|
|
10
14
|
only_dirs?: boolean;
|
|
11
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @description 上传文件参数
|
|
18
|
+
* @interface IFileSystemUploadParams
|
|
19
|
+
*/
|
|
12
20
|
interface IFileSystemUploadParams {
|
|
13
21
|
sessionid: string;
|
|
14
22
|
file_path: string;
|
|
15
23
|
srfaiagent?: string;
|
|
16
24
|
srfscope?: string;
|
|
17
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @description 新建目录参数
|
|
28
|
+
* @interface IFileSystemCreateParams
|
|
29
|
+
*/
|
|
30
|
+
interface IFileSystemCreateParams {
|
|
31
|
+
sessionid: string;
|
|
32
|
+
file_path: string;
|
|
33
|
+
srfaiagent?: string;
|
|
34
|
+
srfscope?: string;
|
|
35
|
+
create_parents?: boolean;
|
|
36
|
+
timeout?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @description 新建文件参数
|
|
40
|
+
* @interface IFileSystemWriteParams
|
|
41
|
+
*/
|
|
42
|
+
interface IFileSystemWriteParams {
|
|
43
|
+
sessionid: string;
|
|
44
|
+
file_path: string;
|
|
45
|
+
content: string;
|
|
46
|
+
srfaiagent?: string;
|
|
47
|
+
srfscope?: string;
|
|
48
|
+
append?: boolean;
|
|
49
|
+
timeout?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @description 移动文件参数
|
|
53
|
+
* @interface IFileSystemMoveParams
|
|
54
|
+
*/
|
|
55
|
+
interface IFileSystemMoveParams {
|
|
56
|
+
sessionid: string;
|
|
57
|
+
src: string;
|
|
58
|
+
dst: string;
|
|
59
|
+
srfaiagent?: string;
|
|
60
|
+
srfscope?: string;
|
|
61
|
+
overwrite?: boolean;
|
|
62
|
+
create_parents?: boolean;
|
|
63
|
+
timeout?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @description 删除文件参数
|
|
67
|
+
* @interface IFileSystemDeleteParams
|
|
68
|
+
*/
|
|
69
|
+
interface IFileSystemDeleteParams {
|
|
70
|
+
sessionid: string;
|
|
71
|
+
file_path: string;
|
|
72
|
+
srfaiagent?: string;
|
|
73
|
+
srfscope?: string;
|
|
74
|
+
recursive?: boolean;
|
|
75
|
+
timeout?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description 读取文件参数
|
|
79
|
+
* @interface IFileSystemReadParams
|
|
80
|
+
*/
|
|
81
|
+
interface IFileSystemReadParams {
|
|
82
|
+
sessionid: string;
|
|
83
|
+
file_path: string;
|
|
84
|
+
srfaiagent?: string;
|
|
85
|
+
srfscope?: string;
|
|
86
|
+
offset?: number;
|
|
87
|
+
length?: number;
|
|
88
|
+
binary?: boolean;
|
|
89
|
+
timeout?: number;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @description 文件操作结果对象
|
|
93
|
+
* @interface IFileSystemResult
|
|
94
|
+
*/
|
|
95
|
+
interface IFileSystemResult {
|
|
96
|
+
ok: boolean;
|
|
97
|
+
action: 'MKDIR' | 'WRITE' | 'MOVE' | 'DELETE' | 'READ';
|
|
98
|
+
path: string;
|
|
99
|
+
transport: 'native' | 'command';
|
|
100
|
+
content?: string;
|
|
101
|
+
content_length?: number;
|
|
102
|
+
error?: {
|
|
103
|
+
code: string;
|
|
104
|
+
message: string;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
18
107
|
/**
|
|
19
108
|
* @description 文件系统操作参数
|
|
20
109
|
* @export
|
|
21
110
|
* @interface IFileSystemOptions
|
|
22
111
|
*/
|
|
23
112
|
export interface IFileSystemOptions {
|
|
113
|
+
/**
|
|
114
|
+
* @description 文件预览模式,默认值为DEFAULT
|
|
115
|
+
* @type {('DEFAULT' | 'CUSTOM')}
|
|
116
|
+
* @memberof IFileSystemOptions
|
|
117
|
+
*/
|
|
118
|
+
filePreviewMode?: 'DEFAULT' | 'CUSTOM';
|
|
119
|
+
/**
|
|
120
|
+
* @description 获取自定义文件预览url
|
|
121
|
+
* @param {object} ctx
|
|
122
|
+
* @param {object} param
|
|
123
|
+
* @param {{ id: string; name: string; folder: string }} file
|
|
124
|
+
* @returns {*} {Promise<string>}
|
|
125
|
+
* @memberof IFileSystemOptions
|
|
126
|
+
*/
|
|
127
|
+
getCustomFilePreviewUrl?(ctx: object, param: object, file: {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
folder: string;
|
|
131
|
+
}): Promise<string>;
|
|
24
132
|
/**
|
|
25
133
|
* @description 获取文件清单
|
|
26
134
|
* @memberof IFileSystemOptions
|
|
27
135
|
*/
|
|
28
|
-
getFileList: (
|
|
136
|
+
getFileList: (ctx: object, param: object, other: IFileSystemListParams) => Promise<IFileItem | undefined>;
|
|
29
137
|
/**
|
|
30
138
|
* @description 上传文件
|
|
31
139
|
* @memberof IFileSystemOptions
|
|
32
140
|
*/
|
|
33
|
-
uploadFile: (
|
|
141
|
+
uploadFile: (ctx: object, param: object, other: IFileSystemUploadParams) => Promise<{
|
|
34
142
|
id: string;
|
|
35
143
|
name: string;
|
|
36
144
|
folder: string;
|
|
@@ -57,5 +165,50 @@ export interface IFileSystemOptions {
|
|
|
57
165
|
* @memberof IFileSystemOptions
|
|
58
166
|
*/
|
|
59
167
|
getImgContent(ctx: object, param: object, id: string, type: string, cat: string): Promise<string>;
|
|
168
|
+
/**
|
|
169
|
+
* @description 新建文件夹
|
|
170
|
+
* @param {object} ctx
|
|
171
|
+
* @param {object} param
|
|
172
|
+
* @param {IFileSystemCreateParams} other
|
|
173
|
+
* @returns {*} {Promise<IFileSystemResult>}
|
|
174
|
+
* @memberof IFileSystemOptions
|
|
175
|
+
*/
|
|
176
|
+
createFolder(ctx: object, param: object, other: IFileSystemCreateParams): Promise<IFileSystemResult>;
|
|
177
|
+
/**
|
|
178
|
+
* @description 新建文件
|
|
179
|
+
* @param {object} ctx
|
|
180
|
+
* @param {object} param
|
|
181
|
+
* @param {IFileSystemWriteParams} other
|
|
182
|
+
* @returns {*} {Promise<IFileSystemResult>}
|
|
183
|
+
* @memberof IFileSystemOptions
|
|
184
|
+
*/
|
|
185
|
+
createFile(ctx: object, param: object, other: IFileSystemWriteParams): Promise<IFileSystemResult>;
|
|
186
|
+
/**
|
|
187
|
+
* @description 移动文件夹/文件,包含文件夹/文件重命名均调用此接口
|
|
188
|
+
* @param {object} ctx
|
|
189
|
+
* @param {object} param
|
|
190
|
+
* @param {IFileSystemMoveParams} other
|
|
191
|
+
* @returns {*} {Promise<IFileSystemResult>}
|
|
192
|
+
* @memberof IFileSystemOptions
|
|
193
|
+
*/
|
|
194
|
+
move(ctx: object, param: object, other: IFileSystemMoveParams): Promise<IFileSystemResult>;
|
|
195
|
+
/**
|
|
196
|
+
* @description 删除文件夹/文件
|
|
197
|
+
* @param {object} ctx
|
|
198
|
+
* @param {object} param
|
|
199
|
+
* @param {IFileSystemDeleteParams} other
|
|
200
|
+
* @returns {*} {Promise<IFileSystemResult>}
|
|
201
|
+
* @memberof IFileSystemOptions
|
|
202
|
+
*/
|
|
203
|
+
delete(ctx: object, param: object, other: IFileSystemDeleteParams): Promise<IFileSystemResult>;
|
|
204
|
+
/**
|
|
205
|
+
* @description 读文件内容
|
|
206
|
+
* @param {object} ctx
|
|
207
|
+
* @param {object} param
|
|
208
|
+
* @param {IFileSystemReadParams} other
|
|
209
|
+
* @returns {*} {Promise<IFileSystemResult>}
|
|
210
|
+
* @memberof IFileSystemOptions
|
|
211
|
+
*/
|
|
212
|
+
readFile(ctx: object, param: object, other: IFileSystemReadParams): Promise<IFileSystemResult>;
|
|
60
213
|
}
|
|
61
214
|
export {};
|
|
@@ -165,4 +165,15 @@ export declare const EN: {
|
|
|
165
165
|
size: string;
|
|
166
166
|
type: string;
|
|
167
167
|
folder: string;
|
|
168
|
+
move: string;
|
|
169
|
+
new: string;
|
|
170
|
+
newFile: string;
|
|
171
|
+
newFolder: string;
|
|
172
|
+
folderName: string;
|
|
173
|
+
cannotEmpty: string;
|
|
174
|
+
moveToNone: string;
|
|
175
|
+
moveToSelf: string;
|
|
176
|
+
moveToDescendant: string;
|
|
177
|
+
moveToSameParent: string;
|
|
178
|
+
fileAlreadyExists: string;
|
|
168
179
|
};
|
|
@@ -165,4 +165,15 @@ export declare const ZH_CN: {
|
|
|
165
165
|
size: string;
|
|
166
166
|
type: string;
|
|
167
167
|
folder: string;
|
|
168
|
+
move: string;
|
|
169
|
+
new: string;
|
|
170
|
+
newFile: string;
|
|
171
|
+
newFolder: string;
|
|
172
|
+
folderName: string;
|
|
173
|
+
cannotEmpty: string;
|
|
174
|
+
moveToNone: string;
|
|
175
|
+
moveToSelf: string;
|
|
176
|
+
moveToDescendant: string;
|
|
177
|
+
moveToSameParent: string;
|
|
178
|
+
fileAlreadyExists: string;
|
|
168
179
|
};
|
|
@@ -12,4 +12,4 @@ export { ChatStepParser } from './util/chat-step-parser';
|
|
|
12
12
|
export { ChatUIActionParser } from './util/chat-ui-action-parser';
|
|
13
13
|
export { ContentProtector } from './util/content-protector';
|
|
14
14
|
export { TextUtil } from './util/util';
|
|
15
|
-
export { FileIcon } from './util/system-file';
|
|
15
|
+
export { FileIcon, FolderIcon } from './util/system-file';
|
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.118",
|
|
4
4
|
"description": "iBiz AI交互框插件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"publish:local": "npm run build && npm publish --access public --registry=http://172.16.240.221:8081/repository/local/"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ibiz-template-plugin/ibiz-file-previewer": "^0.0.
|
|
32
|
+
"@ibiz-template-plugin/ibiz-file-previewer": "^0.0.27",
|
|
33
33
|
"@ibiz-template/scss-utils": "^0.0.2",
|
|
34
34
|
"@preact/signals": "^1.2.1",
|
|
35
35
|
"@tiptap/core": "^3.11.1",
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'preact';
|
|
2
|
-
import { ReadonlySignal, Signal } from '@preact/signals';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 虚拟列表项
|
|
6
|
-
*
|
|
7
|
-
* @author zpc
|
|
8
|
-
* @date 2026-09-20
|
|
9
|
-
*/
|
|
10
|
-
export interface VirtualItem {
|
|
11
|
-
/**
|
|
12
|
-
* 数据源中的实际索引
|
|
13
|
-
*
|
|
14
|
-
* @type {number}
|
|
15
|
-
*/
|
|
16
|
-
index: number;
|
|
17
|
-
/**
|
|
18
|
-
* 稳定 key(如 messageid),用于测量缓存
|
|
19
|
-
*
|
|
20
|
-
* @type {string}
|
|
21
|
-
*/
|
|
22
|
-
key: string;
|
|
23
|
-
/**
|
|
24
|
-
* 该项在列表中的 top 偏移(累计高度)
|
|
25
|
-
*
|
|
26
|
-
* @type {number}
|
|
27
|
-
*/
|
|
28
|
-
start: number;
|
|
29
|
-
/**
|
|
30
|
-
* 当前高度(实测或预估)
|
|
31
|
-
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
*/
|
|
34
|
-
size: number;
|
|
35
|
-
/**
|
|
36
|
-
* 绑定到项包裹元素的 ref,用于 ResizeObserver 实测高度
|
|
37
|
-
*
|
|
38
|
-
* @type {(el: HTMLElement | null) => void}
|
|
39
|
-
*/
|
|
40
|
-
measureRef: (el: HTMLElement | null) => void;
|
|
41
|
-
}
|
|
42
|
-
export interface UseVirtualListOptions {
|
|
43
|
-
/**
|
|
44
|
-
* 总条数
|
|
45
|
-
*
|
|
46
|
-
* @type {number}
|
|
47
|
-
*/
|
|
48
|
-
count: number;
|
|
49
|
-
/**
|
|
50
|
-
* 根据索引返回稳定 key(用于按 key 缓存实测高度,避免前插/删除时按下标错位)
|
|
51
|
-
*
|
|
52
|
-
* @type {(index: number) => string}
|
|
53
|
-
*/
|
|
54
|
-
getItemKey: (index: number) => string;
|
|
55
|
-
/**
|
|
56
|
-
* 未渲染项的预估高度
|
|
57
|
-
*
|
|
58
|
-
* @type {(index: number) => number}
|
|
59
|
-
*/
|
|
60
|
-
estimateSize: (index: number) => number;
|
|
61
|
-
/**
|
|
62
|
-
* 可视区上下各多渲染的条数
|
|
63
|
-
*
|
|
64
|
-
* @type {number}
|
|
65
|
-
*/
|
|
66
|
-
overscan?: number;
|
|
67
|
-
}
|
|
68
|
-
export interface UseVirtualListResult {
|
|
69
|
-
/**
|
|
70
|
-
* 挂到滚动容器上的 ref
|
|
71
|
-
*
|
|
72
|
-
* @type {RefObject<HTMLDivElement>}
|
|
73
|
-
*/
|
|
74
|
-
containerRef: RefObject<HTMLDivElement>;
|
|
75
|
-
/**
|
|
76
|
-
* 当前可视区内的虚拟项
|
|
77
|
-
*
|
|
78
|
-
* @type {VirtualItem[]}
|
|
79
|
-
*/
|
|
80
|
-
virtualItems: VirtualItem[];
|
|
81
|
-
/**
|
|
82
|
-
* 整个列表的总高度(spacer 高度)
|
|
83
|
-
*
|
|
84
|
-
* @type {number}
|
|
85
|
-
*/
|
|
86
|
-
totalSize: number;
|
|
87
|
-
/**
|
|
88
|
-
* 每项起始偏移的前缀和(长度 count + 1,最后一项为总高度)
|
|
89
|
-
*
|
|
90
|
-
* @type {number[]}
|
|
91
|
-
*/
|
|
92
|
-
offsets: number[];
|
|
93
|
-
/**
|
|
94
|
-
* 取某下标的起始偏移(供滚动锚定使用)
|
|
95
|
-
*
|
|
96
|
-
* @type {(index: number) => number}
|
|
97
|
-
*/
|
|
98
|
-
getOffset: (index: number) => number;
|
|
99
|
-
/**
|
|
100
|
-
* @description 恢复滚动条位置
|
|
101
|
-
* @memberof UseVirtualListResult
|
|
102
|
-
*/
|
|
103
|
-
restoreScrollPosition: () => void;
|
|
104
|
-
/**
|
|
105
|
-
* 响应式总高度:依赖测量版本号(实测高度回填)与条数,供自定义滚动条订阅
|
|
106
|
-
*
|
|
107
|
-
* @type {ReadonlySignal<number>}
|
|
108
|
-
*/
|
|
109
|
-
totalSizeSignal: ReadonlySignal<number>;
|
|
110
|
-
/**
|
|
111
|
-
* 容器 scrollTop 信号(供自定义滚动条计算 thumb 位置)
|
|
112
|
-
*
|
|
113
|
-
* @type {Signal<number>}
|
|
114
|
-
*/
|
|
115
|
-
scrollTopSignal: Signal<number>;
|
|
116
|
-
/**
|
|
117
|
-
* 容器可视高度信号
|
|
118
|
-
*
|
|
119
|
-
* @type {Signal<number>}
|
|
120
|
-
*/
|
|
121
|
-
clientHeightSignal: Signal<number>;
|
|
122
|
-
/**
|
|
123
|
-
* 自定义滚动条拖动状态:拖动中跳过头部前插的 scrollTop 补偿,由滚动条按指针比例重映射接管
|
|
124
|
-
*
|
|
125
|
-
* @type {Signal<boolean>}
|
|
126
|
-
*/
|
|
127
|
-
isDragging: Signal<boolean>;
|
|
128
|
-
/**
|
|
129
|
-
* 程序化设置滚动位置:同步 scrollTop 信号 + 直接写容器 scrollTop(clamp 到当前可滚动范围)
|
|
130
|
-
*
|
|
131
|
-
* @type {(top: number) => void}
|
|
132
|
-
*/
|
|
133
|
-
setScrollTop: (top: number) => void;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* 动态高度虚拟列表 Hook
|
|
137
|
-
*
|
|
138
|
-
* ## 核心思想
|
|
139
|
-
* 消息列表里每条消息高度都不同(markdown、代码块、图片、折叠、流式增长),
|
|
140
|
-
* 若全部渲染 DOM 节点会随消息数线性增长导致卡顿。本 Hook 只渲染「视口内 + overscan」的消息:
|
|
141
|
-
* - 用一条 `height: totalSize` 的 spacer div 撑起可滚动总高度;
|
|
142
|
-
* - 每条消息用 `position:absolute + transform:translateY(start)` 定位到对应偏移;
|
|
143
|
-
* - 已渲染项用 ResizeObserver 实测真实高度,未渲染项用 `estimateSize` 预估占位。
|
|
144
|
-
*
|
|
145
|
-
* ## 为什么按 key 缓存而非按下标
|
|
146
|
-
* 消息会「头部前插」(加载历史)和「删除」,导致已有消息的数组下标整体平移。
|
|
147
|
-
* 若按下标缓存实测高度,前插后所有测量值会错位。因此用 `getItemKey`(messageid)作为测量缓存的键。
|
|
148
|
-
*
|
|
149
|
-
* ## 数据流
|
|
150
|
-
* scrollTop / clientHeight / measureVersion 三个信号变化 → useMemo 重算 offsets(前缀和)
|
|
151
|
-
* → 二分查找可视区间 → 产出 virtualItems → 组件只渲染这些项。
|
|
152
|
-
*
|
|
153
|
-
* @author zpc
|
|
154
|
-
* @date 2026-09-20
|
|
155
|
-
*/
|
|
156
|
-
export declare const useVirtualList: (options: UseVirtualListOptions) => UseVirtualListResult;
|