@ibiz-template-plugin/ai-chat 0.0.114 → 0.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +7930 -7045
- package/dist/index.legacy.js +1 -1
- package/dist/style.css +1 -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 +81 -4
- package/dist/types/components/chat-editor/node/mention-node.d.ts +3 -0
- package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +7 -0
- package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +16 -0
- package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +59 -0
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +26 -1
- package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +39 -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 +102 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +25 -10
- package/dist/types/controller/chat/chat-base.controller.d.ts +7 -0
- package/dist/types/controller/index.d.ts +1 -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 +30 -4
- package/dist/types/interface/i-project/i-project.d.ts +26 -0
- package/dist/types/interface/index.d.ts +2 -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 +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, JSX } from 'preact';
|
|
2
2
|
import { Namespace } from '../../utils';
|
|
3
|
-
import { AiChatController, AiTopicController } from '../../controller';
|
|
3
|
+
import { AiActionPanelController, AiChatController, AiTopicController } from '../../controller';
|
|
4
4
|
import { IAutoClose, IChatToolbarItem, IChatContainerOptions } from '../../interface';
|
|
5
5
|
|
|
6
6
|
export interface ChatContainerProps {
|
|
@@ -101,6 +101,13 @@ export interface ChatContainerProps {
|
|
|
101
101
|
* 是否加载中
|
|
102
102
|
*/
|
|
103
103
|
isLoading: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* 操作区面板控制器
|
|
106
|
+
*
|
|
107
|
+
* @type {AiActionPanelController}
|
|
108
|
+
* @memberof ChatContainerProps
|
|
109
|
+
*/
|
|
110
|
+
actionPanel?: AiActionPanelController;
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
106
113
|
* 容器状态
|
|
@@ -152,6 +159,13 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
152
159
|
* 已绑定事件监听的聊天控制器实例(用于切换 aiChat 时重绑)
|
|
153
160
|
*/
|
|
154
161
|
private listenedAIChat?;
|
|
162
|
+
/**
|
|
163
|
+
* @description 拖拽实例
|
|
164
|
+
* @private
|
|
165
|
+
* @type {(Interactable | undefined)}
|
|
166
|
+
* @memberof ChatContainer
|
|
167
|
+
*/
|
|
168
|
+
private interactable;
|
|
155
169
|
/**
|
|
156
170
|
* 消息完成事件回调
|
|
157
171
|
*/
|
|
@@ -162,6 +176,38 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
162
176
|
private onMinimizeChangeHandler;
|
|
163
177
|
listener(): void;
|
|
164
178
|
componentDidUpdate(): void;
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* 同步操作区面板状态(visible 边沿触发窗口宽度增减与位置适配,展开收起动画由 CSS 过渡完成)
|
|
182
|
+
*
|
|
183
|
+
* @memberof ChatContainer
|
|
184
|
+
*/
|
|
185
|
+
syncPanelState(): void;
|
|
186
|
+
/**
|
|
187
|
+
* 打开操作区面板:窗口增宽面板占用(面板 + 分隔条),右边界不够时压缩面板宽度,仍不够则窗口左移补足
|
|
188
|
+
*
|
|
189
|
+
* @param {AiActionPanelController} panel
|
|
190
|
+
* @memberof ChatContainer
|
|
191
|
+
*/
|
|
192
|
+
handlePanelOpen(panel: AiActionPanelController): void;
|
|
193
|
+
/**
|
|
194
|
+
* 关闭操作区面板:窗口宽度回落面板占用(面板 + 分隔条),并回退打开时的窗口左移量
|
|
195
|
+
*
|
|
196
|
+
* @memberof ChatContainer
|
|
197
|
+
*/
|
|
198
|
+
handlePanelClose(): void;
|
|
199
|
+
/**
|
|
200
|
+
* 恢复面板打开期间为适配右边界所做的窗口左移量
|
|
201
|
+
*/
|
|
202
|
+
restorePanelShift(): void;
|
|
203
|
+
/**
|
|
204
|
+
* 面板打开后适配屏幕右边界(全屏时窗口铺满屏幕无需适配)
|
|
205
|
+
* - 先压缩面板宽度(窗口总宽同步回落),仍溢出则窗口左移补足
|
|
206
|
+
*
|
|
207
|
+
* @param {AiActionPanelController} panel
|
|
208
|
+
* @memberof ChatContainer
|
|
209
|
+
*/
|
|
210
|
+
fitPanelToViewport(panel: AiActionPanelController): void;
|
|
165
211
|
ns: Namespace;
|
|
166
212
|
containerRef: import('preact').RefObject<HTMLDivElement>;
|
|
167
213
|
dragHandle: import('preact').RefObject<HTMLDivElement>;
|
|
@@ -176,16 +222,16 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
176
222
|
*/
|
|
177
223
|
data: {
|
|
178
224
|
side: {
|
|
225
|
+
x: number;
|
|
179
226
|
y: number;
|
|
180
|
-
height: number;
|
|
181
227
|
width: number;
|
|
182
|
-
|
|
228
|
+
height: number;
|
|
183
229
|
};
|
|
184
230
|
window: {
|
|
231
|
+
x: number;
|
|
185
232
|
y: number;
|
|
186
233
|
width: number;
|
|
187
234
|
height: number;
|
|
188
|
-
x: number;
|
|
189
235
|
};
|
|
190
236
|
minWidth: number;
|
|
191
237
|
minHeight: number;
|
|
@@ -224,6 +270,18 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
224
270
|
* 输入区高度拖动时其父容器高度(px)
|
|
225
271
|
*/
|
|
226
272
|
inputDragContainerHeight: number;
|
|
273
|
+
/**
|
|
274
|
+
* 操作区面板上一帧显示状态(用于 componentDidUpdate 边沿检测)
|
|
275
|
+
*/
|
|
276
|
+
private panelVisiblePrev;
|
|
277
|
+
/**
|
|
278
|
+
* 操作区面板打开导致的窗口左移量(px),关闭面板时恢复(不持久化)
|
|
279
|
+
*/
|
|
280
|
+
private panelShiftPx;
|
|
281
|
+
/**
|
|
282
|
+
* 操作区面板宽度拖动起始值(px)
|
|
283
|
+
*/
|
|
284
|
+
private panelDragStartWidth;
|
|
227
285
|
/**
|
|
228
286
|
* 容器上下文
|
|
229
287
|
*
|
|
@@ -249,6 +307,7 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
249
307
|
};
|
|
250
308
|
/**
|
|
251
309
|
* 计算靠边模式样式
|
|
310
|
+
* - 贴右模式下面板打开时窗口整体左移,保证右边缘不超出屏幕
|
|
252
311
|
*
|
|
253
312
|
* @param {('left' | 'right')} side
|
|
254
313
|
* @memberof ChatContainer
|
|
@@ -393,6 +452,24 @@ export declare class ChatContainer extends Component<ChatContainerProps, ChatCon
|
|
|
393
452
|
* 提交拖动边框后的输入区高度(持久化到状态与本地缓存)
|
|
394
453
|
*/
|
|
395
454
|
commitInputHeight: () => void;
|
|
455
|
+
/**
|
|
456
|
+
* 操作区面板宽度拖动开始
|
|
457
|
+
*/
|
|
458
|
+
handlePanelResizeStart: () => void;
|
|
459
|
+
/**
|
|
460
|
+
* 操作区面板宽度拖动中
|
|
461
|
+
* - 向左拖:主内容区变窄、面板变宽;向右拖反之
|
|
462
|
+
*/
|
|
463
|
+
handlePanelResizeMove: (delta: number) => void;
|
|
464
|
+
/**
|
|
465
|
+
* 操作区面板宽度拖动结束(持久化)
|
|
466
|
+
*/
|
|
467
|
+
handlePanelResizeEnd: () => void;
|
|
468
|
+
/**
|
|
469
|
+
* 绘制右侧操作区(含分隔条)
|
|
470
|
+
* - DOM 常驻,宽度随 visible 切换由 CSS 过渡展开/收起
|
|
471
|
+
*/
|
|
472
|
+
renderActionRegion(): JSX.Element | null;
|
|
396
473
|
render(): JSX.Element;
|
|
397
474
|
}
|
|
398
475
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
interface BreadcrumbProps {
|
|
3
|
+
/**
|
|
4
|
+
* 当前路径(根 -> 当前层)
|
|
5
|
+
*/
|
|
6
|
+
path: {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* 点击某一层跳转,-1 表示回到根
|
|
12
|
+
*/
|
|
13
|
+
onJump: (index: number) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const Breadcrumb: (props: BreadcrumbProps) => import("preact").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LazyTreeNode } from '../lazy-tree/lazy-tree';
|
|
2
|
+
|
|
3
|
+
interface LazyListTreeProps {
|
|
4
|
+
/**
|
|
5
|
+
* 根节点数据
|
|
6
|
+
*/
|
|
7
|
+
nodes: LazyTreeNode[];
|
|
8
|
+
/**
|
|
9
|
+
* 异步加载子节点方法
|
|
10
|
+
* 返回子节点数组
|
|
11
|
+
*/
|
|
12
|
+
lazyLoad?: (node: LazyTreeNode) => Promise<LazyTreeNode[]>;
|
|
13
|
+
/**
|
|
14
|
+
* 节点选中回调
|
|
15
|
+
*/
|
|
16
|
+
onNodeCheck?: (node: LazyTreeNode, checked: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 节点点击回调
|
|
19
|
+
*/
|
|
20
|
+
onNodeClick?: (node: LazyTreeNode, event: MouseEvent) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 节点展开回调
|
|
23
|
+
*/
|
|
24
|
+
onNodeExpand?: (node: LazyTreeNode, expanded: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 路径变化回调,用于父组件同步面包屑
|
|
27
|
+
*/
|
|
28
|
+
onPathChange?: (path: LazyTreeNode[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 受控路径(根 -> 当前层),由父组件传入
|
|
31
|
+
*/
|
|
32
|
+
path?: LazyTreeNode[];
|
|
33
|
+
/**
|
|
34
|
+
* 是否显示搜索框
|
|
35
|
+
*/
|
|
36
|
+
showSearch?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 默认选中keys
|
|
39
|
+
*/
|
|
40
|
+
defaultCheckedKeys?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* 高亮选中
|
|
43
|
+
*/
|
|
44
|
+
highlight?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 标识分隔符
|
|
47
|
+
*/
|
|
48
|
+
separator?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 过滤值
|
|
51
|
+
*/
|
|
52
|
+
filter?: string;
|
|
53
|
+
/**
|
|
54
|
+
* 是否可拖拽
|
|
55
|
+
*/
|
|
56
|
+
draggable?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare const LazyListTree: (props: LazyListTreeProps) => import("preact").JSX.Element;
|
|
59
|
+
export {};
|
|
@@ -40,8 +40,12 @@ export interface LazyTreeNode {
|
|
|
40
40
|
* 自定义图标
|
|
41
41
|
*/
|
|
42
42
|
icon?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 原始数据
|
|
45
|
+
*/
|
|
46
|
+
data: Record<string, any>;
|
|
43
47
|
}
|
|
44
|
-
|
|
48
|
+
interface LazyTreeProps {
|
|
45
49
|
/**
|
|
46
50
|
* 根节点数据
|
|
47
51
|
*/
|
|
@@ -63,6 +67,14 @@ export interface LazyTreeProps {
|
|
|
63
67
|
* 节点展开回调
|
|
64
68
|
*/
|
|
65
69
|
onNodeExpand?: (node: LazyTreeNode, expanded: boolean) => void;
|
|
70
|
+
/**
|
|
71
|
+
* 当前活动路径变化回调(用户最后点击/展开的路径)
|
|
72
|
+
*/
|
|
73
|
+
onActivePathChange?: (path: LazyTreeNode[]) => void;
|
|
74
|
+
/**
|
|
75
|
+
* 当前激活路径
|
|
76
|
+
*/
|
|
77
|
+
activePath?: LazyTreeNode[];
|
|
66
78
|
/**
|
|
67
79
|
* 是否显示搜索框
|
|
68
80
|
*/
|
|
@@ -75,6 +87,10 @@ export interface LazyTreeProps {
|
|
|
75
87
|
* 高亮选中
|
|
76
88
|
*/
|
|
77
89
|
highlight?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* 高亮选中父节点
|
|
92
|
+
*/
|
|
93
|
+
highlightParent?: boolean;
|
|
78
94
|
/**
|
|
79
95
|
* 是否在点击节点的时候展开或者收缩节点
|
|
80
96
|
*/
|
|
@@ -83,6 +99,14 @@ export interface LazyTreeProps {
|
|
|
83
99
|
* 标识分隔符
|
|
84
100
|
*/
|
|
85
101
|
separator?: string;
|
|
102
|
+
/**
|
|
103
|
+
* 过滤值
|
|
104
|
+
*/
|
|
105
|
+
filter?: string;
|
|
106
|
+
/**
|
|
107
|
+
* 是否可拖拽
|
|
108
|
+
*/
|
|
109
|
+
draggable?: boolean;
|
|
86
110
|
}
|
|
87
111
|
/**
|
|
88
112
|
* 懒加载树组件
|
|
@@ -90,3 +114,4 @@ export interface LazyTreeProps {
|
|
|
90
114
|
* 具有懒加载、搜索、展开折叠等功能
|
|
91
115
|
*/
|
|
92
116
|
export declare const LazyTree: (props: LazyTreeProps) => import("preact").JSX.Element;
|
|
117
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, RefObject, JSX } from 'preact';
|
|
2
2
|
import { Namespace } from '../../utils';
|
|
3
3
|
import { AiChatController, AiTopicController } from '../../controller';
|
|
4
|
+
import { AiActionPanelController } from '../../controller/ai-action-panel/ai-action-panel.controller';
|
|
4
5
|
import { IChatToolbarItem, IExtensionOptions } from '../../interface';
|
|
5
6
|
|
|
6
7
|
export interface FlatChatContainerProps {
|
|
@@ -54,6 +55,12 @@ export interface FlatChatContainerProps {
|
|
|
54
55
|
* @memberof FlatChatContainerProps
|
|
55
56
|
*/
|
|
56
57
|
extension?: IExtensionOptions;
|
|
58
|
+
/**
|
|
59
|
+
* @description 操作区面板控制器
|
|
60
|
+
* @type {AiActionPanelController}
|
|
61
|
+
* @memberof FlatChatContainerProps
|
|
62
|
+
*/
|
|
63
|
+
actionPanel?: AiActionPanelController;
|
|
57
64
|
}
|
|
58
65
|
interface FlatContainerContext {
|
|
59
66
|
enableBackFill: boolean;
|
|
@@ -92,6 +99,14 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
92
99
|
* 输入区高度拖动时其父容器高度(px)
|
|
93
100
|
*/
|
|
94
101
|
inputDragContainerHeight: number;
|
|
102
|
+
/**
|
|
103
|
+
* 操作区面板上一帧显示状态(用于 componentDidUpdate 边沿检测)
|
|
104
|
+
*/
|
|
105
|
+
private panelVisiblePrev;
|
|
106
|
+
/**
|
|
107
|
+
* 操作区面板宽度拖动起始值(px)
|
|
108
|
+
*/
|
|
109
|
+
private panelDragStartWidth;
|
|
95
110
|
state: {
|
|
96
111
|
mountedSlots: Record<string, boolean>;
|
|
97
112
|
inputHeight: number | null;
|
|
@@ -116,6 +131,11 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
116
131
|
* @memberof FlatChatContainer
|
|
117
132
|
*/
|
|
118
133
|
componentDidUpdate(prevProps: FlatChatContainerProps): void;
|
|
134
|
+
/**
|
|
135
|
+
* @description 同步操作区面板状态(展开收起动画由 CSS 过渡完成)
|
|
136
|
+
* @memberof FlatChatContainer
|
|
137
|
+
*/
|
|
138
|
+
syncPanelState(): void;
|
|
119
139
|
/**
|
|
120
140
|
* @description 异步挂载扩展插槽
|
|
121
141
|
* @private
|
|
@@ -153,6 +173,19 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
153
173
|
* 侧栏宽度拖动结束
|
|
154
174
|
*/
|
|
155
175
|
handleSidebarResizeEnd: () => void;
|
|
176
|
+
/**
|
|
177
|
+
* 操作区面板宽度拖动开始
|
|
178
|
+
*/
|
|
179
|
+
handlePanelResizeStart: () => void;
|
|
180
|
+
/**
|
|
181
|
+
* 操作区面板宽度拖动中
|
|
182
|
+
* - 向左拖:主内容区变窄、面板变宽;向右拖反之
|
|
183
|
+
*/
|
|
184
|
+
handlePanelResizeMove: (delta: number) => void;
|
|
185
|
+
/**
|
|
186
|
+
* 操作区面板宽度拖动结束(持久化)
|
|
187
|
+
*/
|
|
188
|
+
handlePanelResizeEnd: () => void;
|
|
156
189
|
/**
|
|
157
190
|
* @description 获取输入区高度缓存key
|
|
158
191
|
* @returns {string}
|
|
@@ -189,6 +222,12 @@ export declare class FlatChatContainer extends Component<FlatChatContainerProps>
|
|
|
189
222
|
* @memberof FlatChatContainer
|
|
190
223
|
*/
|
|
191
224
|
renderHeader(): JSX.Element;
|
|
225
|
+
/**
|
|
226
|
+
* @description 绘制右侧操作区(含分隔条)
|
|
227
|
+
* - DOM 常驻,宽度随 visible 切换由 CSS 过渡展开/收起
|
|
228
|
+
* @memberof FlatChatContainer
|
|
229
|
+
*/
|
|
230
|
+
renderActionRegion(): JSX.Element | null;
|
|
192
231
|
render(): JSX.Element;
|
|
193
232
|
}
|
|
194
233
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ChatContainer } from './chat-container/chat-container';
|
|
2
2
|
export { FlatChatContainer } from './flat-chat-container/flat-chat-container';
|
|
3
|
+
export { ChatActionPanel } from './chat-action-panel/chat-action-panel';
|
|
3
4
|
export { SimpleChatContainer } from './simple-chat-container/simple-chat-container';
|
|
4
5
|
export { ChatQuesition } from './chat-quesition/chat-quesition';
|
|
@@ -18,6 +18,14 @@ export declare enum AIChatConst {
|
|
|
18
18
|
* 聊天输入区高度缓存
|
|
19
19
|
*/
|
|
20
20
|
INPUT_HEIGHT = "ai-chat-input-height",
|
|
21
|
+
/**
|
|
22
|
+
* 操作区面板宽度缓存
|
|
23
|
+
*/
|
|
24
|
+
ACTION_PANEL_WIDTH = "ai-chat-action-panel-width",
|
|
25
|
+
/**
|
|
26
|
+
* 操作区面板默认宽度(px)
|
|
27
|
+
*/
|
|
28
|
+
ACTION_PANEL_DEFAULT_WIDTH = 380,
|
|
21
29
|
/**
|
|
22
30
|
* 数据库名称
|
|
23
31
|
*/
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Signal } from '@preact/signals';
|
|
2
|
+
import { TActionPanelComponent } from '../../interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 将操作区面板宽度校正到合理区间 [最小宽度, 容器宽度/3]
|
|
6
|
+
*
|
|
7
|
+
* @param {number} width 目标宽度
|
|
8
|
+
* @param {number} containerWidth 容器整体宽度
|
|
9
|
+
* @returns {*} {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare function clampPanelWidth(width: number, containerWidth: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* 操作区面板控制器
|
|
14
|
+
* - 面板为容器级单例,挂在 ChatBaseController 上,切话题不重建
|
|
15
|
+
* - 展开收起动画由容器 CSS 过渡完成,控制器不参与
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
* @class AiActionPanelController
|
|
19
|
+
*/
|
|
20
|
+
export declare class AiActionPanelController {
|
|
21
|
+
/**
|
|
22
|
+
* 面板是否显示
|
|
23
|
+
*/
|
|
24
|
+
readonly visible: Signal<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* 面板当前宽度(px)
|
|
27
|
+
*/
|
|
28
|
+
readonly width: Signal<number>;
|
|
29
|
+
/**
|
|
30
|
+
* 面板标题
|
|
31
|
+
*/
|
|
32
|
+
readonly caption: Signal<string>;
|
|
33
|
+
/**
|
|
34
|
+
* 面板内容组件
|
|
35
|
+
*/
|
|
36
|
+
readonly component: Signal<TActionPanelComponent | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* 内容组件额外参数
|
|
39
|
+
*/
|
|
40
|
+
readonly params: Signal<Record<string, any> | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* 组件外层容器id(用于宽度缓存隔离)
|
|
43
|
+
*/
|
|
44
|
+
private compWrapperId;
|
|
45
|
+
/**
|
|
46
|
+
* 打开操作区面板
|
|
47
|
+
* - 已打开时仅替换标题、内容组件与额外参数
|
|
48
|
+
* - 首次打开时从缓存恢复面板宽度(无缓存则沿用当前值)
|
|
49
|
+
*
|
|
50
|
+
* @param {string} caption 标题
|
|
51
|
+
* @param {TActionPanelComponent} component 内容组件
|
|
52
|
+
* @param {Record<string, any>} [params] 额外参数(作为内容组件props传入)
|
|
53
|
+
* @memberof AiActionPanelController
|
|
54
|
+
*/
|
|
55
|
+
open(caption: string, component: TActionPanelComponent, params?: Record<string, any>): void;
|
|
56
|
+
/**
|
|
57
|
+
* 关闭操作区面板(收起动画由容器 CSS 过渡完成)
|
|
58
|
+
*
|
|
59
|
+
* @memberof AiActionPanelController
|
|
60
|
+
*/
|
|
61
|
+
close(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 更新面板宽度
|
|
64
|
+
*
|
|
65
|
+
* @param {number} px 宽度(px)
|
|
66
|
+
* @memberof AiActionPanelController
|
|
67
|
+
*/
|
|
68
|
+
updateWidth(px: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* 提交当前宽度(持久化)
|
|
71
|
+
*
|
|
72
|
+
* @memberof AiActionPanelController
|
|
73
|
+
*/
|
|
74
|
+
commitWidth(): void;
|
|
75
|
+
/**
|
|
76
|
+
* 注入组件外层容器id
|
|
77
|
+
*
|
|
78
|
+
* @param {string} id
|
|
79
|
+
* @memberof AiActionPanelController
|
|
80
|
+
*/
|
|
81
|
+
injectCompWrapperId(id: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* 读取宽度缓存
|
|
84
|
+
*
|
|
85
|
+
* @returns {*} {(number | undefined)}
|
|
86
|
+
* @memberof AiActionPanelController
|
|
87
|
+
*/
|
|
88
|
+
readWidthCache(): number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* 重置全部状态(整个聊天窗口关闭时调用)
|
|
91
|
+
*
|
|
92
|
+
* @memberof AiActionPanelController
|
|
93
|
+
*/
|
|
94
|
+
reset(): void;
|
|
95
|
+
/**
|
|
96
|
+
* 获取宽度缓存key
|
|
97
|
+
*
|
|
98
|
+
* @returns {string}
|
|
99
|
+
* @memberof AiActionPanelController
|
|
100
|
+
*/
|
|
101
|
+
private getCacheKey;
|
|
102
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Signal } from '@preact/signals';
|
|
2
2
|
import { QXEvent } from 'qx-util';
|
|
3
3
|
import { AIAgent, ChatMessage, KnowledgeBase } from '../../entity';
|
|
4
|
-
import { ITopic, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, IChatSuggestion, IResourceOptions, IChatMessageUsage, ITopicOptions } from '../../interface';
|
|
4
|
+
import { ITopic, IProject, IMaterial, IChatMessage, IChatOptions, IChatUIAction, IAIAgentConfig, IProjectParams, IChatSuggestion, IResourceOptions, IChatMessageUsage, ITopicOptions } from '../../interface';
|
|
5
5
|
import { AiTopicController } from '../ai-topic/ai-topic.controller';
|
|
6
|
+
import { AiActionPanelController } from '../ai-action-panel/ai-action-panel.controller';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* 聊天逻辑控制器
|
|
@@ -171,6 +172,10 @@ export declare class AiChatController {
|
|
|
171
172
|
* 话题控制器
|
|
172
173
|
*/
|
|
173
174
|
readonly aiTopic: AiTopicController | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* 操作区面板控制器(容器级单例,由聊天总控制器注入)
|
|
177
|
+
*/
|
|
178
|
+
readonly actionPanel: AiActionPanelController | undefined;
|
|
174
179
|
/**
|
|
175
180
|
* @description 聊天sessionid
|
|
176
181
|
* @type {string}
|
|
@@ -204,7 +209,7 @@ export declare class AiChatController {
|
|
|
204
209
|
/**
|
|
205
210
|
* 选中项目
|
|
206
211
|
*/
|
|
207
|
-
|
|
212
|
+
activeAIProjectId: string | undefined;
|
|
208
213
|
/**
|
|
209
214
|
* 当前可选知识库
|
|
210
215
|
*/
|
|
@@ -352,6 +357,15 @@ export declare class AiChatController {
|
|
|
352
357
|
* 加载更早的历史消息(滚动到列表顶部时调用)
|
|
353
358
|
*/
|
|
354
359
|
loadHistoryMore(): Promise<void>;
|
|
360
|
+
/**
|
|
361
|
+
* @description 尝试恢复会话(如果会话存在异步行为标识才恢复,没有则认为会话已经完成,不需要恢复)
|
|
362
|
+
* @author tony001
|
|
363
|
+
* @date 2026-10-14 18:10:07
|
|
364
|
+
* @private
|
|
365
|
+
* @returns {*} {Promise<void>}
|
|
366
|
+
* @memberof AiChatController
|
|
367
|
+
*/
|
|
368
|
+
private tryResumeChat;
|
|
355
369
|
/**
|
|
356
370
|
* 获取历史记录后续处理(仅查询history接口时调用)
|
|
357
371
|
*/
|
|
@@ -622,16 +636,17 @@ export declare class AiChatController {
|
|
|
622
636
|
searchAIAgent(query: string): Promise<AIAgent[]>;
|
|
623
637
|
/**
|
|
624
638
|
* @description 搜索项目
|
|
625
|
-
* @param {
|
|
626
|
-
* @
|
|
627
|
-
* @returns {*} {Promise<{ id: string; label: string; isLeaf: boolean }[]>}
|
|
639
|
+
* @param {IProjectParams} params 查询参数
|
|
640
|
+
* @returns {*} {Promise<IProject[]>}
|
|
628
641
|
* @memberof AiChatController
|
|
629
642
|
*/
|
|
630
|
-
searchProject(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
643
|
+
searchProject(params: IProjectParams): Promise<IProject[]>;
|
|
644
|
+
/**
|
|
645
|
+
* @description 设置选中项目目录
|
|
646
|
+
* @param {(string | undefined)} id
|
|
647
|
+
* @memberof AiChatController
|
|
648
|
+
*/
|
|
649
|
+
setActiveAIProjectID(id: string | undefined): void;
|
|
635
650
|
/**
|
|
636
651
|
* 设置选中知识库
|
|
637
652
|
* @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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AiChatController } from './ai-chat/ai-chat.controller';
|
|
2
2
|
export { AiTopicController } from './ai-topic/ai-topic.controller';
|
|
3
|
+
export { AiActionPanelController } from './ai-action-panel/ai-action-panel.controller';
|
|
3
4
|
export { AIMaterialFactory } from './ai-material/ai-material-factory';
|
|
4
5
|
export { ModalChatController, chat } from './chat/modal-chat.controller';
|
|
5
6
|
export { FlatChatController, createFlatChat, } from './chat/flat-chat.controller';
|
|
@@ -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>;
|