@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.
- package/dist/ag-ui/types/constants.d.ts +1 -0
- package/dist/ag-ui/types/file.d.ts +13 -0
- package/dist/ag-ui/types/index.d.ts +1 -0
- package/dist/ag-ui/types/messages.d.ts +4 -0
- package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +12 -1
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +12 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +11 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/preview-strategy.d.ts +8 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/code-preview.vue.d.ts +8 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/html-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/image-preview.vue.d.ts +7 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/markdown-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/txt-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/url-iframe-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/use-artifact-preview-loader.d.ts +22 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/file-artifact-panel.vue.d.ts +13 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts +9 -0
- package/dist/components/chat-message/interrupt-message/user-question/use-user-question.d.ts +7 -2
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +15 -2
- package/dist/components/file-icon/file-icon.vue.d.ts +7 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/message-tools/message-time/format-message-time.d.ts +8 -0
- package/dist/components/message-tools/message-time/message-time.vue.d.ts +8 -0
- package/dist/components/message-tools/message-tools.vue.d.ts +11 -1
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +49 -0
- package/dist/composables/use-container-scroll.d.ts +9 -2
- package/dist/composables/use-custom-tab.d.ts +7 -3
- package/dist/composables/use-global-config.d.ts +3 -0
- package/dist/composables/use-message-group.d.ts +505 -0
- package/dist/icons/file-icons.d.ts +4 -0
- package/dist/icons/file.d.ts +6 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/tools.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.js +3203 -2368
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +9 -1
- package/dist/mcp/generated/docs/activity-message.md +122 -97
- package/dist/mcp/generated/docs/assistant-message.md +146 -75
- package/dist/mcp/generated/docs/chat-container.md +121 -38
- package/dist/mcp/generated/docs/chat-input.md +2 -10
- package/dist/mcp/generated/docs/constants.md +3 -1
- package/dist/mcp/generated/docs/content-render.md +2 -10
- package/dist/mcp/generated/docs/execution-summary.md +3 -3
- package/dist/mcp/generated/docs/file-artifact-panel.md +293 -0
- package/dist/mcp/generated/docs/file-icon.md +111 -0
- package/dist/mcp/generated/docs/info-message.md +29 -12
- package/dist/mcp/generated/docs/interrupt.md +1 -0
- package/dist/mcp/generated/docs/loading-message.md +36 -17
- package/dist/mcp/generated/docs/message-container.md +27 -23
- package/dist/mcp/generated/docs/message-render.md +47 -59
- package/dist/mcp/generated/docs/message-time.md +180 -0
- package/dist/mcp/generated/docs/message-tools.md +47 -12
- package/dist/mcp/generated/docs/messages.md +9 -0
- package/dist/mcp/generated/docs/reasoning-message.md +17 -20
- package/dist/mcp/generated/docs/tool-message.md +61 -45
- package/dist/mcp/generated/docs/toolcall-render.md +18 -10
- package/dist/mcp/generated/docs/use-artifact-preview.md +234 -0
- package/dist/mcp/generated/docs/use-container-scroll.md +6 -2
- package/dist/mcp/generated/docs/use-custom-tab.md +25 -8
- package/dist/mcp/generated/docs/use-global-config.md +15 -5
- package/dist/mcp/generated/docs/use-message-group.md +37 -5
- package/dist/mcp/generated/docs/user-message.md +191 -121
- package/dist/mcp/generated/docs/user-question-card.md +6 -3
- package/dist/mcp/generated/index.json +144 -18
- package/dist/mcp/index.js +0 -0
- package/dist/utils/file-type.d.ts +14 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +20 -21
|
@@ -1,54 +1,61 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
渲染助手 Markdown 正文、ToolCallRender 工具调用列表,以及 property.artifacts 文件卡片; 默认插槽仅覆盖正文。源码位置:src/components/chat-message/assistant-message/assistant-message.vue。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-render** — 由 MessageRender 在 role 为 assistant 时创建
|
|
8
8
|
- **tool-message** — 工具结果通过 toolCall.toolMessage 内联或独立 tool 消息关联展示
|
|
9
9
|
- **toolcall-render** — 多条工具调用由 ToolcallRender 统一渲染
|
|
10
|
+
- **file-artifact-panel** — property.artifacts 文件产物点击后在侧栏预览
|
|
10
11
|
|
|
11
12
|
---
|
|
12
13
|
<!-- FULL DOC -->
|
|
13
14
|
|
|
14
15
|
# AssistantMessage AI 助手消息
|
|
16
|
+
|
|
15
17
|
## 源码事实
|
|
16
18
|
|
|
17
19
|
- **源码位置**:`src/components/chat-message/assistant-message/assistant-message.vue`
|
|
18
20
|
- **能力域**:消息系统
|
|
19
|
-
-
|
|
21
|
+
- **能力说明**:渲染助手 Markdown 正文、工具调用列表与 `property.artifacts` 文件产物。
|
|
20
22
|
|
|
21
|
-
>
|
|
23
|
+
> **导出说明**:`AssistantMessage` **未**从 `@blueking/chat-x` 包入口导出(入口同名是 TS interface)。消费方请用 `MessageRender` / `MessageContainer`。下文 `AssistantMessageComp` 为文档站内部相对路径示例。
|
|
22
24
|
|
|
23
|
-
AI
|
|
25
|
+
AI 助手消息展示组件:正文(Markdown)、工具调用(Tool Calls)、文件产物卡片。
|
|
24
26
|
|
|
25
27
|
## 渲染管线
|
|
26
28
|
|
|
27
29
|
```
|
|
28
30
|
AssistantMessage(根类名:ai-assistant-message)
|
|
29
|
-
├── ai-assistant-message-content
|
|
30
|
-
│ └── [default slot] 或 ContentRender → MarkdownContent
|
|
31
|
-
|
|
31
|
+
├── ai-assistant-message-content(内容区,v-if content)
|
|
32
|
+
│ └── [default slot { content }] 或 ContentRender → MarkdownContent
|
|
33
|
+
├── ToolCallRender × N(toolCalls,不受 slot 影响)
|
|
34
|
+
└── MessageArtifacts(v-if property.artifacts 非空)
|
|
35
|
+
└── ArtifactFileCard × N(点击 → useArtifactPreview → 侧栏 FileArtifactPanel → ArtifactPreviewHost)
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
- **内容区**:`content`
|
|
35
|
-
-
|
|
38
|
+
- **内容区**:`content` 经 `ContentRender`(`MessageContentType.Text`)由 `MarkdownContent` 渲染;default slot 仅收到 `{ content }`
|
|
39
|
+
- **工具调用区**:每个 `toolCall` 渲染一个 `ToolCallRender`,位于内容区下方
|
|
40
|
+
- **文件产物区**:读取 `property.artifacts`,用 `uid ?? String(id)` 作为 `messageUid` 传给 `MessageArtifacts`
|
|
36
41
|
|
|
37
42
|
## 基础用法
|
|
38
43
|
|
|
39
44
|
```vue
|
|
40
45
|
<template>
|
|
41
|
-
<
|
|
42
|
-
:content="content"
|
|
43
|
-
:status="status"
|
|
44
|
-
/>
|
|
46
|
+
<MessageRender :message="message" />
|
|
45
47
|
</template>
|
|
46
48
|
|
|
47
49
|
<script setup lang="ts">
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
import { MessageRender, MessageRole, MessageStatus } from '@blueking/chat-x';
|
|
51
|
+
|
|
52
|
+
const message = {
|
|
53
|
+
id: '1',
|
|
54
|
+
messageId: '1',
|
|
55
|
+
role: MessageRole.Assistant,
|
|
56
|
+
content: '你好!我是 AI 助手,有什么可以帮助你的吗?',
|
|
57
|
+
status: MessageStatus.Complete,
|
|
58
|
+
};
|
|
52
59
|
</script>
|
|
53
60
|
```
|
|
54
61
|
|
|
@@ -60,16 +67,18 @@ AssistantMessage(根类名:ai-assistant-message)
|
|
|
60
67
|
|
|
61
68
|
```vue
|
|
62
69
|
<template>
|
|
63
|
-
<
|
|
64
|
-
:content="markdownContent"
|
|
65
|
-
status="complete"
|
|
66
|
-
/>
|
|
70
|
+
<MessageRender :message="message" />
|
|
67
71
|
</template>
|
|
68
72
|
|
|
69
73
|
<script setup lang="ts">
|
|
70
|
-
import {
|
|
74
|
+
import { MessageRender, MessageRole, MessageStatus } from '@blueking/chat-x';
|
|
71
75
|
|
|
72
|
-
const
|
|
76
|
+
const message = {
|
|
77
|
+
id: '1',
|
|
78
|
+
messageId: '1',
|
|
79
|
+
role: MessageRole.Assistant,
|
|
80
|
+
status: MessageStatus.Complete,
|
|
81
|
+
content: `## Vue 3 核心特性
|
|
73
82
|
|
|
74
83
|
Vue 3 引入了多项重要更新:
|
|
75
84
|
|
|
@@ -84,7 +93,8 @@ const count = ref(0);
|
|
|
84
93
|
const doubled = computed(() => count.value * 2);
|
|
85
94
|
\\\`\\\`\\\`
|
|
86
95
|
|
|
87
|
-
> 更多详情请参考 [Vue 3 官方文档](https://vuejs.org)
|
|
96
|
+
> 更多详情请参考 [Vue 3 官方文档](https://vuejs.org)。`,
|
|
97
|
+
};
|
|
88
98
|
</script>
|
|
89
99
|
```
|
|
90
100
|
|
|
@@ -92,15 +102,15 @@ const doubled = computed(() => count.value * 2);
|
|
|
92
102
|
|
|
93
103
|
## 消息状态
|
|
94
104
|
|
|
95
|
-
`status`
|
|
105
|
+
`status` 直接影响 **内容区**(`ContentRender`)。`ToolCallRender` 的状态**按工具维度推导**(见下方「工具调用状态推导」),不直接等于本组件的 `status`。
|
|
96
106
|
|
|
97
|
-
| `status` | 内容区效果 |
|
|
98
|
-
| ----------- | ----------------------------------- |
|
|
99
|
-
| `pending` | 正常渲染(通常 content 为空) |
|
|
100
|
-
| `streaming` | Markdown 自动补全未闭合语法 |
|
|
101
|
-
| `complete` | 正常渲染完整 Markdown |
|
|
102
|
-
| `error` | 红色错误图标 + content 作为错误提示 |
|
|
103
|
-
| `stop` | 正常渲染(内容停留在中止时的状态) |
|
|
107
|
+
| `status` | 内容区效果 |
|
|
108
|
+
| ----------- | ----------------------------------- |
|
|
109
|
+
| `pending` | 正常渲染(通常 content 为空) |
|
|
110
|
+
| `streaming` | Markdown 自动补全未闭合语法 |
|
|
111
|
+
| `complete` | 正常渲染完整 Markdown |
|
|
112
|
+
| `error` | 红色错误图标 + content 作为错误提示 |
|
|
113
|
+
| `stop` | 正常渲染(内容停留在中止时的状态) |
|
|
104
114
|
|
|
105
115
|
### Pending
|
|
106
116
|
|
|
@@ -120,33 +130,36 @@ const doubled = computed(() => count.value * 2);
|
|
|
120
130
|
|
|
121
131
|
## 工具调用
|
|
122
132
|
|
|
123
|
-
当 AI 回复中包含工具调用时,传入 `toolCalls` 数组,每项自动渲染为 `ToolCallRender
|
|
133
|
+
当 AI 回复中包含工具调用时,传入 `toolCalls` 数组,每项自动渲染为 `ToolCallRender`,位于内容区下方。传给每个 `ToolCallRender` 的 `status` 按下方优先级从 `toolCall.toolMessage` 推导,而非直接同步本组件的 `status`。
|
|
124
134
|
|
|
125
135
|
### 单个工具调用
|
|
126
136
|
|
|
127
137
|
```vue
|
|
128
138
|
<template>
|
|
129
|
-
<
|
|
130
|
-
content="让我帮你查询一下天气信息。"
|
|
131
|
-
:status="MessageStatus.Complete"
|
|
132
|
-
:tool-calls="toolCalls"
|
|
133
|
-
/>
|
|
139
|
+
<MessageRender :message="message" />
|
|
134
140
|
</template>
|
|
135
141
|
|
|
136
142
|
<script setup lang="ts">
|
|
137
|
-
import {
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
import { MessageRender, MessageRole, MessageStatus } from '@blueking/chat-x';
|
|
144
|
+
|
|
145
|
+
const message = {
|
|
146
|
+
id: '1',
|
|
147
|
+
messageId: '1',
|
|
148
|
+
role: MessageRole.Assistant,
|
|
149
|
+
content: '让我帮你查询一下天气信息。',
|
|
150
|
+
status: MessageStatus.Complete,
|
|
151
|
+
toolCalls: [
|
|
152
|
+
{
|
|
153
|
+
id: 'call_1',
|
|
154
|
+
type: 'function',
|
|
155
|
+
function: {
|
|
156
|
+
name: 'get_weather',
|
|
157
|
+
arguments: '{"city": "北京", "unit": "celsius"}',
|
|
158
|
+
description: '获取指定城市的天气信息',
|
|
159
|
+
},
|
|
147
160
|
},
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
],
|
|
162
|
+
};
|
|
150
163
|
</script>
|
|
151
164
|
```
|
|
152
165
|
|
|
@@ -265,13 +278,17 @@ AI 可在一次回复中发起多个工具调用,组件依次渲染:
|
|
|
265
278
|
|
|
266
279
|
**渲染效果**
|
|
267
280
|
|
|
268
|
-
###
|
|
281
|
+
### 工具调用状态推导
|
|
269
282
|
|
|
270
|
-
`ToolCallRender`
|
|
283
|
+
传给每个 `ToolCallRender` 的 `status` 按以下优先级计算:
|
|
271
284
|
|
|
272
|
-
|
|
285
|
+
1. 无 `toolMessage` → `MessageStatus.Pending`(调用中)
|
|
286
|
+
2. `toolMessage.error` 为真 → `MessageStatus.Error`(调用失败)
|
|
287
|
+
3. 否则 → `toolMessage.status ??` 本组件 `status`
|
|
273
288
|
|
|
274
|
-
|
|
289
|
+
**调用中**(有 `toolCalls`、尚无 `toolMessage`;即便助手 `status` 已是 `complete` 也显示调用中):
|
|
290
|
+
|
|
291
|
+
**调用成功**(`toolMessage.status = "complete"`):
|
|
275
292
|
|
|
276
293
|
## 自定义内容渲染
|
|
277
294
|
|
|
@@ -285,20 +302,17 @@ AI 可在一次回复中发起多个工具调用,组件依次渲染:
|
|
|
285
302
|
|
|
286
303
|
```vue
|
|
287
304
|
<template>
|
|
288
|
-
<
|
|
289
|
-
:content="content"
|
|
290
|
-
:tool-calls="toolCalls"
|
|
291
|
-
>
|
|
305
|
+
<MessageRender :message="message">
|
|
292
306
|
<template #default="{ content }">
|
|
293
307
|
<div style="padding: 12px; background: #f0f9ff; border-left: 3px solid #3a84ff; border-radius: 4px;">
|
|
294
|
-
|
|
308
|
+
{{ content }}
|
|
295
309
|
</div>
|
|
296
310
|
</template>
|
|
297
|
-
</
|
|
311
|
+
</MessageRender>
|
|
298
312
|
</template>
|
|
299
313
|
```
|
|
300
314
|
|
|
301
|
-
>
|
|
315
|
+
> **注意**:使用默认插槽后,内置 Markdown 渲染被替换,需自行处理格式化。slot 运行时仅保证 `{ content }`(见 [MessageRender](/components/message/message-render))。
|
|
302
316
|
|
|
303
317
|
**渲染效果**
|
|
304
318
|
|
|
@@ -358,28 +372,84 @@ AI 可在一次回复中发起多个工具调用,组件依次渲染:
|
|
|
358
372
|
</script>
|
|
359
373
|
```
|
|
360
374
|
|
|
375
|
+
## 文件产物
|
|
376
|
+
|
|
377
|
+
当 `property.artifacts` 非空时,在工具调用区下方渲染 `MessageArtifacts` 文件卡片列表。点击卡片会通过 `useArtifactPreview` 打开 `ChatContainer` 侧栏「文件产物」Tab(见 [FileArtifactPanel](/components/message/file-artifact-panel))。
|
|
378
|
+
|
|
379
|
+
`AIFileInfo` 仅含元信息(`name` / `outputId` / `size` / `type`);`download_url` / `preview_url` 由容器 `onArtifactClick` 异步获取。命中唯一文件依赖 `messageUid = uid ?? String(id)` + 卡片下标 + `outputId`。
|
|
380
|
+
|
|
381
|
+
侧栏预览由面板内 `ArtifactPreviewHost` 按**文件分类**分派(详见面板文档「预览机制」):
|
|
382
|
+
|
|
383
|
+
| 分类 | 典型 type | 预览依赖 | 渲染 |
|
|
384
|
+
| ---- | --------- | -------- | ---- |
|
|
385
|
+
| 源码 / 配置 | `py` / `ts` / `json` / `yaml` / `Dockerfile` | `download_url` | highlight.js 高亮 |
|
|
386
|
+
| Markdown | `md` / `markdown` | `download_url` | MarkdownContent 富文本 |
|
|
387
|
+
| HTML | `html` / `htm` | `download_url` | `<iframe srcdoc>` 真实渲染 |
|
|
388
|
+
| 纯文本 | `txt` / `rst` | `download_url` | `<pre>` |
|
|
389
|
+
| 图片 | `png` / `jpg` / `svg` | `preview_url` | `<img>` |
|
|
390
|
+
| 其余(含未知类型) | `pdf` / `docx` / `xlsx` | `preview_url` | iframe(一般为后台转好的 PDF) |
|
|
391
|
+
|
|
392
|
+
`type` 为扩展名字符串(大小写不敏感),缺省时回退文件名推断;`md` 与 `markdown` 等价。预览重载、重试与取链约定见 [FileArtifactPanel 预览机制](/components/message/file-artifact-panel#预览机制)。
|
|
393
|
+
|
|
394
|
+
```vue
|
|
395
|
+
<template>
|
|
396
|
+
<MessageRender :message="message" />
|
|
397
|
+
</template>
|
|
398
|
+
|
|
399
|
+
<script setup lang="ts">
|
|
400
|
+
import { MessageRender, MessageRole, MessageStatus } from '@blueking/chat-x';
|
|
401
|
+
import type { AIFileInfo } from '@blueking/chat-x';
|
|
402
|
+
|
|
403
|
+
const artifacts: AIFileInfo[] = [
|
|
404
|
+
{ name: '监控大盘周报.html', outputId: 'output-html', size: 10240, type: 'html' },
|
|
405
|
+
{ name: '系统配置说明.md', outputId: 'output-md', size: 8192, type: 'md' },
|
|
406
|
+
{ name: '周例会纪要.txt', outputId: 'output-txt', size: 4096, type: 'txt' },
|
|
407
|
+
{ name: '告警策略配置.json', outputId: 'output-json', size: 2048, type: 'json' },
|
|
408
|
+
{ name: '立项说明书.pdf', outputId: 'output-pdf', size: 204800, type: 'pdf' },
|
|
409
|
+
{ name: '巡检现场照片.jpg', outputId: 'output-jpg', size: 1048576, type: 'jpg' },
|
|
410
|
+
];
|
|
411
|
+
|
|
412
|
+
const message = {
|
|
413
|
+
id: 'a1',
|
|
414
|
+
messageId: 'a1',
|
|
415
|
+
uid: 'assistant-uid-1',
|
|
416
|
+
role: MessageRole.Assistant,
|
|
417
|
+
status: MessageStatus.Complete,
|
|
418
|
+
content: '已为你生成一组评审材料,可点击卡片在侧栏预览或下载:',
|
|
419
|
+
property: { artifacts },
|
|
420
|
+
};
|
|
421
|
+
</script>
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**渲染效果(文档站内部示例;无 Provider 时卡片不可点击预览)**
|
|
425
|
+
|
|
361
426
|
## API
|
|
362
427
|
|
|
363
428
|
### Props
|
|
364
429
|
|
|
365
430
|
组件 Props 来自 `Partial<AssistantMessage>`(所有字段均可选):
|
|
366
431
|
|
|
367
|
-
| 属性名 | 类型 | 说明
|
|
368
|
-
| --------- | ----------------------- |
|
|
369
|
-
| content | `string` | AI
|
|
370
|
-
| status | `MessageStatus` |
|
|
371
|
-
| toolCalls | `ToolCall[]` | 工具调用列表,每项渲染一个 `ToolCallRender`
|
|
372
|
-
| id | `number \| string` | 消息 ID
|
|
373
|
-
| messageId | `number \| string` | 消息唯一标识
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
|
|
|
432
|
+
| 属性名 | 类型 | 说明 |
|
|
433
|
+
| --------- | ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
434
|
+
| content | `string` | AI 回复文本,支持 Markdown;空值时不渲染内容区 |
|
|
435
|
+
| status | `MessageStatus` | 影响 ContentRender;ToolCallRender 在无 toolMessage.status 时回退使用此值 |
|
|
436
|
+
| toolCalls | `ToolCall[]` | 工具调用列表,每项渲染一个 `ToolCallRender` |
|
|
437
|
+
| id | `number \| string` | 消息 ID;无 `uid` 时回退为 `messageUid` |
|
|
438
|
+
| messageId | `number \| string` | 消息唯一标识 |
|
|
439
|
+
| uid | `string` | 优先作为文件产物命中 / 「在对话中定位」的 `messageUid` |
|
|
440
|
+
| name | `string` | 消息发送者名称(可选) |
|
|
441
|
+
| role | `MessageRole.Assistant` | 消息角色,固定为 `'assistant'` |
|
|
442
|
+
| property | `{ artifacts?: AIFileInfo[]; extra?: ... }` | **本组件消费** `property.artifacts` 渲染文件卡片;`extra` 等由上层按需使用 |
|
|
377
443
|
|
|
378
444
|
### Slots
|
|
379
445
|
|
|
380
|
-
| 插槽名 | 参数 | 说明
|
|
381
|
-
| ------- | --------------------- |
|
|
382
|
-
| default | `{ content: string }` |
|
|
446
|
+
| 插槽名 | 参数 | 说明 |
|
|
447
|
+
| ------- | --------------------- | ----------------------------------------------------------------- |
|
|
448
|
+
| default | `{ content: string }` | 替换内容区渲染;toolCalls / MessageArtifacts 在内容区外独立渲染 |
|
|
449
|
+
|
|
450
|
+
### Events / Expose
|
|
451
|
+
|
|
452
|
+
无。
|
|
383
453
|
|
|
384
454
|
## 类型定义
|
|
385
455
|
|
|
@@ -426,4 +496,5 @@ interface ToolMessage extends BaseMessage<MessageRole.Tool, string> {
|
|
|
426
496
|
|
|
427
497
|
- [MessageRender](/components/message/message-render) — assistant 角色由其实例化
|
|
428
498
|
- [ToolMessage](/components/message/tool-message) — 工具执行结果可通过 toolCall.toolMessage 内联
|
|
429
|
-
- [ToolcallRender](/components/agent/toolcall-render) — 工具调用列表渲染
|
|
499
|
+
- [ToolcallRender](/components/agent/toolcall-render) — 工具调用列表渲染
|
|
500
|
+
- [FileArtifactPanel](/components/message/file-artifact-panel) — 文件产物侧栏列表与分类型预览 Host
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。 透传 models / selectedModel;支持 welcomeTitle 与 #welcome。 源码位置:src/components/chat-container/chat-container.vue。
|
|
4
|
+
完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。 透传 models / selectedModel;支持 welcomeTitle 与 #welcome。 侧栏展开/折叠由外部 v-model:asideCollapsed 严格受控(传入后以外部值为准,内部展开动作仅发 update 事件),不再依赖执行数据或文件产物有无;无数据时侧栏照常展开并展示空态。 侧栏固定从右侧展开(无 placement prop),且不再内置折叠按钮。 「文件产物」Tab 常驻挂载。 源码位置:src/components/chat-container/chat-container.vue。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-container** — 消息列表与滚动区域
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## 核心能力
|
|
24
24
|
|
|
25
|
-
- **分栏布局**:基于 `ResizeLayout
|
|
25
|
+
- **分栏布局**:基于 `ResizeLayout`,侧栏固定从右侧展开且无内置折叠按钮;展开 / 折叠由外部通过 `v-model:asideCollapsed` 判断,容器只负责渲染与回写,不再依赖 `executionGroups`、`keyword` 等数据条件。无数据时侧栏照常展开,由各面板展示空态
|
|
26
26
|
- **消息分组**:内置 `useMessageGroup`,自动分组、Tool 合并、Loading 注入
|
|
27
27
|
- **输入区状态推导**:对内 `messageStatus` 取 `inputStatus`——分组中存在 `LOADING_MESSAGE_ID`(`'__loading__'`)时用 `MessageStatus.Fetching`,否则用外部 `messageStatus`,保证「已发未流式」阶段也能停止、并避免重复发送
|
|
28
28
|
- **待审批发送阻塞**:存在 `AIDevToolApproval` 且为 `pending` / `draft` 时,输入区上方提示,并通过 `ChatInput.sendDisabledTip` 禁止发送
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
- **模型选择**:透传 `models`、`v-model:selectedModel` 与 `@modelChange` 至 `ChatInput`,传入 `models` 后在发送按钮左侧展示 [ModelSelector](/components/input/model-selector)
|
|
32
32
|
- **分享模式 / 渲染模式**:内置多选分享;`renderMode` 经 Provider 下传。`Share` 态开放侧栏只读查看,隐藏底部输入与「重试 / 跳过」等交互
|
|
33
33
|
- **字号主题**:`size` 为 `small`(默认 12px)/ `normal`(14px);根节点 `data-ai-size`,浮层同步 `document.body.dataset.aiSize`
|
|
34
|
+
- **消息时间时区**:`timezone` 经 `useGlobalConfig` 下传给 `MessageTime`,统一整个会话的时间展示时区;未配置时按浏览器时区
|
|
34
35
|
- **空状态欢迎页**:无消息时展示 Banner、`welcomeTitle`(默认「你好,我是小鲸」)与 `openingRemark`
|
|
35
36
|
|
|
36
37
|
## 组件结构
|
|
@@ -39,15 +40,14 @@
|
|
|
39
40
|
ai-chat-container(:data-ai-size="size")
|
|
40
41
|
├── Loading(chatLoading 时)
|
|
41
42
|
└── ResizeLayout
|
|
42
|
-
├── aside
|
|
43
|
-
│
|
|
43
|
+
├── aside(侧边栏,固定右侧)
|
|
44
|
+
│ └── .ai-full-screen-wrapper(全屏目标容器,ref=fullScreenRef)
|
|
44
45
|
│ │ ├── Tab 标签页
|
|
45
46
|
│ │ │ ├── 执行情况(默认 Tab)
|
|
46
47
|
│ │ │ ├── 自定义 Tab × N(可关闭;标签可由 getSideTabRenderComponent 自定义)
|
|
47
48
|
│ │ │ └── #setting → 全屏/退出全屏 ToolBtn
|
|
48
49
|
│ │ ├── ExecutionSummary(执行情况 Tab 内容)
|
|
49
50
|
│ │ └── 自定义 Tab 组件(getSideRenderComponent 优先,否则 data.component;可注入 #locateButton)
|
|
50
|
-
│ └── collapse-button(CollapsedIcon)
|
|
51
51
|
└── main(主内容区)
|
|
52
52
|
├── MessageContainer(有消息时;#group / #message 可自定义)
|
|
53
53
|
├── 欢迎页(无消息时 .ai-welcome-content)
|
|
@@ -133,17 +133,21 @@ ai-chat-container(:data-ai-size="size")
|
|
|
133
133
|
|
|
134
134
|
侧边栏默认包含「执行情况」Tab,展示所有工具调用和 FlowAgent 类型的 Activity 消息。支持关键词搜索过滤和点击定位到对话中的消息位置。
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
**展示条件**:侧栏是否渲染只取决于折叠态与是否存在可见 Tab —— `asideCollapsed === false` 且 `displayTabs` 非空即展开,与 `executionGroups`、`keyword`、是否有文件产物均无关。无执行数据时 `ExecutionSummary` 展示自身空态,无文件产物时 `FileArtifactPanel` 展示整块空态。`renderMode === Share` 分享态同样按折叠态展示侧栏(开放只读查看流程智能体详情/证据/执行情况),仅底部输入区保持隐藏。
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
**展开 / 折叠由外部判断(严格受控)**:只要传入了 `asideCollapsed`,折叠态就**一律以外部值为准**。容器内部的展开动作(点击文件卡片预览、`addCustomTab` 打开节点详情等)只发出 `update:asideCollapsed` 请求,外部不改值就不会展开 —— 所以务必用 `v-model:asideCollapsed` 绑定,只写 `:aside-collapsed` 会让这些内部入口失效。完全不传该 prop 时退化为组件内部状态(默认折叠),内部入口照常生效。容器不会因为数据变空而自动收起或重置自定义 Tab。
|
|
139
139
|
|
|
140
140
|
```vue
|
|
141
141
|
<template>
|
|
142
|
+
<!-- 业务方自行提供展开/收起入口;可复用包内 CollapsedAsideIcon -->
|
|
143
|
+
<button @click="asideCollapsed = !asideCollapsed">
|
|
144
|
+
{{ asideCollapsed ? '展开侧栏' : '收起侧栏' }}
|
|
145
|
+
</button>
|
|
142
146
|
<ChatContainer
|
|
143
147
|
v-model="inputValue"
|
|
148
|
+
v-model:aside-collapsed="asideCollapsed"
|
|
144
149
|
:messages="messages"
|
|
145
150
|
:message-status="messageStatus"
|
|
146
|
-
placement="left"
|
|
147
151
|
:on-send-message="handleSendMessage"
|
|
148
152
|
:on-agent-action="handleAgentAction"
|
|
149
153
|
@stop-streaming="handleStopStreaming"
|
|
@@ -152,6 +156,11 @@ ai-chat-container(:data-ai-size="size")
|
|
|
152
156
|
</template>
|
|
153
157
|
|
|
154
158
|
<script setup lang="ts">
|
|
159
|
+
import { shallowRef } from 'vue';
|
|
160
|
+
// import { CollapsedAsideIcon } from '@blueking/chat-x';
|
|
161
|
+
|
|
162
|
+
const asideCollapsed = shallowRef(true);
|
|
163
|
+
|
|
155
164
|
const handleCollapseChange = (isCollapse: boolean, resizeAsideWidth: number) => {
|
|
156
165
|
console.log('侧边栏折叠:', isCollapse, '宽度:', resizeAsideWidth);
|
|
157
166
|
};
|
|
@@ -160,16 +169,9 @@ ai-chat-container(:data-ai-size="size")
|
|
|
160
169
|
|
|
161
170
|
**渲染效果**(包含工具调用消息时,侧边栏自动展示「执行情况」)
|
|
162
171
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
| `placement` | 侧边栏位置 | 折叠按钮位置 | 折叠图标旋转 |
|
|
166
|
-
| ----------- | ------------ | ------------ | ------------ |
|
|
167
|
-
| `left` | 左侧(默认) | 主区域左边缘 | 折叠时旋转 180° |
|
|
168
|
-
| `right` | 右侧 | 主区域右边缘 | 默认旋转 180°,折叠时恢复 0° |
|
|
172
|
+
侧边栏固定从**右侧**展开(内部 `ResizeLayout` 的 `placement` 恒为 `right`),不再支持左侧布局,也不再内置折叠按钮 —— 展开 / 收起入口由业务方自行提供,通过 `v-model:asideCollapsed` 驱动。
|
|
169
173
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
**placement 对比**(左右两种布局)
|
|
174
|
+
**展开 / 收起动画**:侧栏宽度做 `0.3s cubic-bezier(0.4, 0, 0.2, 1)` 过渡,内容同步淡入淡出;动画期间内容锁定展开态宽度(CSS 变量 `--resize-aside-width`)由外层裁切,避免被压缩重排。拖拽调宽时过渡自动关闭,保证跟手。
|
|
173
175
|
|
|
174
176
|
## 侧栏全屏
|
|
175
177
|
|
|
@@ -183,7 +185,7 @@ ai-chat-container(:data-ai-size="size")
|
|
|
183
185
|
|
|
184
186
|
## 自定义 Tab
|
|
185
187
|
|
|
186
|
-
通过 `ref` 获取组件实例后,使用 `addCustomTab` / `removeCustomTab` 动态管理侧边栏 Tab
|
|
188
|
+
通过 `ref` 获取组件实例后,使用 `addCustomTab` / `removeCustomTab` 动态管理侧边栏 Tab。自定义 Tab 的生命周期由调用方掌控,容器不会因执行数据变空而自动清理(仅组件卸载时 `resetCustomTab`)。
|
|
187
189
|
|
|
188
190
|
### Tab 排序与显隐
|
|
189
191
|
|
|
@@ -239,6 +241,84 @@ ai-chat-container(:data-ai-size="size")
|
|
|
239
241
|
</script>
|
|
240
242
|
```
|
|
241
243
|
|
|
244
|
+
### 内置「文件产物」Tab
|
|
245
|
+
|
|
246
|
+
除「执行情况」外,容器内置一个常驻固定 Tab —— **「文件产物」**(`name: 'file-artifact'`),用于聚合预览当前会话所有 `AssistantMessage.property.artifacts`(按 `outputId` 去重):
|
|
247
|
+
|
|
248
|
+
- **常驻挂载 / 默认选中**:容器初始化即通过 `ensureCustomTab` 挂上该 Tab(不展开侧栏);因 `order: -1` 排在 Tab 栏首位,在用户未主动切换过 Tab 时它就是侧栏的默认面板。不随产物有无增删,无产物时由面板展示整块空态
|
|
249
|
+
- **主动打开**:点击 AI 回复中的文件卡片([ArtifactFileCard](/components/message/assistant-message))时,容器通过 `useArtifactPreviewProvider` 以 `outputId` 命中该文件,再 `addCustomTab` 展开侧栏并选中「文件产物」
|
|
250
|
+
- **排序 / 关闭**:`order: -1` 排在「执行情况」之前,`closable: false` 不可关闭
|
|
251
|
+
- **命中态维护**:产物列表为空时清空命中;命中项已不在列表时回落到第一个 `outputId`
|
|
252
|
+
- **内容**:由 [FileArtifactPanel](/components/message/file-artifact-panel) 渲染列表与下载头(无产物时为整块空态),预览委托内部 `ArtifactPreviewHost`;`download_url` / `preview_url` 通过 `onArtifactClick` 异步获取。文本类(`html` / `markdown` / `md` / `txt` / `json`)拉 `download_url` 正文直渲染(`md` 与 `markdown` 等价);其余类型用 `preview_url` iframe(一般为后台转好的 PDF)
|
|
253
|
+
- **状态管理**:命中、切换与 URL 缓存由 [useArtifactPreview](/composables/use-artifact-preview) 提供(Provider 在容器内、Consumer 在文件卡片 / 面板内);正文加载与分类型渲染由 Host 内部完成
|
|
254
|
+
- **未传 `onArtifactClick`**:下载按钮隐藏,预览区展示无数据
|
|
255
|
+
|
|
256
|
+
详见 [FileArtifactPanel 文件产物预览](/components/message/file-artifact-panel) 与 [useArtifactPreview 文件产物预览](/composables/use-artifact-preview)。
|
|
257
|
+
|
|
258
|
+
#### 接入示例
|
|
259
|
+
|
|
260
|
+
```vue
|
|
261
|
+
<template>
|
|
262
|
+
<ChatContainer
|
|
263
|
+
v-model="input"
|
|
264
|
+
:messages="messages"
|
|
265
|
+
:on-artifact-click="onArtifactClick"
|
|
266
|
+
@send-message="handleSend"
|
|
267
|
+
/>
|
|
268
|
+
</template>
|
|
269
|
+
|
|
270
|
+
<script setup lang="ts">
|
|
271
|
+
import { ref, shallowRef } from 'vue'
|
|
272
|
+
import {
|
|
273
|
+
ChatContainer,
|
|
274
|
+
MessageRole,
|
|
275
|
+
MessageStatus,
|
|
276
|
+
type AIFileInfo,
|
|
277
|
+
type Message,
|
|
278
|
+
} from '@blueking/chat-x'
|
|
279
|
+
|
|
280
|
+
const input = ref('')
|
|
281
|
+
const messages = shallowRef<Message[]>([
|
|
282
|
+
{
|
|
283
|
+
id: 'u1',
|
|
284
|
+
messageId: 'u1',
|
|
285
|
+
role: MessageRole.User,
|
|
286
|
+
status: MessageStatus.Complete,
|
|
287
|
+
content: '整理本周评审材料',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 'a1',
|
|
291
|
+
messageId: 'a1',
|
|
292
|
+
uid: 'assistant-uid-1',
|
|
293
|
+
role: MessageRole.Assistant,
|
|
294
|
+
status: MessageStatus.Complete,
|
|
295
|
+
content: '已生成评审材料,点击卡片可在侧栏预览:',
|
|
296
|
+
property: {
|
|
297
|
+
artifacts: [
|
|
298
|
+
{ name: '周报.html', outputId: 'a-html', size: 10240, type: 'html' },
|
|
299
|
+
{ name: '说明.md', outputId: 'a-md', size: 8192, type: 'md' },
|
|
300
|
+
{ name: '配置.json', outputId: 'a-json', size: 2048, type: 'json' },
|
|
301
|
+
{ name: '立项.pdf', outputId: 'a-pdf', size: 204800, type: 'pdf' },
|
|
302
|
+
] satisfies AIFileInfo[],
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
])
|
|
306
|
+
|
|
307
|
+
/** 文本类预览依赖 download_url;iframe 类依赖 preview_url */
|
|
308
|
+
const onArtifactClick = async (file: AIFileInfo) => {
|
|
309
|
+
const res = await api.getArtifactUrls(file.outputId)
|
|
310
|
+
return {
|
|
311
|
+
download_url: res.download_url,
|
|
312
|
+
preview_url: res.preview_url,
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const handleSend = () => {
|
|
317
|
+
/* ... */
|
|
318
|
+
}
|
|
319
|
+
</script>
|
|
320
|
+
```
|
|
321
|
+
|
|
242
322
|
### 自定义 Tab 与「在对话中定位」
|
|
243
323
|
|
|
244
324
|
`addCustomTab` 的 `data` 可携带 **`messageUid`**(与对应活动消息的 `message.uid` 一致)。`ChatContainer` 在侧栏用 `<component :is="sideRenderComponent">`(内部计算属性,见上文「侧栏渲染扩展」)渲染自定义 Tab 时,会向子组件提供 **`locateButton` 插槽**:默认渲染「在对话中定位」按钮,点击后调用内部 `handleLocateMessageGroup(messageUid)`,优先滚动到主区域 `document.getElementById(messageUid)`;若不存在该节点,则在当前 `messageGroups` 中查找包含 `message.uid === messageUid` 的消息组,并滚动到该组的容器(`MessageGroup.uid` 作为组级 `id`)。
|
|
@@ -376,9 +456,9 @@ ai-chat-container(:data-ai-size="size")
|
|
|
376
456
|
|
|
377
457
|
## 用户问题中断
|
|
378
458
|
|
|
379
|
-
当会话中最近一条待处理 interrupt 包含 `InterruptReason.UserQuestion` 时,`ChatContainer` 会在 `ChatInput` 上方显示 [UserQuestionCard](/components/agent/user-question-card)
|
|
459
|
+
当会话中最近一条待处理 interrupt 包含 `InterruptReason.UserQuestion` 时,`ChatContainer` 会在 `ChatInput` 上方显示 [UserQuestionCard](/components/agent/user-question-card)(一次一题,标题栏可切换题目)。
|
|
380
460
|
|
|
381
|
-
-
|
|
461
|
+
- **结构化作答**:用户在卡片内逐题选择(单选可自动跳下一题),点击「完成」或「跳过」后通过 `onInterruptResume(payload, interrupt)` 回传 `UserQuestionResume`。
|
|
382
462
|
- **输入框发送**:用户也可在输入框直接点击发送;容器会调用 `onSendMessage(content, docSchema, options)`,其中 `options.interrupt` 为当前激活的 UserQuestion,`options.payload` 为 `buildSkipResumePayload` 生成的 skip resume(`status: 'cancelled'`,`answers: []`)。此时**不会自动清空**输入框,由业务侧在 `onSendMessage` 内决定如何处理 `content` 与中断恢复。
|
|
383
463
|
|
|
384
464
|
```vue
|
|
@@ -618,20 +698,21 @@ ai-chat-container(:data-ai-size="size")
|
|
|
618
698
|
|
|
619
699
|
ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`(排除 `enableSelection` 和 `messageGroups`),另外新增:
|
|
620
700
|
|
|
621
|
-
| 属性名 | 类型
|
|
622
|
-
| ------------------------- |
|
|
623
|
-
| chatLoading | `boolean`
|
|
624
|
-
| commonTippyOptions | `AITippyProps`
|
|
625
|
-
| executionTabVisible | `boolean`
|
|
626
|
-
| getSideRenderComponent | `(h, props?) => VNode \| undefined`
|
|
627
|
-
| getSideTabRenderComponent | `(h, tab, { removeCustomTab }) => VNode \| undefined`
|
|
628
|
-
| models | `IModelOption[]`
|
|
629
|
-
| openingRemark | `string`
|
|
630
|
-
|
|
|
631
|
-
|
|
|
632
|
-
|
|
|
633
|
-
| welcomeTitle | `string`
|
|
634
|
-
| onCustomTabChange | `(tab: CustomTab) => Promise<any>`
|
|
701
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
702
|
+
| ------------------------- | ---------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
703
|
+
| chatLoading | `boolean` | — | 整体加载状态,`true` 时显示 Loading 遮罩 |
|
|
704
|
+
| commonTippyOptions | `AITippyProps` | — | 通用 Tippy 配置,注入到所有使用 `v-overflow-tips` 的子组件 |
|
|
705
|
+
| executionTabVisible | `boolean` | `true` | 「执行情况」Tab 是否展示;为 `false` 时从 Tab 栏隐藏,若正被选中则切到首个可见 Tab |
|
|
706
|
+
| getSideRenderComponent | `(h, props?) => VNode \| undefined` | — | 自定义侧栏内容区渲染;未返回时使用 `selectedTab.data.component` |
|
|
707
|
+
| getSideTabRenderComponent | `(h, tab, { removeCustomTab }) => VNode \| undefined` | — | 自定义侧栏 Tab 标签渲染;未返回时使用默认图标 + 文案 + 关闭按钮 |
|
|
708
|
+
| models | `IModelOption[]` | — | 可选模型列表(继承自 ChatInput);传入后在发送按钮左侧展示 ModelSelector |
|
|
709
|
+
| openingRemark | `string` | — | 开场白,无消息时显示,支持 Markdown |
|
|
710
|
+
| resizeProps | `{ disabled?: boolean; initialDivide?: number \| string; max?: number; min?: number }` | — | 透传给内部 `ResizeLayout`;与默认 `collapsible: false`、`immediate: true`、`min: 400` 合并;`placement` 固定为 `right`,不可覆盖。**数字型** `initialDivide` 还会作为内部侧栏宽度初值(驱动 `--resize-main-width`,并在展开时作为 `collapseChange` 的 `width`);百分比等字符串则回退为 `400` |
|
|
711
|
+
| size | `'normal' \| 'small'` | `'small'` | 字号主题:`small` 12px / `normal` 14px;根节点设置 `data-ai-size` 并注入 `useGlobalConfig` |
|
|
712
|
+
| timezone | `string` | — | 消息时间展示所用的 IANA 时区名(如 `Asia/Shanghai`);经 `useGlobalConfig` 注入,未配置时按浏览器时区展示,详见 [MessageTime](/components/feedback/message-time) |
|
|
713
|
+
| welcomeTitle | `string` | — | 欢迎页标题;未传时默认展示「你好,我是小鲸」 |
|
|
714
|
+
| onCustomTabChange | `(tab: CustomTab) => Promise<any>` | — | 自定义 Tab 切换回调,返回值作为 Tab 组件 props |
|
|
715
|
+
| onArtifactClick | `(file: AIFileInfo) => Promise<{ download_url?: string; preview_url?: string }>` | — | 异步获取下载 / 预览链接(每次调用重新获取,无缓存;同文件并发去重)。文本类预览依赖 `download_url`,iframe 类依赖 `preview_url`;未传则隐藏下载、预览无数据 |
|
|
635
716
|
|
|
636
717
|
> 其余 Props(如 `messages`、`messageStatus`、`onSendMessage`、`shortcuts` 等)继承自 [ChatInput](/components/input/chat-input) 与 [MessageContainer](/components/setup/message-container)。
|
|
637
718
|
|
|
@@ -644,6 +725,7 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
644
725
|
| cite | `string` | 引用内容 |
|
|
645
726
|
| renderMode | `RenderMode` | 渲染模式(默认 `Chat`)。`Share` 开放侧栏只读查看并隐藏底部输入与交互操作;`Test` 隐藏分享按钮 |
|
|
646
727
|
| selectedModel | `string` | 当前选中模型的 `llm_name`,透传至 ChatInput 的 ModelSelector |
|
|
728
|
+
| asideCollapsed | `boolean` | 侧栏折叠态,**严格受控**:传入后一律以外部值为准,内部展开动作(文件预览、`addCustomTab`)只发 `update:asideCollapsed`,外部不改则不展开;不传时由组件内部自持(默认折叠) |
|
|
647
729
|
|
|
648
730
|
### Events
|
|
649
731
|
|
|
@@ -653,7 +735,8 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
653
735
|
| shortcutClose | — | 关闭快捷指令表单 |
|
|
654
736
|
| shortcutSubmit | `(formModel: Record<string, unknown>)` | 提交快捷指令表单 |
|
|
655
737
|
| confirmShare | `(messages: Message[], source?: IToolBtn)` | 确认分享/多选,携带选中的消息与触发按钮对象(`source`,用于区分 share/save 等场景) |
|
|
656
|
-
| collapseChange | `(isCollapse: boolean, width: number)` |
|
|
738
|
+
| collapseChange | `(isCollapse: boolean, width: number)` | 侧边栏折叠/展开状态变化(含宽度,便于外层容器扩宽) |
|
|
739
|
+
| update:asideCollapsed | `(collapsed: boolean)` | 折叠态变更请求(`v-model:asideCollapsed`);受控时是否真的展开取决于外部是否更新该值 |
|
|
657
740
|
| selectShortcut | `(shortcut: Shortcut)` | 选择快捷指令(继承自 ChatInput) |
|
|
658
741
|
| deleteShortcut | — | 删除已选快捷指令(继承自 ChatInput) |
|
|
659
742
|
| modelChange | `(model: IModelOption)` | 切换模型(继承自 ChatInput) |
|
|
@@ -684,10 +767,10 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
684
767
|
|
|
685
768
|
通过 `v-model:render-mode` 控制容器的渲染行为。`ChatContainer` 会把当前 `renderMode` 注入给后代组件,供内容渲染根据场景收敛交互能力。
|
|
686
769
|
|
|
687
|
-
| `renderMode` | 侧边栏 Tab
|
|
770
|
+
| `renderMode` | 侧边栏 Tab | 底部输入区域 | MessageTools 工具栏 | 说明 |
|
|
688
771
|
| ------------ | ---------------------- | --------------------------------- | --------------------- | -------------------------------- |
|
|
689
772
|
| `Chat` | 正常显示 | 正常显示(ChatInput / ShortcutRender / SelectionFooter) | 全部工具按钮 | 默认对话模式 |
|
|
690
|
-
| `Share` |
|
|
773
|
+
| `Share` | 正常显示(开放只读查看) | **隐藏** | **隐藏**(多选模式) | 分享预览模式;开放流程智能体侧栏详情/证据/执行情况与耗时,仅隐藏「重试/跳过」等交互 |
|
|
691
774
|
| `Test` | 正常显示 | 正常显示 | 过滤掉「分享」按钮 | 测试/嵌入模式,隐藏分享入口 |
|
|
692
775
|
|
|
693
776
|
```vue
|
|
@@ -786,5 +869,5 @@ interface Shortcut {
|
|
|
786
869
|
- [SelectionFooter](/components/input/selection-footer) — 多选操作栏
|
|
787
870
|
- [ToolBtn](/components/feedback/tool-btn) — 侧栏全屏按钮
|
|
788
871
|
- [useFullScreen](/composables/use-full-screen) — 侧栏全屏控制
|
|
789
|
-
- [useGlobalConfig](/composables/use-global-config) — 注入 `size` 与 `
|
|
872
|
+
- [useGlobalConfig](/composables/use-global-config) — 注入 `size`、`supportUpload` 与 `timezone`
|
|
790
873
|
- [主题配置](/theme/theme) — 字号主题 CSS 变量
|