@blueking/chat-x 0.0.48-beta.1 → 0.0.49-beta.10

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 (70) hide show
  1. package/dist/ag-ui/types/constants.d.ts +1 -0
  2. package/dist/ag-ui/types/file.d.ts +13 -0
  3. package/dist/ag-ui/types/index.d.ts +1 -0
  4. package/dist/ag-ui/types/messages.d.ts +4 -0
  5. package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +12 -1
  6. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +12 -0
  7. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +11 -0
  8. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/preview-strategy.d.ts +8 -0
  9. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/code-preview.vue.d.ts +8 -0
  10. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/html-preview.vue.d.ts +6 -0
  11. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/image-preview.vue.d.ts +7 -0
  12. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/markdown-preview.vue.d.ts +6 -0
  13. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/txt-preview.vue.d.ts +6 -0
  14. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/url-iframe-preview.vue.d.ts +6 -0
  15. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/use-artifact-preview-loader.d.ts +22 -0
  16. package/dist/components/chat-message/assistant-message/message-artifacts/file-artifact-panel.vue.d.ts +13 -0
  17. package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts +9 -0
  18. package/dist/components/chat-message/interrupt-message/user-question/use-user-question.d.ts +7 -2
  19. package/dist/components/chat-message/user-message/user-message.vue.d.ts +15 -2
  20. package/dist/components/file-icon/file-icon.vue.d.ts +7 -0
  21. package/dist/components/index.d.ts +3 -1
  22. package/dist/components/message-tools/message-time/format-message-time.d.ts +8 -0
  23. package/dist/components/message-tools/message-time/message-time.vue.d.ts +8 -0
  24. package/dist/components/message-tools/message-tools.vue.d.ts +11 -1
  25. package/dist/composables/index.d.ts +1 -0
  26. package/dist/composables/use-artifact-preview.d.ts +49 -0
  27. package/dist/composables/use-container-scroll.d.ts +9 -2
  28. package/dist/composables/use-custom-tab.d.ts +7 -3
  29. package/dist/composables/use-global-config.d.ts +3 -0
  30. package/dist/composables/use-message-group.d.ts +505 -0
  31. package/dist/icons/file-icons.d.ts +4 -0
  32. package/dist/icons/file.d.ts +6 -0
  33. package/dist/icons/index.d.ts +2 -0
  34. package/dist/icons/tools.d.ts +3 -0
  35. package/dist/index.css +1 -1
  36. package/dist/index.js +3203 -2368
  37. package/dist/index.js.map +1 -1
  38. package/dist/lang/lang.d.ts +9 -1
  39. package/dist/mcp/generated/docs/activity-message.md +122 -97
  40. package/dist/mcp/generated/docs/assistant-message.md +146 -75
  41. package/dist/mcp/generated/docs/chat-container.md +121 -38
  42. package/dist/mcp/generated/docs/chat-input.md +2 -10
  43. package/dist/mcp/generated/docs/constants.md +3 -1
  44. package/dist/mcp/generated/docs/content-render.md +2 -10
  45. package/dist/mcp/generated/docs/execution-summary.md +3 -3
  46. package/dist/mcp/generated/docs/file-artifact-panel.md +293 -0
  47. package/dist/mcp/generated/docs/file-icon.md +111 -0
  48. package/dist/mcp/generated/docs/info-message.md +29 -12
  49. package/dist/mcp/generated/docs/interrupt.md +1 -0
  50. package/dist/mcp/generated/docs/loading-message.md +36 -17
  51. package/dist/mcp/generated/docs/message-container.md +27 -23
  52. package/dist/mcp/generated/docs/message-render.md +47 -59
  53. package/dist/mcp/generated/docs/message-time.md +180 -0
  54. package/dist/mcp/generated/docs/message-tools.md +47 -12
  55. package/dist/mcp/generated/docs/messages.md +9 -0
  56. package/dist/mcp/generated/docs/reasoning-message.md +17 -20
  57. package/dist/mcp/generated/docs/tool-message.md +61 -45
  58. package/dist/mcp/generated/docs/toolcall-render.md +18 -10
  59. package/dist/mcp/generated/docs/use-artifact-preview.md +234 -0
  60. package/dist/mcp/generated/docs/use-container-scroll.md +6 -2
  61. package/dist/mcp/generated/docs/use-custom-tab.md +25 -8
  62. package/dist/mcp/generated/docs/use-global-config.md +15 -5
  63. package/dist/mcp/generated/docs/use-message-group.md +37 -5
  64. package/dist/mcp/generated/docs/user-message.md +191 -121
  65. package/dist/mcp/generated/docs/user-question-card.md +6 -3
  66. package/dist/mcp/generated/index.json +144 -18
  67. package/dist/mcp/index.js +0 -0
  68. package/dist/utils/file-type.d.ts +14 -0
  69. package/dist/utils/index.d.ts +1 -0
  70. package/package.json +20 -21
