@ibiz-template-plugin/ai-chat 0.0.113 → 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.
Files changed (37) hide show
  1. package/dist/index.es.js +9014 -7961
  2. package/dist/index.legacy.js +1 -1
  3. package/dist/style.css +1 -1
  4. package/dist/types/components/chat-action-panel/chat-action-panel.d.ts +19 -0
  5. package/dist/types/components/chat-container/chat-container.d.ts +81 -4
  6. package/dist/types/components/chat-editor/node/mention-node.d.ts +3 -0
  7. package/dist/types/components/chat-messages/chat-messages.d.ts +2 -1
  8. package/dist/types/components/chat-messages/use-virtual-list.d.ts +31 -0
  9. package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +7 -0
  10. package/dist/types/components/chat-scrollbar/chat-scrollbar.d.ts +102 -0
  11. package/dist/types/components/common/breadcrumb/breadcrumb.d.ts +16 -0
  12. package/dist/types/components/common/lazy-list-tree/lazy-list-tree.d.ts +59 -0
  13. package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +26 -1
  14. package/dist/types/components/flat-chat-container/flat-chat-container.d.ts +39 -0
  15. package/dist/types/components/index.d.ts +1 -0
  16. package/dist/types/constants/index.d.ts +8 -0
  17. package/dist/types/controller/ai-action-panel/ai-action-panel.controller.d.ts +102 -0
  18. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +34 -11
  19. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +13 -3
  20. package/dist/types/controller/chat/chat-base.controller.d.ts +7 -0
  21. package/dist/types/controller/index.d.ts +1 -0
  22. package/dist/types/entity/ai-agent/ai-agent.d.ts +1 -0
  23. package/dist/types/icons/arrow-down.d.ts +3 -1
  24. package/dist/types/icons/index.d.ts +2 -1
  25. package/dist/types/icons/project-svg.d.ts +1 -0
  26. package/dist/types/icons/workspace-svg.d.ts +1 -0
  27. package/dist/types/index.d.ts +1 -1
  28. package/dist/types/interface/i-action-panel/i-action-panel.d.ts +24 -0
  29. package/dist/types/interface/i-ai-agent/i-ai-agent.d.ts +6 -0
  30. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +30 -3
  31. package/dist/types/interface/i-project/i-project.d.ts +26 -0
  32. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +6 -0
  33. package/dist/types/interface/index.d.ts +2 -1
  34. package/dist/types/locale/en/index.d.ts +9 -1
  35. package/dist/types/locale/zh-CN/index.d.ts +9 -1
  36. package/package.json +1 -1
  37. package/dist/types/icons/solid-down-svg.d.ts +0 -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
- x: number;
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,3 @@
1
+ import { Node } from '@tiptap/core';
2
+
3
+ export declare const MentionNode: Node<any, any>;
@@ -31,7 +31,8 @@ export interface ChatMessageProps {
31
31
  * 消息数量 / 内容会随时变化,滚动位置由下面的「锚定策略」维护。
32
32
  *
33
33
  * ## 锚定策略(useLayoutEffect 内)
34
- * 1. 末尾追加(发消息 / AI 回复)→ 强制贴底,跟随新消息;
34
+ * 1. 末尾追加:用户自己发送的消息 → 强制贴底,跟随新消息;AI 回复 → 遵循当前贴底状态
35
+ * (用户上翻阅读历史时不被打断,落入下方分支 2/3 处理);
35
36
  * 2. 贴底模式(isAutoScroll)下任何变化(流式增长、测量回填)→ 继续贴底;
36
37
  * 3. 非贴底 + 数据变化(前插历史、删除)→ 按锚点恢复位置,避免画面跳动;
37
38
  * 纯「测量回填」(totalSize 变但消息引用没变)不干预 scrollTop,避免打断手动拖动。
@@ -1,4 +1,5 @@
1
1
  import { RefObject } from 'preact';
2
+ import { ReadonlySignal, Signal } from '@preact/signals';
2
3
 
3
4
  /**
4
5
  * 虚拟列表项
@@ -100,6 +101,36 @@ export interface UseVirtualListResult {
100
101
  * @memberof UseVirtualListResult
101
102
  */
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;
103
134
  }
