@pactor-app/chat 1.44.0 → 1.46.0
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/chunk-TBPUSGKL.js +2633 -0
- package/dist/components/index.cjs +2651 -0
- package/dist/components/index.d.cts +793 -0
- package/dist/components/index.d.ts +793 -0
- package/dist/components/index.js +52 -0
- package/dist/download-DnP2uArc.d.cts +134 -0
- package/dist/download-DnP2uArc.d.ts +134 -0
- package/dist/index.cjs +3876 -1685
- package/dist/index.d.cts +41 -69
- package/dist/index.d.ts +41 -69
- package/dist/index.js +624 -1002
- package/package.json +28 -10
- package/styles.css +1154 -844
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
import { DslNode, Registry } from '@pactor-app/core';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
4
|
+
import { C as ChatPageArtifact, A as ArtifactViewers } from '../download-DnP2uArc.cjs';
|
|
5
|
+
export { a as ArtifactPanel, b as ArtifactPanelProps, c as ArtifactTreeNode, d as ArtifactViewer, e as buildArtifactBlob, f as buildArtifactTree, g as downloadArtifact, r as resolveArtifactFilename, s as saveBlob } from '../download-DnP2uArc.cjs';
|
|
6
|
+
|
|
7
|
+
/** 智能体状态 */
|
|
8
|
+
type AgentStatusType = 'running' | 'waiting' | 'done' | 'error';
|
|
9
|
+
interface AgentStatusProps {
|
|
10
|
+
/** 状态,默认 running */
|
|
11
|
+
status?: AgentStatusType;
|
|
12
|
+
/** 状态文本 */
|
|
13
|
+
text?: string;
|
|
14
|
+
/** 耗时(秒,展示为「已用时 Xs」) */
|
|
15
|
+
elapsed?: number;
|
|
16
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
17
|
+
className?: string;
|
|
18
|
+
/** 通用:根节点内联样式 */
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* AgentStatus 适配器(shadcn kit):智能体运行 / 等待状态行——
|
|
23
|
+
* 状态图标(running 旋转)+ 文本 + 可选耗时。
|
|
24
|
+
* 与通用分类 Status 的差异:面向智能体执行过程(含耗时语义)。
|
|
25
|
+
*/
|
|
26
|
+
declare function AgentStatus({ status, text, elapsed, className, style }: AgentStatusProps): react.JSX.Element;
|
|
27
|
+
|
|
28
|
+
/** 会话附件项 */
|
|
29
|
+
interface AttachmentItemData {
|
|
30
|
+
/** 唯一标识(onRemove / onRetry 传出;缺省传出数组下标) */
|
|
31
|
+
id?: string;
|
|
32
|
+
name: string;
|
|
33
|
+
/** 大小(字节) */
|
|
34
|
+
fileSize?: number;
|
|
35
|
+
/** MIME 或扩展名(类别图标推断) */
|
|
36
|
+
fileType?: string;
|
|
37
|
+
/** 状态,默认 done */
|
|
38
|
+
status?: 'uploading' | 'done' | 'error';
|
|
39
|
+
/** 上传进度(0-100,status=uploading 时展示) */
|
|
40
|
+
progress?: number;
|
|
41
|
+
}
|
|
42
|
+
interface AttachmentProps {
|
|
43
|
+
/** 附件列表(可含表达式解析后的数组) */
|
|
44
|
+
items?: AttachmentItemData[];
|
|
45
|
+
/** 移除事件,传出 id(无 id 传下标);提供时展示移除按钮 */
|
|
46
|
+
onRemove?: (id: string | number) => void;
|
|
47
|
+
/** 重试事件(status=error 时展示重试按钮),传出 id / 下标 */
|
|
48
|
+
onRetry?: (id: string | number) => void;
|
|
49
|
+
/** 卡片点击事件(预览等由调用方实现),传出该附件项 */
|
|
50
|
+
onClick?: (item: AttachmentItemData) => void;
|
|
51
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** 通用:根节点内联样式 */
|
|
54
|
+
style?: CSSProperties;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Attachment 适配器(shadcn kit):会话附件 chip 组——
|
|
58
|
+
* 类别图标(复用 FilePreview 的推断)+ 名称 + 大小 + 状态
|
|
59
|
+
* (uploading 进度条 / error 重试)+ 可移除。
|
|
60
|
+
* 上传与存储由调用方负责,本组件只做呈现与事件上报。
|
|
61
|
+
*/
|
|
62
|
+
declare function Attachment({ items, onRemove, onRetry, onClick, className, style }: AttachmentProps): react.JSX.Element;
|
|
63
|
+
|
|
64
|
+
/** DSL Bubble 变体(对齐 vendored bubble 七态) */
|
|
65
|
+
type BubbleVariant = 'default' | 'secondary' | 'muted' | 'tinted' | 'outline' | 'ghost' | 'destructive';
|
|
66
|
+
interface BubbleProps {
|
|
67
|
+
/** 对齐:start 居左(助手)、end 居右(用户),默认 start */
|
|
68
|
+
align?: 'start' | 'end';
|
|
69
|
+
/** 变体,默认 muted */
|
|
70
|
+
variant?: BubbleVariant;
|
|
71
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
72
|
+
className?: string;
|
|
73
|
+
/** 通用:根节点内联样式 */
|
|
74
|
+
style?: CSSProperties;
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Bubble 适配器(shadcn kit):基础对话气泡容器——变体决定气泡底色,
|
|
79
|
+
* align 决定左右停靠;内容经 Renderer children 机制渲染 DSL 子树。
|
|
80
|
+
*/
|
|
81
|
+
declare function Bubble({ align, variant, className, style, children }: BubbleProps): react.JSX.Element;
|
|
82
|
+
|
|
83
|
+
/** 消息正文段(与 @pactor-app/chat 的 ChatPart 结构对齐的子集;dsl / artifact 段由 chat 产品层承接) */
|
|
84
|
+
type ChatMessagePart = {
|
|
85
|
+
type: 'text';
|
|
86
|
+
content: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'markdown';
|
|
89
|
+
content: string;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'thinking';
|
|
92
|
+
content: string;
|
|
93
|
+
status?: 'thinking' | 'done';
|
|
94
|
+
} | {
|
|
95
|
+
type: 'tool-call';
|
|
96
|
+
name?: string;
|
|
97
|
+
params?: unknown;
|
|
98
|
+
status?: 'running' | 'done' | 'error';
|
|
99
|
+
result?: string;
|
|
100
|
+
} | {
|
|
101
|
+
type: 'tool-result';
|
|
102
|
+
content: string;
|
|
103
|
+
} | {
|
|
104
|
+
type: 'status';
|
|
105
|
+
text: string;
|
|
106
|
+
}
|
|
107
|
+
/** 产物计数段:展示「已生成 n 个产物」,提供 onOpenArtifacts 时可点击(打开产物栏) */
|
|
108
|
+
| {
|
|
109
|
+
type: 'artifacts';
|
|
110
|
+
count: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'error';
|
|
113
|
+
message: string;
|
|
114
|
+
};
|
|
115
|
+
/** 消息状态(对齐 chat 消息状态机) */
|
|
116
|
+
type ChatMessageStatus = 'pending' | 'streaming' | 'completed' | 'error' | 'cancelled';
|
|
117
|
+
/** 助手身份 */
|
|
118
|
+
interface ChatMessageAgent {
|
|
119
|
+
name: string;
|
|
120
|
+
/** 头像图标名(Icon 白名单) */
|
|
121
|
+
icon?: string;
|
|
122
|
+
}
|
|
123
|
+
/** 消息操作项(onAction 传出 name) */
|
|
124
|
+
interface ChatMessageActionItem {
|
|
125
|
+
name: string;
|
|
126
|
+
label?: string;
|
|
127
|
+
icon?: string;
|
|
128
|
+
}
|
|
129
|
+
interface ChatMessageProps {
|
|
130
|
+
/** 角色,默认 assistant */
|
|
131
|
+
role?: 'user' | 'assistant' | 'system';
|
|
132
|
+
/** 有序正文段 */
|
|
133
|
+
parts?: ChatMessagePart[];
|
|
134
|
+
/** 状态,默认 completed;streaming 在末尾渲染光标 */
|
|
135
|
+
status?: ChatMessageStatus;
|
|
136
|
+
/** 助手身份(assistant 消息顶部展示) */
|
|
137
|
+
agent?: ChatMessageAgent;
|
|
138
|
+
/** 时间文本 */
|
|
139
|
+
time?: string;
|
|
140
|
+
/** 是否展示发送方行,默认 false(消息列表不展示 Sender) */
|
|
141
|
+
showSender?: boolean;
|
|
142
|
+
/** 操作列表(completed / error 时展示;有图标时仅图标 + Tooltip 呈现) */
|
|
143
|
+
actions?: ChatMessageActionItem[];
|
|
144
|
+
/** 操作事件,传出 action name(Renderer 绑定 events.onAction) */
|
|
145
|
+
onAction?: (name: string) => void;
|
|
146
|
+
/** artifacts 段(「已生成 n 个产物」)点击事件;提供时该段才可点击 */
|
|
147
|
+
onOpenArtifacts?: () => void;
|
|
148
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
149
|
+
className?: string;
|
|
150
|
+
/** 通用:根节点内联样式 */
|
|
151
|
+
style?: CSSProperties;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* ChatMessage 适配器(shadcn kit):会话消息组合件——
|
|
155
|
+
* user 右侧气泡;assistant 左侧通栏(Sender + 有序 parts);system
|
|
156
|
+
* 居中弱提示(无气泡、12px 浅色文字,参考 @pactor-app/chat
|
|
157
|
+
* MessageBubble 的 system 约定)。parts 渲染(text / markdown /
|
|
158
|
+
* thinking / tool-call / tool-result / status / error)+ streaming 光标 +
|
|
159
|
+
* 操作行(onAction 传出 name)。props 驱动,不感知会话 store;
|
|
160
|
+
* dsl / artifact 段与完整会话能力由 @pactor-app/chat 产品层承接。
|
|
161
|
+
*/
|
|
162
|
+
declare function ChatMessage({ role, parts, status, agent, time, showSender, actions, onAction, onOpenArtifacts, className, style, }: ChatMessageProps): react.JSX.Element;
|
|
163
|
+
|
|
164
|
+
/** 模型选项(模型选择 chip 的候选) */
|
|
165
|
+
interface ComposerModelOption {
|
|
166
|
+
value: string;
|
|
167
|
+
label: string;
|
|
168
|
+
}
|
|
169
|
+
/** 上下文条目(提及候选与行内提及块共用) */
|
|
170
|
+
interface ComposerContextItem {
|
|
171
|
+
id: string;
|
|
172
|
+
label: string;
|
|
173
|
+
/** 来源触发符,缺省继承 source */
|
|
174
|
+
trigger?: string;
|
|
175
|
+
/** 图标名(Icon 白名单;缺省按 source.icon 或触发符兜底) */
|
|
176
|
+
icon?: string;
|
|
177
|
+
/** 原始数据(随选中结果透传给调用方) */
|
|
178
|
+
data?: unknown;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* 上下文数据源:trigger 为声明的触发字符(如 '@' / '+')——
|
|
182
|
+
* 输入该字符(词边界)时在光标位置弹出候选菜单(行内提及);
|
|
183
|
+
* trigger 为 '+' 时工具栏左端同时渲染 + 按钮弹层(选中在光标处插入行内块)
|
|
184
|
+
*/
|
|
185
|
+
interface ComposerContextSource {
|
|
186
|
+
trigger: string;
|
|
187
|
+
label: string;
|
|
188
|
+
items: ComposerContextItem[];
|
|
189
|
+
/** 菜单项与提及块的缺省图标(Icon 白名单) */
|
|
190
|
+
icon?: string;
|
|
191
|
+
}
|
|
192
|
+
interface ComposerProps {
|
|
193
|
+
/** 受控值(提供即受控) */
|
|
194
|
+
value?: string;
|
|
195
|
+
/** 占位提示 */
|
|
196
|
+
placeholder?: string;
|
|
197
|
+
/** 禁用输入与发送 */
|
|
198
|
+
disabled?: boolean;
|
|
199
|
+
/** 发送中(禁用发送钮,由调用方在完成后复位) */
|
|
200
|
+
loading?: boolean;
|
|
201
|
+
/** 流式生成中:发送钮切换为停止钮(不禁用、不阻断输入),点击经 onStop 传出 */
|
|
202
|
+
streaming?: boolean;
|
|
203
|
+
/** 停止当前生成(streaming 时点击停止钮) */
|
|
204
|
+
onStop?: () => void;
|
|
205
|
+
/** 最小行数,缺省 3 */
|
|
206
|
+
rows?: number;
|
|
207
|
+
/** 附件列表(展示在输入区上方) */
|
|
208
|
+
attachments?: AttachmentItemData[];
|
|
209
|
+
/** 附件移除事件,传出 id / 下标 */
|
|
210
|
+
onRemoveAttachment?: (id: string | number) => void;
|
|
211
|
+
/** 附件重试事件,传出 id / 下标 */
|
|
212
|
+
onRetryAttachment?: (id: string | number) => void;
|
|
213
|
+
/** 附件卡片点击事件(预览等由调用方实现),传出该附件项 */
|
|
214
|
+
onAttachmentClick?: (attachment: AttachmentItemData) => void;
|
|
215
|
+
/**
|
|
216
|
+
* 附件选择入口(提供时工具栏左端渲染附件钮,并启用粘贴 / 拖拽文件);
|
|
217
|
+
* 上传与存储由调用方负责
|
|
218
|
+
*/
|
|
219
|
+
onAttachFiles?: (files: File[]) => void;
|
|
220
|
+
/** 输入事件,传出 string 值(行内提及块序列化为 trigger+label) */
|
|
221
|
+
onChange?: (value: string) => void;
|
|
222
|
+
/** 发送事件(点击发送钮或 Enter),传出当前文本 */
|
|
223
|
+
onSubmit?: (value: string) => void;
|
|
224
|
+
/** 模型选项(非空时工具栏右端渲染模型选择 chip,位于发送钮之前) */
|
|
225
|
+
models?: ComposerModelOption[];
|
|
226
|
+
/** 当前选中模型 value(未命中时展示 models[0]) */
|
|
227
|
+
model?: string;
|
|
228
|
+
/** 弹层中选中模型时触发,传出 value */
|
|
229
|
+
onModelChange?: (value: string) => void;
|
|
230
|
+
/**
|
|
231
|
+
* 上下文数据源(行内提及):配置后输入区切换为 contenteditable——
|
|
232
|
+
* 输入触发符在光标位置弹出候选菜单(输入过滤 / ↑↓ 选择 / 回车选中),
|
|
233
|
+
* 选中把触发符与已输入文字替换为行内提及块(图标 + 文字、浅色背景、
|
|
234
|
+
* 圆角,退格整体删除)
|
|
235
|
+
*/
|
|
236
|
+
contexts?: ComposerContextSource[];
|
|
237
|
+
/** 行内提及块列表(受控,与输入区保持同步) */
|
|
238
|
+
contextItems?: ComposerContextItem[];
|
|
239
|
+
/** 提及块变更事件(插入 / 退格删除),传出输入区当前块列表;发送后的清空由调用方在 onSubmit 闭环里处理 */
|
|
240
|
+
onContextItemsChange?: (items: ComposerContextItem[]) => void;
|
|
241
|
+
/**
|
|
242
|
+
* 调用方接管 '@' 提及触发(优先于内建行内提及):提供时 contexts 中
|
|
243
|
+
* trigger 为 '@' 的源不再启用内建菜单;输入区回退纯 textarea(无其他
|
|
244
|
+
* 源时),词边界 '@' 输入经本回调传出 query('@' 后文本)与锚点 rect
|
|
245
|
+
*/
|
|
246
|
+
onMentionTrigger?: (query: string, anchorRect: DOMRect) => void;
|
|
247
|
+
/**
|
|
248
|
+
* 调用方接管 '+' 按钮弹层(优先于内建弹层):提供时工具栏左端始终
|
|
249
|
+
* 渲染 '+' 钮,点击经本回调传出锚点 rect,不再打开内建候选弹层
|
|
250
|
+
*/
|
|
251
|
+
onPlusMenu?: (anchorRect: DOMRect) => void;
|
|
252
|
+
/** 工具栏左端槽(渲染在内建 '+' / 附件钮之前;DslNode 或 React 元素) */
|
|
253
|
+
toolbarStart?: DslNode | ReactNode;
|
|
254
|
+
/** 工具栏右端槽(渲染在模型选择 chip 之后、发送钮之前;DslNode 或 React 元素) */
|
|
255
|
+
toolbarEnd?: DslNode | ReactNode;
|
|
256
|
+
/**
|
|
257
|
+
* 隐藏工具栏行(缺省 false):true 时工具栏行整体不渲染——内建
|
|
258
|
+
* '+' / 附件钮、模型 chip、发送 / 停止钮与 toolbarStart / toolbarEnd
|
|
259
|
+
* 槽一并抑制(footer 槽不受影响);Enter 发送保留
|
|
260
|
+
*/
|
|
261
|
+
hideToolbar?: boolean;
|
|
262
|
+
/** footer 槽(渲染在输入框内工具栏下方,以分隔线相隔;DslNode 或 React 元素) */
|
|
263
|
+
footer?: DslNode | ReactNode;
|
|
264
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
265
|
+
className?: string;
|
|
266
|
+
/** 通用:根节点内联样式 */
|
|
267
|
+
style?: CSSProperties;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Composer 适配器(shadcn kit):会话输入组合件——
|
|
271
|
+
* 附件区(Attachment)+ 输入区(ChatInput)。
|
|
272
|
+
*
|
|
273
|
+
* - 附件:受控 attachments 展示;提供 onAttachFiles 时工具栏左端渲染
|
|
274
|
+
* 附件钮,并启用粘贴 / 拖拽文件入口(上传由调用方负责)
|
|
275
|
+
* - 模型选择:models 非空时工具栏右端渲染模型 chip(发送钮之前),
|
|
276
|
+
* 弹层选中经 onModelChange 传出
|
|
277
|
+
* - 行内提及(MentionInput):contexts 非空时输入区切换为
|
|
278
|
+
* contenteditable——输入触发符('@' 等)在光标位置弹出候选菜单
|
|
279
|
+
* (输入过滤 / ↑↓ / 回车选中 / 点击选中),选中把触发符与已输入
|
|
280
|
+
* 文字替换为行内提及块(图标 + 文字、浅色背景、圆角),退格整体
|
|
281
|
+
* 删除;'+' 触发源额外在工具栏左端渲染 + 按钮弹层(选中在光标处
|
|
282
|
+
* 插入行内块);块列表受控(contextItems + onContextItemsChange)。
|
|
283
|
+
* 注入 onMentionTrigger / onPlusMenu 时对应内建 '@' 提及 / '+' 弹层
|
|
284
|
+
* 让位给调用方(回调优先,锚点 rect 随回调传出)
|
|
285
|
+
* - 运行态:streaming 时发送钮切换为停止钮,点击经 onStop 传出
|
|
286
|
+
* - 扩展槽:toolbarStart / toolbarEnd(工具栏左 / 右端,DslNode 或
|
|
287
|
+
* React 元素);hideToolbar 时工具栏行(含发送 / 停止钮)整体不渲染,
|
|
288
|
+
* Enter 发送保留
|
|
289
|
+
* - footer 槽渲染在输入框内工具栏下方(分隔线相隔)
|
|
290
|
+
*
|
|
291
|
+
* 上传 / transport 由调用方负责,本组件只做呈现与事件上报。
|
|
292
|
+
*/
|
|
293
|
+
declare function Composer({ value, placeholder, disabled, loading, streaming, onStop, rows, attachments, onRemoveAttachment, onRetryAttachment, onAttachmentClick, onAttachFiles, onChange, onSubmit, models, model, onModelChange, contexts, contextItems, onContextItemsChange, onMentionTrigger, onPlusMenu, toolbarStart, toolbarEnd, hideToolbar, footer, className, style, }: ComposerProps): react.JSX.Element;
|
|
294
|
+
|
|
295
|
+
/** 会话条目 */
|
|
296
|
+
interface ConversationItemData {
|
|
297
|
+
id: string;
|
|
298
|
+
title: string;
|
|
299
|
+
/** 补充说明(最近一条消息摘要等) */
|
|
300
|
+
description?: string;
|
|
301
|
+
/** 时间文本(已格式化) */
|
|
302
|
+
time?: string;
|
|
303
|
+
}
|
|
304
|
+
interface ConversationListProps {
|
|
305
|
+
/** 会话列表(可含表达式解析后的数组) */
|
|
306
|
+
items?: ConversationItemData[];
|
|
307
|
+
/** 受控:当前会话 id;提供时切换仅经 onSelect 上报 */
|
|
308
|
+
activeId?: string;
|
|
309
|
+
/** 是否展示搜索框(按 title / description 过滤),默认 false */
|
|
310
|
+
searchable?: boolean;
|
|
311
|
+
/** 选择事件,传出会话 id(Renderer 绑定 events.onSelect) */
|
|
312
|
+
onSelect?: (id: string) => void;
|
|
313
|
+
/** 删除事件,传出会话 id;提供时行悬浮展示删除按钮 */
|
|
314
|
+
onDelete?: (id: string) => void;
|
|
315
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
316
|
+
className?: string;
|
|
317
|
+
/** 通用:根节点内联样式 */
|
|
318
|
+
style?: CSSProperties;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* ConversationList 适配器(shadcn kit):历史会话列表——
|
|
322
|
+
* 可选搜索过滤、激活态(受控 / 非受控)、悬浮删除;
|
|
323
|
+
* 会话的存储与加载由调用方负责。
|
|
324
|
+
*/
|
|
325
|
+
declare function ConversationList({ items, activeId, searchable, onSelect, onDelete, className, style }: ConversationListProps): react.JSX.Element;
|
|
326
|
+
|
|
327
|
+
/** 消息条目(ChatMessage props + 可选 id,onAction 随事件传出) */
|
|
328
|
+
interface MessageListItem extends ChatMessageProps {
|
|
329
|
+
id?: string;
|
|
330
|
+
}
|
|
331
|
+
interface MessageListProps {
|
|
332
|
+
/** 消息列表(可含表达式解析后的数组) */
|
|
333
|
+
messages?: MessageListItem[];
|
|
334
|
+
/** 消息变化后自动滚动到底部,默认 true */
|
|
335
|
+
autoScroll?: boolean;
|
|
336
|
+
/** 消息操作事件,传出 { id, action }(Renderer 绑定 events.onAction) */
|
|
337
|
+
onAction?: (event: {
|
|
338
|
+
id?: string;
|
|
339
|
+
action: string;
|
|
340
|
+
}) => void;
|
|
341
|
+
/** artifacts 段(「已生成 n 个产物」)点击事件,传出 { id } */
|
|
342
|
+
onOpenArtifacts?: (event: {
|
|
343
|
+
id?: string;
|
|
344
|
+
}) => void;
|
|
345
|
+
/** 通用:根节点 class(与内置样式合并;高度由外层或 style 约束) */
|
|
346
|
+
className?: string;
|
|
347
|
+
/** 通用:根节点内联样式 */
|
|
348
|
+
style?: CSSProperties;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* MessageList 适配器(shadcn kit):连续消息流容器——
|
|
352
|
+
* 逐条渲染 ChatMessage,消息变化自动滚到底部(autoScroll 可关);
|
|
353
|
+
* 高度由外层容器约束(组件本身只提供滚动语义)。
|
|
354
|
+
*/
|
|
355
|
+
declare function MessageList({ messages, autoScroll, onAction, onOpenArtifacts, className, style }: MessageListProps): react.JSX.Element;
|
|
356
|
+
|
|
357
|
+
/** 起始任务项(value 缺省取 title) */
|
|
358
|
+
interface WelcomePromptItem {
|
|
359
|
+
title: string;
|
|
360
|
+
description?: string;
|
|
361
|
+
icon?: string;
|
|
362
|
+
value?: string;
|
|
363
|
+
}
|
|
364
|
+
interface WelcomeProps {
|
|
365
|
+
/** 主标题,默认「有什么可以帮你?」 */
|
|
366
|
+
title?: string;
|
|
367
|
+
/** 副标题(能力说明) */
|
|
368
|
+
description?: string;
|
|
369
|
+
/** 主图标名(Icon 白名单),缺省 chat;传 null 不渲染图标 */
|
|
370
|
+
icon?: string | null;
|
|
371
|
+
/** 起始任务卡片列表 */
|
|
372
|
+
prompts?: WelcomePromptItem[];
|
|
373
|
+
/** 起始任务选择事件,传出 value(Renderer 绑定 events.onSelect) */
|
|
374
|
+
onSelect?: (value: string) => void;
|
|
375
|
+
/** 主标题节点 class(与内置样式合并) */
|
|
376
|
+
titleClassName?: string;
|
|
377
|
+
/** 副标题节点 class(与内置样式合并) */
|
|
378
|
+
descriptionClassName?: string;
|
|
379
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
380
|
+
className?: string;
|
|
381
|
+
/** 通用:根节点内联样式 */
|
|
382
|
+
style?: CSSProperties;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Welcome 适配器(shadcn kit):会话空状态——居中的图标 + 主副标题 +
|
|
386
|
+
* 起始任务卡片栅格(复用 Prompt);点击卡片经 onSelect 传出 value。
|
|
387
|
+
*/
|
|
388
|
+
declare function Welcome({ title, description, icon, prompts, onSelect, titleClassName, descriptionClassName, className, style, }: WelcomeProps): react.JSX.Element;
|
|
389
|
+
|
|
390
|
+
/** 图标栏 / 展开菜单共用的导航项 */
|
|
391
|
+
interface ChatPageMenuItem {
|
|
392
|
+
key: string;
|
|
393
|
+
label: string;
|
|
394
|
+
/** 图标名(Icon 白名单) */
|
|
395
|
+
icon?: string;
|
|
396
|
+
}
|
|
397
|
+
/** 对话图标栏项:点击 toggle 展示当前对话的附加内容(产物 / 执行步骤等) */
|
|
398
|
+
interface ConversationRailItem {
|
|
399
|
+
key: string;
|
|
400
|
+
/** 提示文案(hover tooltip) */
|
|
401
|
+
label?: string;
|
|
402
|
+
/** 图标名(Icon 白名单) */
|
|
403
|
+
icon?: string;
|
|
404
|
+
/** 呈现形态:popover(图标栏旁悬浮弹框,缺省)/ panel(产物栏式右侧固定宽栏) */
|
|
405
|
+
display?: 'panel' | 'popover';
|
|
406
|
+
/** 附加内容(React 元素或 DslNode;缺省时点击仅触发状态事件,不渲染内容层) */
|
|
407
|
+
content?: DslNode | ReactNode;
|
|
408
|
+
/** 隐藏该项(如按当前会话有无对应内容动态显隐);隐藏时激活态一并失效 */
|
|
409
|
+
hidden?: boolean;
|
|
410
|
+
}
|
|
411
|
+
/** 品牌区(展开菜单区标题 / 版本) */
|
|
412
|
+
interface ChatPageBrand {
|
|
413
|
+
title: string;
|
|
414
|
+
version?: string;
|
|
415
|
+
}
|
|
416
|
+
interface ChatPageProps {
|
|
417
|
+
brand?: ChatPageBrand;
|
|
418
|
+
/** 主导航项:展开菜单区为图标 + 文字 */
|
|
419
|
+
menuItems?: ChatPageMenuItem[];
|
|
420
|
+
/** 受控选中导航 key(可绑 `${state.x}`) */
|
|
421
|
+
activeMenuKey?: string;
|
|
422
|
+
/**
|
|
423
|
+
* 图标栏导航项(仅图标,hover 右侧 Tooltip 展示 label),与展开菜单
|
|
424
|
+
* 独立定义;railItems 与 railFooterItems 均为空时整个图标栏隐藏
|
|
425
|
+
*/
|
|
426
|
+
railItems?: ChatPageMenuItem[];
|
|
427
|
+
/** 图标栏底部附加项(如设置 / 个人中心) */
|
|
428
|
+
railFooterItems?: ChatPageMenuItem[];
|
|
429
|
+
/** 展开菜单区右上角操作(如「发现应用」);提供才渲染 */
|
|
430
|
+
menuAction?: {
|
|
431
|
+
label: string;
|
|
432
|
+
icon?: string;
|
|
433
|
+
};
|
|
434
|
+
/** 导航选中事件(图标栏 / 展开菜单 / 底部分组共用),传出 item key */
|
|
435
|
+
onMenuSelect?: (key: string) => void;
|
|
436
|
+
/** menuAction 点击事件 */
|
|
437
|
+
onMenuAction?: () => void;
|
|
438
|
+
/** 会话区标题(如「任务」,自动拼接数量);点击标题折叠 / 展开列表 */
|
|
439
|
+
conversationSectionTitle?: string;
|
|
440
|
+
/** 会话区受控折叠(提供即受控,配合 onConversationSectionToggle 闭环) */
|
|
441
|
+
conversationSectionCollapsed?: boolean;
|
|
442
|
+
/** 会话区非受控初始折叠,缺省 false */
|
|
443
|
+
defaultConversationSectionCollapsed?: boolean;
|
|
444
|
+
/** 会话区折叠变化事件,传出 boolean */
|
|
445
|
+
onConversationSectionToggle?: (collapsed: boolean) => void;
|
|
446
|
+
conversations?: ConversationItemData[];
|
|
447
|
+
activeConversationId?: string;
|
|
448
|
+
onSelectConversation?: (id: string) => void;
|
|
449
|
+
onDeleteConversation?: (id: string) => void;
|
|
450
|
+
/** 「查看更多」入口文案;提供才渲染(随会话区折叠隐藏) */
|
|
451
|
+
moreLabel?: string;
|
|
452
|
+
onMore?: () => void;
|
|
453
|
+
/** 菜单区底部附加分组标题(如「空间 (14)」);提供才渲染,点击折叠 / 展开 */
|
|
454
|
+
footerSectionTitle?: string;
|
|
455
|
+
/** 底部分组列表项(图标 + 文字,点击经 onMenuSelect 传出) */
|
|
456
|
+
footerItems?: ChatPageMenuItem[];
|
|
457
|
+
/** 底部分组受控折叠(提供即受控,配合 onFooterSectionToggle 闭环) */
|
|
458
|
+
footerSectionCollapsed?: boolean;
|
|
459
|
+
/** 底部分组非受控初始折叠,缺省 false */
|
|
460
|
+
defaultFooterSectionCollapsed?: boolean;
|
|
461
|
+
/** 底部分组折叠变化事件,传出 boolean */
|
|
462
|
+
onFooterSectionToggle?: (collapsed: boolean) => void;
|
|
463
|
+
/** 对话区头部标题(通常为当前会话标题) */
|
|
464
|
+
conversationTitle?: string;
|
|
465
|
+
/**
|
|
466
|
+
* 对话区头部右侧自定义操作(图标 + 提示);提供才渲染(未配置时
|
|
467
|
+
* header 不渲染任何按钮),点击经 onConversationHeaderAction 传出
|
|
468
|
+
*/
|
|
469
|
+
conversationHeaderAction?: {
|
|
470
|
+
icon?: string;
|
|
471
|
+
label?: string;
|
|
472
|
+
tooltip?: string;
|
|
473
|
+
};
|
|
474
|
+
/** 对话区头部右侧自定义操作点击事件 */
|
|
475
|
+
onConversationHeaderAction?: () => void;
|
|
476
|
+
/**
|
|
477
|
+
* 对话图标栏附加项(header 下方、对话区右缘纵向排列,产物内置项
|
|
478
|
+
* 之后按序展示);点击 toggle 展示对应附加内容
|
|
479
|
+
*/
|
|
480
|
+
conversationRailItems?: ConversationRailItem[];
|
|
481
|
+
/** 隐藏图标栏内置产物入口(缺省 false:产物开关为图标栏首项) */
|
|
482
|
+
hideArtifactRailItem?: boolean;
|
|
483
|
+
/** 图标栏激活项 key(提供即受控,配合 onConversationRailChange 闭环;null 为全部收起) */
|
|
484
|
+
activeConversationRailKey?: string | null;
|
|
485
|
+
/** 图标栏激活项变化事件,传出 key 或 null */
|
|
486
|
+
onConversationRailChange?: (key: string | null) => void;
|
|
487
|
+
messages?: MessageListItem[];
|
|
488
|
+
/** 发送中(禁用 Composer 发送钮,由调用方完成后复位) */
|
|
489
|
+
sending?: boolean;
|
|
490
|
+
composerPlaceholder?: string;
|
|
491
|
+
/** 空会话欢迎区(messages 为空时展示;prompts 选择即发送) */
|
|
492
|
+
welcome?: {
|
|
493
|
+
title?: string;
|
|
494
|
+
description?: string;
|
|
495
|
+
prompts?: WelcomePromptItem[];
|
|
496
|
+
};
|
|
497
|
+
/** 发送事件(Composer 提交 / Welcome prompts 选择),传出文本 */
|
|
498
|
+
onSend?: (text: string) => void;
|
|
499
|
+
/** 消息操作事件,传出 { id, action } */
|
|
500
|
+
onMessageAction?: (event: {
|
|
501
|
+
id?: string;
|
|
502
|
+
action: string;
|
|
503
|
+
}) => void;
|
|
504
|
+
/** 模型选项(非空时 Composer 工具栏右端渲染模型选择 chip) */
|
|
505
|
+
models?: ComposerModelOption[];
|
|
506
|
+
/** 当前选中模型 value(可绑 `${state.x}` 受控闭环) */
|
|
507
|
+
model?: string;
|
|
508
|
+
/** 模型切换事件,传出 value */
|
|
509
|
+
onModelChange?: (value: string) => void;
|
|
510
|
+
/** 上下文数据源(行内提及:输入触发符在光标处弹菜单,选中替换为行内提及块;'+' 源另有工具栏按钮弹层) */
|
|
511
|
+
contexts?: ComposerContextSource[];
|
|
512
|
+
/** 行内提及块列表(受控,与输入区同步,可绑 `${state.x}`) */
|
|
513
|
+
contextItems?: ComposerContextItem[];
|
|
514
|
+
/** chips 变更事件(选中追加 / 移除),传出新数组;发送后的清空由调用方在 onSend 闭环里处理 */
|
|
515
|
+
onContextItemsChange?: (items: ComposerContextItem[]) => void;
|
|
516
|
+
/** 附件列表(受控,展示在输入区上方) */
|
|
517
|
+
attachments?: AttachmentItemData[];
|
|
518
|
+
/** 附件选择入口(提供时启用附件钮与粘贴 / 拖拽文件),传出原始 File[] */
|
|
519
|
+
onAttachFiles?: (files: File[]) => void;
|
|
520
|
+
/** 附件移除事件,传出 id */
|
|
521
|
+
onRemoveAttachment?: (id: string | number) => void;
|
|
522
|
+
/** 附件重试事件,传出 id */
|
|
523
|
+
onRetryAttachment?: (id: string | number) => void;
|
|
524
|
+
/** Composer footer 槽(渲染在输入框内工具栏下方,以分隔线相隔) */
|
|
525
|
+
composerFooter?: DslNode | ReactNode;
|
|
526
|
+
/** Composer 下方自定义内容槽(渲染在输入框之外正下方,如免责声明弱提示行) */
|
|
527
|
+
composerBottom?: DslNode | ReactNode;
|
|
528
|
+
/** 产物区标题,缺省「产物」 */
|
|
529
|
+
artifactTitle?: string;
|
|
530
|
+
/**
|
|
531
|
+
* 产物列表(富模型:id / kind / title / content,面板内建预览——
|
|
532
|
+
* markdown / code / text / dsl 活预览 / 图片,含目录树与下载)
|
|
533
|
+
*/
|
|
534
|
+
artifacts?: ChatPageArtifact[];
|
|
535
|
+
activeArtifactId?: string;
|
|
536
|
+
onSelectArtifact?: (id: string) => void;
|
|
537
|
+
artifactEmptyText?: string;
|
|
538
|
+
/** dsl 产物活预览的 Safe Registry(缺省时 dsl 内容渲染降级块) */
|
|
539
|
+
safeRegistry?: Registry<unknown>;
|
|
540
|
+
/** 注入 dsl 预览作用域 user */
|
|
541
|
+
user?: Record<string, unknown>;
|
|
542
|
+
/** 自定义产物查看器(扩展名 / kind → 预览),优先于内建渲染器 */
|
|
543
|
+
artifactViewers?: ArtifactViewers;
|
|
544
|
+
/** 产物下载事件;缺省面板内部走浏览器下载 */
|
|
545
|
+
onDownloadArtifact?: (artifact: ChatPageArtifact) => void;
|
|
546
|
+
/** 产物区受控开关(提供即受控,配合 onArtifactOpenChange 闭环) */
|
|
547
|
+
artifactOpen?: boolean;
|
|
548
|
+
/** 非受控初始开关,缺省 false(产物栏不默认展示) */
|
|
549
|
+
defaultArtifactOpen?: boolean;
|
|
550
|
+
/** 产物区开关变化事件,传出 boolean */
|
|
551
|
+
onArtifactOpenChange?: (open: boolean) => void;
|
|
552
|
+
/**
|
|
553
|
+
* 主体内容槽(React 元素或 DslNode):提供时整体替换右侧主区域——
|
|
554
|
+
* 对话 header、Welcome / MessageList、Composer、对话图标栏与右侧
|
|
555
|
+
* 产物 / 附加分栏均不渲染,由调用方自带完整主体(含 header);
|
|
556
|
+
* 最左图标栏与展开菜单区不受影响
|
|
557
|
+
*/
|
|
558
|
+
content?: DslNode | ReactNode;
|
|
559
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
560
|
+
className?: string;
|
|
561
|
+
/** 通用:根节点内联样式 */
|
|
562
|
+
style?: CSSProperties;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* ChatPage 对话工作页(shadcn kit):四区整页布局——
|
|
566
|
+
* 最左图标栏(railItems 独立定义,仅图标,hover 右侧 Tooltip 展示
|
|
567
|
+
* 菜单名;不传则整栏隐藏)、展开菜单区(品牌 + 图标文字导航固定于顶部,
|
|
568
|
+
* 可折叠的会话列表与底部分组各占独立滚动区,内容短时下方留空)、中间对话区(头部 / Welcome /
|
|
569
|
+
* MessageList / Composer——Composer 支持模型选择 chip(models/model)、
|
|
570
|
+
* 行内提及(contexts:输入触发符在光标处弹菜单,选中替换为行内提及块,
|
|
571
|
+
* 退格整体删除;受控 contextItems)、附件
|
|
572
|
+
* 入口(onAttachFiles + 受控 attachments)与 composerFooter /
|
|
573
|
+
* composerBottom 槽位)、对话图标栏(header 下方、对话区右缘纵向
|
|
574
|
+
* 图标列:内置产物入口 + conversationRailItems 附加项,点击 toggle
|
|
575
|
+
* 展示附加内容——popover 悬浮弹框或 panel 右侧分栏,与产物区互斥)、
|
|
576
|
+
* 最右产物区(ArtifactPanel:内建产物预览、
|
|
577
|
+
* 目录树与下载,可显隐;展示时经 Resizable 拖拽调节与对话区的宽度)。
|
|
578
|
+
* content 槽(React 元素或 DslNode)提供时整体替换右侧主区域(含对话
|
|
579
|
+
* header),由调用方自带完整主体内容;左侧图标栏与展开菜单区保留。
|
|
580
|
+
* 数据与行为全部经 props / events 进出,
|
|
581
|
+
* 本组件不持有业务状态(产物区开关、图标栏激活项与分区折叠缺省非受控,
|
|
582
|
+
* 均可经受控 prop + change 事件闭环)。
|
|
583
|
+
*/
|
|
584
|
+
declare function ChatPage({ brand, menuItems, activeMenuKey, railItems, railFooterItems, menuAction, onMenuSelect, onMenuAction, conversationSectionTitle, conversationSectionCollapsed, defaultConversationSectionCollapsed, onConversationSectionToggle, conversations, activeConversationId, onSelectConversation, onDeleteConversation, moreLabel, onMore, footerSectionTitle, footerItems, footerSectionCollapsed, defaultFooterSectionCollapsed, onFooterSectionToggle, conversationTitle, conversationHeaderAction, onConversationHeaderAction, conversationRailItems, hideArtifactRailItem, activeConversationRailKey, onConversationRailChange, messages, sending, composerPlaceholder, welcome, onSend, onMessageAction, models, model, onModelChange, contexts, contextItems, onContextItemsChange, attachments, onAttachFiles, onRemoveAttachment, onRetryAttachment, composerFooter, composerBottom, artifactTitle, artifacts, activeArtifactId, onSelectArtifact, artifactEmptyText, safeRegistry, user, artifactViewers, onDownloadArtifact, artifactOpen, defaultArtifactOpen, onArtifactOpenChange, content, className, style, }: ChatPageProps): react.JSX.Element;
|
|
585
|
+
|
|
586
|
+
/** 引用来源项 */
|
|
587
|
+
interface CitationItem {
|
|
588
|
+
/** 来源标题 */
|
|
589
|
+
title: string;
|
|
590
|
+
/** 来源链接 */
|
|
591
|
+
url?: string;
|
|
592
|
+
/** 引用片段 */
|
|
593
|
+
snippet?: string;
|
|
594
|
+
}
|
|
595
|
+
interface CitationProps {
|
|
596
|
+
/** 来源列表(可含表达式解析后的数组);编号从 start 起 */
|
|
597
|
+
items?: CitationItem[];
|
|
598
|
+
/** 起始编号,默认 1 */
|
|
599
|
+
start?: number;
|
|
600
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
601
|
+
className?: string;
|
|
602
|
+
/** 通用:根节点内联样式 */
|
|
603
|
+
style?: CSSProperties;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Citation 适配器(shadcn kit):来源引用标记——行内 [n] 编号组,
|
|
607
|
+
* 悬浮展开来源卡(标题 / 片段 / 链接,经 vendored HoverCard)。
|
|
608
|
+
*/
|
|
609
|
+
declare function Citation({ items, start, className, style }: CitationProps): react.JSX.Element;
|
|
610
|
+
|
|
611
|
+
interface PromptProps {
|
|
612
|
+
/** 提示词标题 */
|
|
613
|
+
title?: string;
|
|
614
|
+
/** 补充描述 */
|
|
615
|
+
description?: string;
|
|
616
|
+
/** 前缀图标名(Icon 白名单) */
|
|
617
|
+
icon?: string;
|
|
618
|
+
/** 点击传出值(缺省取 title) */
|
|
619
|
+
value?: string;
|
|
620
|
+
/** 禁用 */
|
|
621
|
+
disabled?: boolean;
|
|
622
|
+
/** 选择事件(Renderer 绑定 events.onSelect) */
|
|
623
|
+
onSelect?: (value: string) => void;
|
|
624
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
625
|
+
className?: string;
|
|
626
|
+
/** 通用:根节点内联样式 */
|
|
627
|
+
style?: CSSProperties;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Prompt 适配器(shadcn kit):可复用提示词 / 任务入口卡片——
|
|
631
|
+
* 图标 + 标题 + 描述,点击经 onSelect 传出 value(缺省取 title)。
|
|
632
|
+
*/
|
|
633
|
+
declare function Prompt({ title, description, icon, value, disabled, onSelect, className, style }: PromptProps): react.JSX.Element;
|
|
634
|
+
|
|
635
|
+
interface SenderProps {
|
|
636
|
+
/** 发送方名称 */
|
|
637
|
+
name?: string;
|
|
638
|
+
/** 头像图片地址 */
|
|
639
|
+
avatar?: string;
|
|
640
|
+
/** 头像占位文本(缺省取 name 首字符) */
|
|
641
|
+
avatarText?: string;
|
|
642
|
+
/** 头像位图标(Icon 白名单;提供时头像位渲染图标,优先于 avatarText 兜底) */
|
|
643
|
+
icon?: string;
|
|
644
|
+
/** 隐藏头像位(缺省 false;无头像 / 图标 / 占位诉求的场景) */
|
|
645
|
+
hideAvatar?: boolean;
|
|
646
|
+
/** 角色说明(如「AI 助手」「我」),展示在名称后 */
|
|
647
|
+
role?: string;
|
|
648
|
+
/** 时间文本(已格式化,如「10:24」) */
|
|
649
|
+
time?: string;
|
|
650
|
+
/** 对齐:start 居左、end 居右,默认 start */
|
|
651
|
+
align?: 'start' | 'end';
|
|
652
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
653
|
+
className?: string;
|
|
654
|
+
/** 通用:根节点内联样式 */
|
|
655
|
+
style?: CSSProperties;
|
|
656
|
+
}
|
|
657
|
+
/** Sender 适配器(shadcn kit):消息发送方行——头像 + 名称 + 角色 + 时间 */
|
|
658
|
+
declare function Sender({ name, avatar, avatarText, icon, hideAvatar, role, time, align, className, style }: SenderProps): react.JSX.Element;
|
|
659
|
+
|
|
660
|
+
interface StepsPanelItemData {
|
|
661
|
+
title: string;
|
|
662
|
+
description?: string;
|
|
663
|
+
/** done 已完成 / running 进行中 / pending 待执行(缺省 pending) */
|
|
664
|
+
status?: 'done' | 'running' | 'pending';
|
|
665
|
+
duration?: string;
|
|
666
|
+
}
|
|
667
|
+
interface StepsPanelProps {
|
|
668
|
+
/** 面板标题(缺省「执行步骤」) */
|
|
669
|
+
title?: string;
|
|
670
|
+
/** 步骤列表(DSL 绑定 ${data.steps}) */
|
|
671
|
+
steps?: StepsPanelItemData[];
|
|
672
|
+
/** 空态文案(steps 为空时展示) */
|
|
673
|
+
emptyText?: string;
|
|
674
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
675
|
+
className?: string;
|
|
676
|
+
/** 通用:根节点内联样式 */
|
|
677
|
+
style?: CSSProperties;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* StepsPanel 执行步骤面板(chat 目录):纵向时间线展示任务执行步骤,
|
|
681
|
+
* 状态图标区分已完成 / 进行中 / 待执行。典型用法是作为 ChatPage
|
|
682
|
+
* 对话图标栏 popover 项的 content(`type: "StepsPanel"`),
|
|
683
|
+
* 样式全走语义令牌(深浅色/换肤自适应)。
|
|
684
|
+
*/
|
|
685
|
+
declare function StepsPanel({ title, steps, emptyText, className, style, }: StepsPanelProps): react.JSX.Element;
|
|
686
|
+
|
|
687
|
+
interface StreamingTextProps {
|
|
688
|
+
/** 文本内容(流式场景由数据源持续追加) */
|
|
689
|
+
content?: string;
|
|
690
|
+
/** 生成中:尾部渲染闪烁光标,默认 false */
|
|
691
|
+
streaming?: boolean;
|
|
692
|
+
/** 打字机模式:自身按 speed 渐进揭示 content(内容一次性给全的演示 / 回放场景),默认 false */
|
|
693
|
+
typing?: boolean;
|
|
694
|
+
/** 打字机速度(每 24ms 揭示的字符数),默认 2 */
|
|
695
|
+
speed?: number;
|
|
696
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
697
|
+
className?: string;
|
|
698
|
+
/** 通用:根节点内联样式 */
|
|
699
|
+
style?: CSSProperties;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* StreamingText 适配器(shadcn kit):渐进展示生成中的文本——
|
|
703
|
+
* 两种模式:数据源推送(content 增长 + streaming 光标)与打字机
|
|
704
|
+
* (typing 自揭示完整 content)。光标 motion-reduce 时静止。
|
|
705
|
+
*/
|
|
706
|
+
declare function StreamingText({ content, streaming, typing, speed, className, style }: StreamingTextProps): react.JSX.Element;
|
|
707
|
+
|
|
708
|
+
/** 建议项:字符串或 { label, value?, icon? }(value 缺省取 label) */
|
|
709
|
+
type SuggestionItem = string | {
|
|
710
|
+
label: string;
|
|
711
|
+
value?: string;
|
|
712
|
+
icon?: string;
|
|
713
|
+
};
|
|
714
|
+
interface SuggestionProps {
|
|
715
|
+
/** 建议列表(可含表达式解析后的数组) */
|
|
716
|
+
items?: SuggestionItem[];
|
|
717
|
+
/** 水平对齐,默认 start */
|
|
718
|
+
justify?: 'start' | 'center';
|
|
719
|
+
/** 选择事件,传出选中项 value(Renderer 绑定 events.onSelect) */
|
|
720
|
+
onSelect?: (value: string) => void;
|
|
721
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
722
|
+
className?: string;
|
|
723
|
+
/** 通用:根节点内联样式 */
|
|
724
|
+
style?: CSSProperties;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Suggestion 适配器(shadcn kit):追问 / 下一步建议 chips——
|
|
728
|
+
* 圆角描边小按钮横向排列(可换行),点击经 onSelect 传出 value。
|
|
729
|
+
*/
|
|
730
|
+
declare function Suggestion({ items, justify, onSelect, className, style }: SuggestionProps): react.JSX.Element;
|
|
731
|
+
|
|
732
|
+
/** 思考状态:thinking 进行中(图标脉冲动画)、done 已完成 */
|
|
733
|
+
type ThinkingStatus = 'thinking' | 'done';
|
|
734
|
+
interface ThinkingProps {
|
|
735
|
+
/** 推理内容 */
|
|
736
|
+
content?: string;
|
|
737
|
+
/** 状态,默认 thinking */
|
|
738
|
+
status?: ThinkingStatus;
|
|
739
|
+
/** 标题,缺省按状态:思考中… / 思考完成 */
|
|
740
|
+
title?: string;
|
|
741
|
+
/** 受控:是否展开内容;提供时折叠切换仅经 onToggle 上报 */
|
|
742
|
+
expanded?: boolean;
|
|
743
|
+
/** 非受控初始展开(缺省:thinking 展开、done 折叠) */
|
|
744
|
+
defaultExpanded?: boolean;
|
|
745
|
+
/** 折叠切换事件,传出目标展开态(Renderer 绑定 events.onToggle) */
|
|
746
|
+
onToggle?: (expanded: boolean) => void;
|
|
747
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
748
|
+
className?: string;
|
|
749
|
+
/** 通用:根节点内联样式 */
|
|
750
|
+
style?: CSSProperties;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Thinking 适配器(shadcn kit):推理 / 处理中状态——
|
|
754
|
+
* 无边框无底色:头部(brain 图标 + 标题 + chevron 紧随其后)可折叠,
|
|
755
|
+
* 进行中图标脉冲;展开后内容仅以浅色文字呈现。
|
|
756
|
+
* 展开态非受控(defaultExpanded)或受控(expanded + onToggle)。
|
|
757
|
+
*/
|
|
758
|
+
declare function Thinking({ content, status, title, expanded, defaultExpanded, onToggle, className, style, }: ThinkingProps): react.JSX.Element;
|
|
759
|
+
|
|
760
|
+
/** 工具调用状态 */
|
|
761
|
+
type ToolCallStatus = 'running' | 'done' | 'error';
|
|
762
|
+
interface ToolCallProps {
|
|
763
|
+
/** 工具名称 */
|
|
764
|
+
name?: string;
|
|
765
|
+
/** 调用参数(对象按 JSON 缩进展示,字符串原样展示) */
|
|
766
|
+
params?: unknown;
|
|
767
|
+
/** 状态,默认 done */
|
|
768
|
+
status?: ToolCallStatus;
|
|
769
|
+
/** 调用结果文本 */
|
|
770
|
+
result?: string;
|
|
771
|
+
/** 耗时(毫秒,展示为秒) */
|
|
772
|
+
durationMs?: number;
|
|
773
|
+
/** 非受控初始展开(缺省:running 展开、其余折叠) */
|
|
774
|
+
defaultExpanded?: boolean;
|
|
775
|
+
/** 通用:根节点 class(与内置样式合并) */
|
|
776
|
+
className?: string;
|
|
777
|
+
/** 通用:根节点内联样式 */
|
|
778
|
+
style?: CSSProperties;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* ToolCall 适配器(shadcn kit):工具调用——无边框无底色:头部
|
|
782
|
+
* (terminal 图标 + 名称 + 状态 + 耗时 + chevron 紧随其后)可折叠,
|
|
783
|
+
* 展开后参数 / 结果仅以浅色文字呈现;缺省 running 展开、done / error 折叠。
|
|
784
|
+
*/
|
|
785
|
+
declare function ToolCall({ name, params, status, result, durationMs, defaultExpanded, className, style }: ToolCallProps): react.JSX.Element;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* 注册 chat 展示组件族的 18 个 DSL 类型名(与迁移前 ui
|
|
789
|
+
* builtinComponents 的注册集合一致);已存在同名类型时不覆盖。
|
|
790
|
+
*/
|
|
791
|
+
declare function registerChatComponents(registry: Registry<unknown>): void;
|
|
792
|
+
|
|
793
|
+
export { AgentStatus, type AgentStatusProps, type AgentStatusType, ArtifactViewers, Attachment, type AttachmentItemData, type AttachmentProps, Bubble, type BubbleProps, type BubbleVariant, ChatMessage, type ChatMessageActionItem, type ChatMessageAgent, type ChatMessagePart, type ChatMessageProps, type ChatMessageStatus, ChatPage, ChatPageArtifact, type ChatPageBrand, type ChatPageMenuItem, type ChatPageProps, Citation, type CitationItem, type CitationProps, Composer, type ComposerContextItem, type ComposerContextSource, type ComposerModelOption, type ComposerProps, type ConversationItemData, ConversationList, type ConversationListProps, type ConversationRailItem, MessageList, type MessageListItem, type MessageListProps, Prompt, type PromptProps, Sender, type SenderProps, StepsPanel, type StepsPanelItemData, type StepsPanelProps, StreamingText, type StreamingTextProps, Suggestion, type SuggestionItem, type SuggestionProps, Thinking, type ThinkingProps, type ThinkingStatus, ToolCall, type ToolCallProps, type ToolCallStatus, Welcome, type WelcomePromptItem, type WelcomeProps, registerChatComponents };
|