@@ -1,26 +1,29 @@
1
1
  <!-- AI SUMMARY -->
2
2
  ## 快速了解
3
3
 
4
- 渲染用户消息,支持文本、键值、Markdown、引用、文件和编辑态输入。 源码位置:src/components/chat-message/user-message/user-message.vue。
4
+ 渲染用户消息:纯文本(非 Markdown)、键值引用、二进制附件与编辑态 ChatInput / ShortcutRender; 工具栏含 copy / cite / edit / delete。源码位置:src/components/chat-message/user-message/user-message.vue。
5
5
 
6
6
  ### 关联组件
7
7
  - **message-render** — 由 MessageRender 在 role 为 user 时创建
8
8
  - **message-tools** — 消息工具栏交互与状态由 MessageTools 体系承载
9
+ - **message-time** — createdAt 经工具栏 prepend 插槽展示
9
10
  - **message-container** — 嵌入列表时由 MessageContainer 管理分组与多选
11
+ - **chat-input** — 编辑态普通消息使用 ChatInput
10
12
 
11
13
  ---
12
14
  <!-- FULL DOC -->
13
15
 
14
16
  # UserMessage 用户消息
17
+
15
18
  ## 源码事实
16
19
 
17
20
  - **源码位置**:`src/components/chat-message/user-message/user-message.vue`
18
21
  - **能力域**:消息系统
19
- - **能力说明**:渲染用户消息,支持文本、键值、Markdown、引用、文件和编辑态输入。
22
+ - **能力说明**:渲染用户消息:纯文本、键值引用、文件附件与编辑态输入(**不**渲染 Markdown)。
20
23
 
21
- > **能力域**:消息系统
24
+ > **导出说明**:`UserMessage` **未**从 `@blueking/chat-x` 包入口导出(入口同名是 TS interface)。消费方请用 `MessageRender` / `MessageContainer`。下文 `UserMessageComp` 为文档站内部相对路径示例。
22
25
 
23
- 用户消息展示组件,右对齐显示用户发送的消息内容。支持纯文本、多媒体(图片/文件)、文本引用、结构化引用、快捷指令等多种内容形式,以及消息的内联编辑功能。
26
+ 用户消息展示组件,右对齐。支持纯文本、多媒体(图片/文件)、文本引用、结构化引用、快捷指令,以及内联编辑。
24
27
 
25
28
  ## 组件结构
26
29
 
@@ -44,9 +47,12 @@
44
47
  └── MessageTools(.ai-user-message-tools)
45
48
  v-if: messageToolsStatus !== 'hidden'
46
49
  visibility: hidden(默认)→ visible(:hover 时)
47
- tools: [copy, cite, edit],updateTools: []
50
+ tools: [copy, cite, edit, delete],updateTools: []
51
+ #prepend slot → MessageTime(createdAt,工具图标左侧)
48
52
  ```
49
53
 
54
+ > **时间随工具栏显隐**:时间位于工具栏内,与工具按钮共用 `visibility` 控制,因此同样在悬停消息时才可见。
55
+
50
56
  **编辑模式**(点击 `edit` 按钮后 `isEdit=true`)
51
57
 
52
58
  ```
@@ -67,28 +73,35 @@
67
73
 
68
74
  ## 基础用法
69
75
 
70
- `content` 为字符串时,通过 `TextContent` 渲染(内部使用 `MarkdownContent`,支持 Markdown 语法)。
76
+ `content` 为字符串时,通过 `TextContent` 以**纯文本**插值渲染(`{{ content }}`),**不**走 Markdown。
71
77
 