104
135
  /**
105
136
  * 动态高度虚拟列表 Hook
@@ -0,0 +1,7 @@
1
+ import { AiChatController } from '../../controller';
2
+
3
+ interface ChatNetDiskProps {
4
+ controller: AiChatController;
5
+ }
6
+ export declare const ChatNetDisk: (props: ChatNetDiskProps) => import("preact").JSX.Element;
7
+ export {};
@@ -0,0 +1,102 @@
1
+ import { RefObject } from 'preact';
2
+ import { ReadonlySignal, Signal } from '@preact/signals';
3
+
4
+ export interface ChatScrollbarProps {
5
+ /**
6
+ * 滚动容器 ref(与 useVirtualList 的 containerRef 同源)
7
+ *
8
+ * @type {RefObject<HTMLDivElement | null>}
9
+ */
10
+ containerRef: RefObject<HTMLDivElement | null>;
11
+ /**
12
+ * 容器 scrollTop 信号
13
+ *
14
+ * @type {Signal<number>}
15
+ */
16
+ scrollTop: Signal<number>;
17
+ /**
18
+ * 容器可视高度信号
19
+ *
20
+ * @type {Signal<number>}
21
+ */
22
+ clientHeight: Signal<number>;
23
+ /**
24
+ * 内容总高度信号(依赖实测高度回填)
25
+ *
26
+ * @type {ReadonlySignal<number>}
27
+ */
28
+ totalSize: ReadonlySignal<number>;
29
+ /**
30
+ * 程序化写滚动位置(同步信号 + 写容器 scrollTop)
31
+ *
32
+ * @type {(top: number) => void}
33
+ */
34
+ setScrollTop: (top: number) => void;
35
+ /**
36
+ * 拖动到顶部附近的通知(触发加载更早历史)
37
+ *
38
+ * 拖到顶部且前插补偿被跳过时,scrollTop 值可能不变导致浏览器不派发 scroll 事件,
39
+ * 因此不能只依赖 scroll 事件,需在此处直接通知
40
+ *
41
+ * @type {() => void}
42
+ */
43
+ onNearTop?: () => void;
44
+ /**
45
+ * 拖动状态回调(父组件转发给 useVirtualList 的 setIsDragging)
46
+ *
47
+ * @type {(dragging: boolean) => void}
48
+ */
49
+ onDragStateChange?: (dragging: boolean) => void;
50
+ /**
51
+ * thumb 最小高度,避免内容过长时不可抓取
52
+ *
53
+ * @type {number}
54
+ */
55
+ minThumbSize?: number;
56
+ }
57
+ /**
58
+ * 自定义虚拟滚动条
59
+ *
60
+ * ## 为什么不用原生滚动条
61
+ * 动态高度虚拟列表中未测量的项用预估高度占位,快速拖动原生滚动条时新项不断被实测,
62
+ * totalSize(scrollHeight)持续变化,原生 thumb 按比例重定位导致滚动条乱跳。
63
+ *
64
+ * ## 核心策略
65
+ * 隐藏原生滚动条绘制,保留原生 scrollTop 驱动内容(wheel/键盘/触摸不变),自绘 thumb:
66
+ * - 拖动期间 thumb 定位用指针比例(dragRatio),不依赖异步的 scroll 事件回读,无滞后抖动;
67
+ * - 拖动期间 totalSize 变化(测量回填/历史前插)时,按指针比例重映射 scrollTop,
68
+ * thumb 始终钉在指针下方,内容坐标系在其下方重排。
69
+ *
70
+ * ## 与 useVirtualList 的数据流交联
71
+ * 本组件不持有滚动状态,全部通过 props 注入 useVirtualList 暴露的信号与回调,
72
+ * 二者是「显示层 ↔ 驱动层」的关系:
73
+ *
74
+ * ```
75
+ * useVirtualList ChatScrollbar
76
+ * ──────────── ──────────────
77
+ * totalSizeSignal ─────────────────────► totalSize (thumb 高度/比例)
78
+ * clientHeightSignal ──────────────────► clientHeight (thumb 高度/比例)
79
+ * scrollTopSignal ─────────────────────► scrollTop (非拖动期 thumb 位置)
80
+ * setScrollTop ◄──────────────────────── 拖动/翻页 (程序化写滚动位置)
81
+ * onDragStateChange ──► isDragging ──► 前插补偿跳过
82
+ * onNearTop ──────────────────────────► 加载更早历史
83
+ * ```
84
+ *
85
+ * 正向(useVirtualList → 本组件):
86
+ * - 滚动/测量回填/历史前插 → totalSize、scrollTop 信号变化 → 本组件重渲染更新 thumb;
87
+ * - totalSizeSignal 是懒求值信号(只依赖测量版本号),滚动过程中零额外计算。
88
+ *
89
+ * 反向(本组件 → useVirtualList):
90
+ * - 拖动/点击翻页 → setScrollTop:同步写 scrollTop 信号 + 写容器 DOM,
91
+ * 信号先行避免下一帧用旧值闪跳;虚拟列表据此重算可视区;
92
+ * - onDragStateChange → 虚拟列表的 isDragging 信号置 true:
93
+ * 拖动期间「头部前插补偿」被跳过(use-virtual-list.ts:373),
94
+ * 前插导致的 totalSize 变化改由本组件的重锚定 effect 按指针比例重映射 scrollTop 接管,
95
+ * 两端不会同时争抢滚动位置;
96
+ * - onNearTop:拖到顶部时直接通知父级加载历史——前插补偿被跳过后 scrollTop 可能不变,
97
+ * 浏览器不派发 scroll 事件,不能只依赖滚动事件触发加载。
98
+ *
99
+ * @author zpc
100
+ * @date 2026-10-12
101
+ */
102
+ export declare const ChatScrollbar: (props: ChatScrollbarProps) => import("preact").JSX.Element | null;
@@ -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
- export interface LazyTreeProps {
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
+ }