72
78
  ```vue
73
79
  <template>
74
- <UserMessage
75
- :content="content"
80
+ <MessageRender
81
+ :message="message"
76
82
  :on-action="handleAction"
77
83
  />
78
84
  </template>
79
85
 
80
86
  <script setup lang="ts">
81
- import { UserMessage, type IToolBtn } from '@blueking/chat-x';
82
-
83
- const content = '你好,请帮我分析以下这段 Python 代码的性能瓶颈。';
87
+ import { MessageRender, MessageRole, MessageStatus, type IToolBtn } from '@blueking/chat-x';
88
+
89
+ const message = {
90
+ id: '1',
91
+ messageId: '1',
92
+ role: MessageRole.User,
93
+ content: '你好,请帮我分析以下这段 Python 代码的性能瓶颈。',
94
+ status: MessageStatus.Complete,
95
+ };
84
96
 
85
97
  const handleAction = async (tool: IToolBtn) => {
98
+ // copy / edit 有内置行为;cite / delete 需业务侧处理
86
99
  console.log('工具操作:', tool.id);
87
100
  };
88
101
  </script>
89
102
  ```
90
103
 
91
- > **工具栏**:鼠标悬停时,消息下方出现「复制」「引用」「编辑」三个操作按钮(CSS `visibility` 切换,始终占位)。
104
+ > **工具栏**:悬停时显示「复制」「引用」「编辑」「删除」(CSS `visibility`,始终占位)。
92
105
 
93
106
  ## 多媒体消息
94
107
 
@@ -101,20 +114,26 @@
101
114
 
102
115
  ```vue
103
116
  <script setup lang="ts">
104
- import { UserMessage, MessageContentType } from '@blueking/chat-x';
105
-
106
- const content = [
107
- {
108
- type: MessageContentType.Binary, // 'binary'
109
- url: 'https://example.com/screenshot.png',
110
- mimeType: 'image/png',
111
- filename: 'screenshot.png',
112
- },
113
- {
114
- type: MessageContentType.Text, // 'text'
115
- text: '请帮我分析这张架构图,指出其中的问题。',
116
- },
117
- ];
117
+ import { MessageRender, MessageContentType, MessageRole, MessageStatus } from '@blueking/chat-x';
118
+
119
+ const message = {
120
+ id: '1',
121
+ messageId: '1',
122
+ role: MessageRole.User,
123
+ status: MessageStatus.Complete,
124
+ content: [
125
+ {
126
+ type: MessageContentType.Binary,
127
+ url: 'https://example.com/screenshot.png',
128
+ mimeType: 'image/png',
129
+ filename: 'screenshot.png',
130
+ },
131
+ {
132
+ type: MessageContentType.Text,
133
+ text: '请帮我分析这张架构图,指出其中的问题。',
134
+ },
135
+ ],
136
+ };
118
137
  </script>
119
138
  ```
120
139
 
@@ -133,12 +152,14 @@
133
152
 
134
153
  ```vue
135
154
  <script setup lang="ts">
136
- import { UserMessage } from '@blueking/chat-x';
137
-
138
- const content = '这段代码每次循环都发起请求,应该如何优化?';
139
- const property = {
140
- extra: {
141
- cite: '// 原始代码\nfor (let i = 0; i < arr.length; i++) {\n fetch(`/api/${arr[i]}`)\n}',
155
+ // 消费方将 property 挂在 message 上,经 MessageRender 透传
156
+ const message = {
157
+ role: 'user',
158
+ content: '这段代码每次循环都发起请求,应该如何优化?',
159
+ property: {
160
+ extra: {
161
+ cite: '// 原始代码\nfor (let i = 0; i < arr.length; i++) {\n fetch(`/api/${arr[i]}`)\n}',
162
+ },
142
163
  },
143
164
  };
144
165
  </script>
@@ -150,18 +171,20 @@
150
171
 
151
172
  ```vue
152
173
  <script setup lang="ts">
153
- import { UserMessage } from '@blueking/chat-x';
154
-
155
- const content = '请帮我分析这份报表的数据趋势。';
156
- const property = {
157
- extra: {
158
- cite: {
159
- title: '销售数据分析',
160
- data: [
161
- { key: '报表名称', value: '2024 年 Q4 销售报表' },
162
- { key: '时间范围', value: '2024年10月 - 12月' },
163
- { key: '数据量', value: '12,580 条' },
164
- ],
174
+ const message = {
175
+ role: 'user',
176
+ content: '请帮我分析这份报表的数据趋势。',
177
+ property: {
178
+ extra: {
179
+ cite: {
180
+ title: '销售数据分析',
181
+ type: 'structured',
182
+ data: [
183
+ { key: '报表名称', value: '2024 年 Q4 销售报表' },
184
+ { key: '时间范围', value: '2024年10月 - 12月' },
185
+ { key: '数据量', value: '12,580 条' },
186
+ ],
187
+ },
165
188
  },
166
189
  },
167
190
  };
@@ -182,34 +205,35 @@
182
205
 
183
206
  ```vue
184
207
  <script setup lang="ts">
185
- import { UserMessage } from '@blueking/chat-x';
186
-
187
- const content = '请帮我翻译这段文字';
188
- const property = {
189
- extra: {
190
- shortcut: {
191
- id: 'translate',
192
- name: '翻译',
193
- components: [
194
- {
195
- type: 'select',
196
- key: 'targetLang',
197
- name: '目标语言',
198
- default: 'en',
199
- options: [
200
- { label: '英文', value: 'en' },
201
- { label: '中文', value: 'zh' },
202
- ],
203
- },
204
- {
205
- type: 'textarea',
206
- key: 'content',
207
- name: '翻译内容',
208
- fillBack: true,
209
- default: '请帮我翻译这段文字',
210
- },
211
- ],
212
- formModel: { targetLang: 'en', content: '请帮我翻译这段文字' },
208
+ const message = {
209
+ role: 'user',
210
+ content: '请帮我翻译这段文字',
211
+ property: {
212
+ extra: {
213
+ shortcut: {
214
+ id: 'translate',
215
+ name: '翻译',
216
+ components: [
217
+ {
218
+ type: 'select',
219
+ key: 'targetLang',
220
+ name: '目标语言',
221
+ default: 'en',
222
+ options: [
223
+ { label: '英文', value: 'en' },
224
+ { label: '中文', value: 'zh' },
225
+ ],
226
+ },
227
+ {
228
+ type: 'textarea',
229
+ key: 'content',
230
+ name: '翻译内容',
231
+ fillBack: true,
232
+ default: '请帮我翻译这段文字',
233
+ },
234
+ ],
235
+ formModel: { targetLang: 'en', content: '请帮我翻译这段文字' },
236
+ },
213
237
  },
214
238
  },
215
239
  };
@@ -236,8 +260,8 @@ binaryFiles 有值 → 进入编辑模式(editContent 可为空)
236
260
 
237
261
  ```vue
238
262
  <template>
239
- <UserMessage
240
- :content="content"
263
+ <MessageRender
264
+ :message="message"
241
265
  :on-action="handleAction"
242
266
  :on-input-confirm="handleInputConfirm"
243
267
  :on-shortcut-confirm="handleShortcutConfirm"
@@ -245,25 +269,35 @@ binaryFiles 有值 → 进入编辑模式(editContent 可为空)
245
269
  </template>
246
270
 
247
271
  <script setup lang="ts">
248
- import { UserMessage, type IToolBtn, type TagSchema } from '@blueking/chat-x';
249
-
250
- const content = '请帮我优化这段代码';
272
+ import {
273
+ MessageRender,
274
+ MessageRole,
275
+ MessageStatus,
276
+ type IToolBtn,
277
+ type TagSchema,
278
+ type UserMessage,
279
+ } from '@blueking/chat-x';
280
+
281
+ const message = {
282
+ id: '1',
283
+ messageId: '1',
284
+ role: MessageRole.User,
285
+ content: '请帮我优化这段代码',
286
+ status: MessageStatus.Complete,
287
+ };
251
288
 
252
289
  const handleAction = async (tool: IToolBtn) => {
253
- // tool.id === 'edit' → 组件内部自动切换编辑模式
254
- // tool.id === 'copy' → 自动复制(字符串直接复制,数组 JSON.stringify 后复制)
255
- // tool.id === 'cite' → 由外部 onAction 处理(组件内无内置行为)
290
+ // edit → 组件内切编辑态;copy → 组件内复制
291
+ // cite / delete → 无内置行为,业务侧处理(如删除会话消息)
256
292
  console.log('工具:', tool.id);
257
293
  };
258
294
 
259
- const handleInputConfirm = async (content: string | InputContent[], docSchema: TagSchema) => {
260
- console.log('编辑后内容:', content);
261
- // 重新发送消息
295
+ const handleInputConfirm = async (content: UserMessage['content'], docSchema: TagSchema) => {
296
+ console.log('编辑后内容:', content, docSchema);
262
297
  };
263
298
 
264
299
  const handleShortcutConfirm = async (formModel: Record<string, unknown>) => {
265
300
  console.log('快捷指令表单:', formModel);
266
- // 重新发送快捷指令
267
301
  };
268
302
  </script>
269
303
  ```
@@ -274,50 +308,86 @@ binaryFiles 有值 → 进入编辑模式(editContent 可为空)
274
308
 
275
309
  **内置工具列表(`CONST_USER_MESSAGE_TOOLS`)**
276
310
 
277
- | 工具 ID | 名称 | 内置行为 |
278
- | ------- | ---- | -------------------------------------------- |
279
- | `copy` | 复制 | 字符串直接复制;数组 `JSON.stringify` 后复制 |
280
- | `cite` | 引用 | 无内置行为,需通过 `onAction` 外部处理 |
281
- | `edit` | 编辑 | 切换 `isEdit=true`,进入编辑模式 |
311
+ | 工具 ID | 名称 | 内置行为 |
312
+ | -------- | ---- | -------------------------------------------- |
313
+ | `copy` | 复制 | 字符串直接复制;数组 `JSON.stringify` 后复制 |
314
+ | `cite` | 引用 | 无内置行为,需通过 `onAction` 外部处理 |
315
+ | `edit` | 编辑 | 切换 `isEdit=true`,进入编辑模式 |
316
+ | `delete` | 删除 | 无内置行为,需通过 `onAction` 外部处理 |
282
317
 
283
318
  ```vue
284
- <!-- 隐藏工具按钮(从 DOM 移除,不占位) -->
285
- <UserMessage :content="content" message-tools-status="hidden" />
319
+ <!-- 经 MessageRender 控制工具栏状态 -->
320
+ <MessageRender
321
+ :message="message"
322
+ message-tools-status="hidden"
323
+ />
324
+ <MessageRender
325
+ :message="message"
326
+ message-tools-status="disabled"
327
+ />
328
+ ```
329
+
330
+ ## supportUpload 透传
286
331
 
287
- <!-- 禁用工具按钮(保留占位,不可点击,无 hover 效果) -->
288
- <UserMessage :content="content" message-tools-status="disabled" />
332
+ 编辑态 `ChatInput` 的上传能力来自 `injectGlobalConfig().supportUpload`(通常由 `ChatContainer` 的 `supportUpload` prop 注册)。自定义 `#message` 插槽时须把同一配置链路保留,否则编辑态会与主输入区不一致。
333
+
334
+ ```vue
335
+ <template>
336
+ <ChatContainer
337
+ :messages="messages"
338
+ :support-upload="true"
339
+ :on-agent-action="handleAgentAction"
340
+ :on-user-action="handleUserAction"
341
+ >
342
+ <template #message="{ message, messageToolsStatus, onInterruptResume }">
343
+ <MessageRender
344
+ :message="message"
345
+ :message-tools-status="messageToolsStatus"
346
+ :on-action="handleUserAction"
347
+ :on-input-confirm="(content, docSchema) => handleUserInputConfirm(message, content, docSchema)"
348
+ :on-shortcut-confirm="formModel => handleUserShortcutConfirm(message, formModel)"
349
+ :on-interrupt-resume="onInterruptResume"
350
+ />
351
+ </template>
352
+ </ChatContainer>
353
+ </template>
289
354
  ```
290
355
 
291
356
  ## API
292
357
 
293
358
  ### Props
294
359
 
295
- | 属性名 | 类型 | 说明 |
296
- | ------------------ | ---------------------------------------------------------------------------- | --------------------------------------------------------- |
297
- | content | `string \| InputContent[]` | 消息内容,字符串或含 text/binary 的数组 |
298
- | property | `{ extra?: MessageExtra }` | 消息附加属性,包含引用、快捷指令、context 等信息 |
299
- | messageToolsStatus | `MessageToolsStatus` | 工具按钮状态,`disabled` 禁用、`hidden` 从 DOM 移除 |
300
- | onAction | `(tool: IToolBtn) => Promise<void>` | 工具按钮回调;`copy`/`edit` 有内置行为,`cite` 需外部处理 |
301
- | onInputConfirm | `(content: string \| InputContent[], docSchema: TagSchema) => Promise<void>` | 普通消息编辑确认回调 |
302
- | onShortcutConfirm | `(formModel: Record<string, unknown>) => Promise<void>` | 快捷指令消息编辑确认回调 |
303
- | tippyOptions | `Partial<Omit<TippyOptions, 'getReferenceClientRect' \| 'triggerTarget'>>` | 自定义工具栏 Tippy 配置,透传给内部 `MessageTools` 组件 |
360
+ | 属性名 | 类型 | 说明 |
361
+ | ------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
362
+ | content | `string \| InputContent[]` | 消息内容,字符串或含 text/binary 的数组 |
363
+ | createdAt | `number \| string` | 消息创建时间,经 `MessageTools` 的 `#prepend` 插槽交给 `MessageTime` 渲染在工具图标左侧;无值时不展示 |
364
+ | property | `{ extra?: MessageExtra; artifacts?: AIFileInfo[] }` | 附加属性;本组件消费 `extra.cite` / `shortcut` / `context` |
365
+ | messageToolsStatus | `MessageToolsStatus` | 工具按钮状态,`disabled` 禁用、`hidden` 从 DOM 移除 |
366
+ | onAction | `MessageToolsProps['onAction']` | 工具回调;`copy`/`edit` 有内置行为,`cite`/`delete` 需外部处理 |
367
+ | onInputConfirm | `(content: UserMessage['content'], docSchema: TagSchema) => Promise<void>` | 普通消息编辑确认回调 |
368
+ | onShortcutConfirm | `(formModel: Record<string, unknown>) => Promise<void>` | 快捷指令消息编辑确认回调 |
369
+ | tippyOptions | `Partial<Omit<TippyOptions, 'getReferenceClientRect' \| 'triggerTarget'>>` | 自定义工具栏 Tippy 配置,透传给内部 `MessageTools` |
370
+
371
+ ### Events / Slots / Expose
372
+
373
+ 无。
304
374
 
305
375
  ### 全局配置依赖
306
376
 
307
- 编辑模式下的 `ChatInput` 会通过 `injectGlobalConfig()` 获取全局配置中的 `supportUpload` 值。需要确保祖先组件(通常是 `ChatContainer`)已调用 `useGlobalConfig()` 注册配置。
377
+ 编辑态 `ChatInput` 通过 `injectGlobalConfig()` 读取 `supportUpload`。祖先需已 `useGlobalConfig()`(通常由 `ChatContainer` 注册)。
308
378
 
309
379
  ## 类型定义
310
380
 
311
381
  ```typescript
312
382
  // 文本内容项
313
383
  interface TextInputContent {
314
- type: 'text'; // MessageContentType.Text
384
+ type: 'text';
315
385
  text: string;
316
386
  }
317
387
 
318
388
  // 二进制内容项(图片、文件)
319
389
  interface BinaryContent {
320
- type: 'binary'; // MessageContentType.Binary
390
+ type: 'binary';
321
391
  url?: string;
322
392
  mimeType?: string;
323
393
  filename?: string;
@@ -325,32 +395,32 @@ interface BinaryContent {
325
395
 
326
396
  type InputContent = TextInputContent | BinaryContent;
327
397
 
328
- // 消息附加属性
329
- interface MessageExtra {
330
- // 文本引用(字符串):渲染在气泡外 CiteContent
331
- cite?: string;
332
-
333
- // 结构化引用(对象):渲染在气泡内 KeyValueContent;与 context 配合可重建 ShortcutRender
334
- cite?: {
335
- title?: string;
336
- data: Array<{ key: string; value: string }>;
337
- };
338
-
339
- // 快捷指令:编辑时渲染 ShortcutRender(优先于 cite+context 路径)
340
- shortcut?: Shortcut;
341
-
342
- // 上下文变量:与结构化 cite 配合,在编辑模式下动态构建 ShortcutComponent[]
398
+ // property.extra(与源码 BaseMessage.property.extra 对齐)
399
+ type MessageExtra = {
400
+ // 文本引用 或 结构化引用(互斥 union,不是两个同名字段)
401
+ cite?:
402
+ | string
403
+ | {
404
+ title: string;
405
+ type: 'structured';
406
+ data: Array<{ key: string; value: string }>;
407
+ };
408
+ command?: string;
409
+ pause?: boolean;
410
+ shortcut?: Partial<Shortcut>;
343
411
  context?: Array<{
344
412
  __key: string;
345
413
  __label: string;
346
414
  __value: string;
347
415
  fillBack?: boolean;
416
+ context_type?: string;
348
417
  }>;
349
- }
418
+ };
350
419
  ```
351
420
 
352
421
  ## 关联组件
353
422
 
354
423
  - [MessageRender](/components/message/message-render) — user 角色由其实例化
355
424
  - [MessageTools](/components/feedback/message-tools) — 工具栏交互
425
+ - [MessageTime](/components/feedback/message-time) — 工具栏左侧的消息时间
356
426
  - [MessageContainer](/components/setup/message-container) — 列表与多选容器
@@ -1,7 +1,7 @@
1
1
  <!-- AI SUMMARY -->
2
2
  ## 快速了解
3
3
 
4
- 渲染 UserQuestion 中断的待回答面板,支持单选、多选、Others 与跳过。 源码位置:src/components/chat-message/interrupt-message/user-question/user-question-card.vue。
4
+ 渲染 UserQuestion 中断的待回答面板:一次只展示一题,标题栏提供题号切换, Footer 展示已完成进度;支持单选自动跳下一题、多选/Others、完成与跳过。 源码位置:src/components/chat-message/interrupt-message/user-question/user-question-card.vue。
5
5
 
6
6
  ### 关联组件
7
7
  - **interrupt-message** — outcome.success 时挂载 UserQuestionAnsweredCard 回显回答
@@ -16,7 +16,7 @@
16
16
 
17
17
  - **源码位置**:`src/components/chat-message/interrupt-message/user-question/user-question-card.vue`
18
18
  - **能力域**:Agent 能力
19
- - **能力说明**:渲染 UserQuestion 中断的待回答面板,支持单选、多选、Others 与跳过。
19
+ - **能力说明**:渲染 UserQuestion 中断的待回答面板;一次一题分页切换,支持单选/多选、Others、跳过与已完成进度。
20
20
 
21
21
  > **能力域**:Agent 能力
22
22
 
@@ -24,6 +24,9 @@
24
24
 
25
25
  ## 交互能力
26
26
 
27
+ - **一次一题**:正文只展示当前题;标题栏右侧提供 `< 当前题 / 总题数 >` 切换定位(单题为 `1 / 1`),首末题对应箭头禁用。
28
+ - **自动跳转**:单选预设选项从未答变为有效答时,自动跳到下一题(最后一题停留);多选与 Others 不自动跳,靠箭头切换。
29
+ - **已完成进度**:Footer 左侧展示「已完成 N 题」;右侧为「跳过」+「完成」。
27
30
  - **单选 / 多选**:每道题通过 `multiSelect` 控制选择行为;未传时不展示单选/多选标签,默认仍按单选处理。
28
31
  - **Others 自由输入**:默认 [UserQuestionChoice](/components/agent/user-question-choice) 为每道题追加 `label: 'others'` 输入项,输入文本写入 `answer[].description`。
29
32
  - **自定义作答形态**:通过 `#question` slot 可替换默认选择题,渲染任意表单;作答有效时调用 `setAnswer` 回传 `UserQuestionAnswerItem`,无效时传 `undefined`。
@@ -142,7 +145,7 @@ const payload = {
142
145
  />
143
146
  ```
144
147
 
145
- - 卡片内「完成 / 跳过」→ `onInterruptResume(payload, interrupt)`
148
+ - 卡片内「跳过 / 完成」→ `onInterruptResume(payload, interrupt)`(Footer 右置,跳过在前、完成在后)
146
149
  - 输入框直接发送 → `onSendMessage(content, docSchema, { interrupt, payload })`,其中 `payload` 由 `buildSkipResumePayload(interrupt)` 生成(`status: 'cancelled'`)
147
150
 
148
151
  ## 工具函数 buildSkipResumePayload