@blueking/chat-x 0.0.33 → 0.0.35
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/contents.d.ts +12 -11
- package/dist/composables/use-common.d.ts +9 -1
- package/dist/composables/use-message-group.d.ts +3 -3
- package/dist/index.js +1931 -1924
- package/dist/index.js.map +1 -1
- package/dist/mcp/generated/docs/activity-message.md +71 -62
- package/dist/mcp/generated/docs/chat-container.md +7 -4
- package/dist/mcp/generated/docs/use-message-group.md +1 -1
- package/dist/mcp/generated/index.json +2 -2
- package/package.json +2 -2
|
@@ -151,15 +151,17 @@ ActivityMessage 展示活动类消息:知识检索(knowledge_rag)、引用
|
|
|
151
151
|
|
|
152
152
|
## FlowAgent 执行情况模式
|
|
153
153
|
|
|
154
|
-
`activityType` 设为 `MessageContentType.FlowAgent`(`'flow_agent'`),`content` 传入 `BkFlowMessageContent`
|
|
154
|
+
`activityType` 设为 `MessageContentType.FlowAgent`(`'flow_agent'`),`content` 传入 `BkFlowMessageContent` 任务数组。用于展示一个或多个蓝鲸标准运维(BkFlow)任务的执行状态、节点列表和统计信息。
|
|
155
155
|
|
|
156
156
|
### 核心交互
|
|
157
157
|
|
|
158
|
-
- **标题栏**:显示「执行情况」+
|
|
159
|
-
-
|
|
158
|
+
- **标题栏**:显示「执行情况」+ 所有任务聚合后的各状态计数(执行中 / 成功 / 失败 / 挂起),颜色区分
|
|
159
|
+
- **任务组**:逐个展示任务行,带状态图标和总耗时
|
|
160
160
|
- **节点列表**:每个节点显示状态圆点、名称和耗时;hover 时出现「详情」按钮
|
|
161
161
|
- **节点详情**:点击「详情」按钮会通过 `useCustomTabConsumer` 在 `ChatContainer` 侧边栏新增自定义 Tab,展示节点配置(基础信息、输入参数、输出参数)
|
|
162
162
|
|
|
163
|
+
> `FlowAgentContent` 会读取 `ChatContainer` 注入的 `renderMode`。当 `renderMode === RenderMode.Share` 时,节点列表仅展示状态和名称,不展示节点耗时与「详情」按钮,避免分享预览中出现可交互的节点详情入口。独立使用 `ActivityMessage` 且没有上层 Provider 时,默认按 `Chat` 模式渲染。
|
|
164
|
+
|
|
163
165
|
### 内部渲染结构
|
|
164
166
|
|
|
165
167
|
```
|
|
@@ -169,7 +171,7 @@ FlowAgentContent(activityType = 'flow_agent')
|
|
|
169
171
|
│ ├── Loading / ArrowIcon(随 status 切换)
|
|
170
172
|
│ └── 执行情况:执行中 N / 成功 N / 失败 N / 挂起 N
|
|
171
173
|
└── #default
|
|
172
|
-
└── TaskGroup
|
|
174
|
+
└── TaskGroup × N
|
|
173
175
|
├── TaskHeader(可折叠/展开)
|
|
174
176
|
│ ├── 状态图标(running=Loading / success / failed / suspended)
|
|
175
177
|
│ ├── task_name(HighlightKeyword 支持搜索高亮)
|
|
@@ -202,54 +204,56 @@ FlowAgentContent(activityType = 'flow_agent')
|
|
|
202
204
|
const collapsed = ref(false);
|
|
203
205
|
const status = ref(MessageStatus.Complete);
|
|
204
206
|
|
|
205
|
-
const flowContent: BkFlowMessageContent =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
nodes: {
|
|
215
|
-
node1: {
|
|
216
|
-
id: 'node1',
|
|
217
|
-
name: '数据拉取',
|
|
218
|
-
state: 'FINISHED',
|
|
219
|
-
elapsed_time: 12,
|
|
220
|
-
start_time: '2025-01-01 10:00:00',
|
|
221
|
-
finish_time: '2025-01-01 10:00:12',
|
|
222
|
-
loop: 1,
|
|
223
|
-
retry: 0,
|
|
224
|
-
skip: false,
|
|
225
|
-
type: 'ServiceActivity',
|
|
226
|
-
},
|
|
227
|
-
node2: {
|
|
228
|
-
id: 'node2',
|
|
229
|
-
name: '数据转换',
|
|
230
|
-
state: 'FINISHED',
|
|
231
|
-
elapsed_time: 45,
|
|
232
|
-
start_time: '2025-01-01 10:00:12',
|
|
233
|
-
finish_time: '2025-01-01 10:00:57',
|
|
234
|
-
loop: 1,
|
|
235
|
-
retry: 0,
|
|
236
|
-
skip: false,
|
|
237
|
-
type: 'ServiceActivity',
|
|
207
|
+
const flowContent: BkFlowMessageContent = [
|
|
208
|
+
{
|
|
209
|
+
task_id: 100,
|
|
210
|
+
task_name: '数据清洗流程',
|
|
211
|
+
task_state: 'FINISHED',
|
|
212
|
+
task_outputs: [],
|
|
213
|
+
statistics: {
|
|
214
|
+
total: 3,
|
|
215
|
+
state_counts: { FINISHED: 2, FAILED: 1 },
|
|
238
216
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
217
|
+
nodes: {
|
|
218
|
+
node1: {
|
|
219
|
+
id: 'node1',
|
|
220
|
+
name: '数据拉取',
|
|
221
|
+
state: 'FINISHED',
|
|
222
|
+
elapsed_time: 12,
|
|
223
|
+
start_time: '2025-01-01 10:00:00',
|
|
224
|
+
finish_time: '2025-01-01 10:00:12',
|
|
225
|
+
loop: 1,
|
|
226
|
+
retry: 0,
|
|
227
|
+
skip: false,
|
|
228
|
+
type: 'ServiceActivity',
|
|
229
|
+
},
|
|
230
|
+
node2: {
|
|
231
|
+
id: 'node2',
|
|
232
|
+
name: '数据转换',
|
|
233
|
+
state: 'FINISHED',
|
|
234
|
+
elapsed_time: 45,
|
|
235
|
+
start_time: '2025-01-01 10:00:12',
|
|
236
|
+
finish_time: '2025-01-01 10:00:57',
|
|
237
|
+
loop: 1,
|
|
238
|
+
retry: 0,
|
|
239
|
+
skip: false,
|
|
240
|
+
type: 'ServiceActivity',
|
|
241
|
+
},
|
|
242
|
+
node3: {
|
|
243
|
+
id: 'node3',
|
|
244
|
+
name: '结果写入',
|
|
245
|
+
state: 'FAILED',
|
|
246
|
+
elapsed_time: 3,
|
|
247
|
+
start_time: '2025-01-01 10:00:57',
|
|
248
|
+
finish_time: '2025-01-01 10:01:00',
|
|
249
|
+
loop: 1,
|
|
250
|
+
retry: 0,
|
|
251
|
+
skip: false,
|
|
252
|
+
type: 'ServiceActivity',
|
|
253
|
+
},
|
|
250
254
|
},
|
|
251
255
|
},
|
|
252
|
-
|
|
256
|
+
];
|
|
253
257
|
</script>
|
|
254
258
|
```
|
|
255
259
|
|
|
@@ -262,16 +266,18 @@ const messages = [
|
|
|
262
266
|
role: 'activity',
|
|
263
267
|
activityType: MessageContentType.FlowAgent, // 'flow_agent'
|
|
264
268
|
status: MessageStatus.Streaming,
|
|
265
|
-
content:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
task_id: 100,
|
|
272
|
+
task_name: '数据清洗流程',
|
|
273
|
+
task_state: 'RUNNING',
|
|
274
|
+
task_outputs: [],
|
|
275
|
+
statistics: { total: 3, state_counts: { RUNNING: 1, FINISHED: 2 } },
|
|
276
|
+
nodes: {
|
|
277
|
+
/* ... */
|
|
278
|
+
},
|
|
273
279
|
},
|
|
274
|
-
|
|
280
|
+
],
|
|
275
281
|
},
|
|
276
282
|
];
|
|
277
283
|
```
|
|
@@ -286,6 +292,7 @@ const messages = [
|
|
|
286
292
|
| `success` | FINISHED | #18B456 |
|
|
287
293
|
| `failed` | FAILED / REVOKED / ROLL_BACK_FAILED | #EA3636 |
|
|
288
294
|
| `suspended` | SUSPENDED | #F59500 |
|
|
295
|
+
| `pending` | PENDING | #DCDEE5 |
|
|
289
296
|
|
|
290
297
|
### 节点详情 Tab
|
|
291
298
|
|
|
@@ -298,14 +305,16 @@ const messages = [
|
|
|
298
305
|
### 相关类型定义
|
|
299
306
|
|
|
300
307
|
```typescript
|
|
301
|
-
import { MessageContentType, type BkFlowMessageContent, type BkFlowNode } from '@blueking/chat-x';
|
|
308
|
+
import { MessageContentType, type BkFlowMessageContent, type BkFlowNode, type BkFlowTask } from '@blueking/chat-x';
|
|
309
|
+
|
|
310
|
+
type BkFlowMessageContent = BkFlowTask[];
|
|
302
311
|
|
|
303
|
-
type
|
|
312
|
+
type BkFlowTask = {
|
|
304
313
|
nodes: Record<string, BkFlowNode>;
|
|
305
314
|
statistics: { state_counts: Record<string, number>; total: number };
|
|
306
315
|
task_id: number;
|
|
307
316
|
task_name: string;
|
|
308
|
-
task_outputs: unknown
|
|
317
|
+
task_outputs: unknown;
|
|
309
318
|
task_state: string;
|
|
310
319
|
};
|
|
311
320
|
|
|
@@ -377,7 +386,7 @@ enum MessageContentType {
|
|
|
377
386
|
| ------------ | --------------------------------------------------------------------------- | ------ | --------------------------------------------------------- |
|
|
378
387
|
| content | `ReferenceDocumentContent[] \| KnowledgeRagContent \| BkFlowMessageContent` | - | 内容数据,格式随 `activityType` 不同 |
|
|
379
388
|
| activityType | `'knowledge_rag' \| 'flow_agent' \| 'reference_document' \| string` | - | 活动类型,决定渲染模式(知识检索 / FlowAgent / 引用文档) |
|
|
380
|
-
| status | `MessageStatus` | - |
|
|
389
|
+
| status | `MessageStatus` | - | 消息状态;在 `knowledge_rag` 模式下影响标题和图标,在 `flow_agent` 模式下影响标题 Loading 状态 |
|
|
381
390
|
| id | `string \| number` | - | 消息 ID |
|
|
382
391
|
| messageId | `string \| number` | - | 消息唯一标识 |
|
|
383
392
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
ChatContainer 提供完整 AI 对话布局:分栏(ResizeLayout)、消息列表(MessageContainer)、输入(ChatInput)、执行摘要(ExecutionSummary)、快捷表单(ShortcutRender)与多选栏(SelectionFooter)。 内置 useMessageGroup、分享与自定义 Tab 等能力;对 MessageContainer/ChatInput 下推 inputStatus(末尾 Loading 占位时推导 Fetching),适合一站式接入。 通过 props 传入 messages、shortcuts 等,事件与 ChatInput/MessageContainer
|
|
4
|
+
ChatContainer 提供完整 AI 对话布局:分栏(ResizeLayout)、消息列表(MessageContainer)、输入(ChatInput)、执行摘要(ExecutionSummary)、快捷表单(ShortcutRender)与多选栏(SelectionFooter)。 内置 useMessageGroup、分享与自定义 Tab 等能力;对 MessageContainer/ChatInput 下推 inputStatus(末尾 Loading 占位时推导 Fetching),适合一站式接入。 通过 props 传入 messages、shortcuts 等,事件与 ChatInput/MessageContainer 对齐;renderMode 会通过内部 provide 下传给子内容组件。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-container** — 消息列表与滚动区域
|
|
@@ -27,6 +27,7 @@ ChatContainer 提供完整 AI 对话布局:分栏(ResizeLayout)、消息
|
|
|
27
27
|
- **执行摘要**:侧边栏展示工具调用 / FlowAgent 执行记录,支持关键词搜索和对话定位
|
|
28
28
|
- **自定义 Tab**:通过 `useCustomTabProvider` 支持动态添加自定义 Tab(如节点详情)
|
|
29
29
|
- **分享模式**:内置消息多选分享流程,选中用户消息后确认分享
|
|
30
|
+
- **渲染模式注入**:`renderMode` 会通过内部 Provider 下传给后代内容组件;例如 FlowAgent 节点在 `Share` 模式下隐藏耗时和「详情」入口
|
|
30
31
|
- **空状态欢迎页**:无消息时展示欢迎语和开场白
|
|
31
32
|
|
|
32
33
|
## 组件结构
|
|
@@ -366,7 +367,7 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
366
367
|
| confirmShare | `(messages: Message[])` | 确认分享,携带选中的消息 |
|
|
367
368
|
| collapseChange | `(isCollapse: boolean, width: number)` | 侧边栏折叠/展开状态变化 |
|
|
368
369
|
| selectShortcut | `(shortcut: Shortcut)` | 选择快捷指令(继承自 ChatInput) |
|
|
369
|
-
| deleteShortcut |
|
|
370
|
+
| deleteShortcut | — | 删除已选快捷指令(继承自 ChatInput) |
|
|
370
371
|
|
|
371
372
|
### Slots
|
|
372
373
|
|
|
@@ -385,15 +386,17 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
385
386
|
| addCustomTab | `(tab: CustomTab) => void` | 添加自定义 Tab |
|
|
386
387
|
| removeCustomTab | `(tabName: string) => void` | 移除自定义 Tab |
|
|
387
388
|
| selectCustomTab | `(tab: CustomTab) => void` | 切换到指定 Tab |
|
|
389
|
+
| enterShareMode | `() => void` | 手动进入分享多选模式 |
|
|
390
|
+
| exitShareMode | `() => void` | 退出分享多选模式,并清空已选消息 |
|
|
388
391
|
|
|
389
392
|
## 渲染模式
|
|
390
393
|
|
|
391
|
-
通过 `v-model:render-mode`
|
|
394
|
+
通过 `v-model:render-mode` 控制容器的渲染行为。`ChatContainer` 会把当前 `renderMode` 注入给后代组件,供内容渲染根据场景收敛交互能力。
|
|
392
395
|
|
|
393
396
|
| `renderMode` | 侧边栏 Tab / 折叠按钮 | 底部输入区域 | MessageTools 工具栏 | 说明 |
|
|
394
397
|
| ------------ | ---------------------- | --------------------------------- | --------------------- | -------------------------------- |
|
|
395
398
|
| `Chat` | 正常显示 | 正常显示(ChatInput / ShortcutRender / SelectionFooter) | 全部工具按钮 | 默认对话模式 |
|
|
396
|
-
| `Share` | **隐藏** | **隐藏** | **隐藏**(多选模式) |
|
|
399
|
+
| `Share` | **隐藏** | **隐藏** | **隐藏**(多选模式) | 分享预览模式,仅展示消息;FlowAgent 节点会隐藏耗时和「详情」入口 |
|
|
397
400
|
| `Test` | 正常显示 | 正常显示 | 过滤掉「分享」按钮 | 测试/嵌入模式,隐藏分享入口 |
|
|
398
401
|
|
|
399
402
|
```vue
|
|
@@ -111,7 +111,7 @@ const isExecutionMessage = (m: Message): boolean => {
|
|
|
111
111
|
| 消息类型 | 搜索范围 |
|
|
112
112
|
| ---------- | ------------------------------------------------------------ |
|
|
113
113
|
| toolCall | `function.name`、`mcpName`、`description`、`arguments`、`id` |
|
|
114
|
-
| flow_agent | `task_name`、各节点 `name`
|
|
114
|
+
| flow_agent | 各任务 `task_name`、各节点 `name` |
|
|
115
115
|
|
|
116
116
|
## 分享模式
|
|
117
117
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.0.0",
|
|
3
|
-
"generatedAt": "2026-
|
|
3
|
+
"generatedAt": "2026-05-12T09:32:40.415Z",
|
|
4
4
|
"domains": {
|
|
5
5
|
"message": {
|
|
6
6
|
"label": "消息展示",
|
|
@@ -538,7 +538,7 @@
|
|
|
538
538
|
"slug": "chat-container",
|
|
539
539
|
"category": "molecular",
|
|
540
540
|
"description": "顶层聊天容器组件,整合了 `MessageContainer`(消息列表)、`ChatInput`(输入框)、`ExecutionSummary`(执行摘要面板)、`ShortcutRender`(快捷指令表单)和 `SelectionFooter`(多选操作栏)。提供完整的 AI 对话界面布局能力。",
|
|
541
|
-
"aiSummary": "ChatContainer 提供完整 AI 对话布局:分栏(ResizeLayout)、消息列表(MessageContainer)、输入(ChatInput)、执行摘要(ExecutionSummary)、快捷表单(ShortcutRender)与多选栏(SelectionFooter)。 内置 useMessageGroup、分享与自定义 Tab 等能力;对 MessageContainer/ChatInput 下推 inputStatus(末尾 Loading 占位时推导 Fetching),适合一站式接入。 通过 props 传入 messages、shortcuts 等,事件与 ChatInput/MessageContainer
|
|
541
|
+
"aiSummary": "ChatContainer 提供完整 AI 对话布局:分栏(ResizeLayout)、消息列表(MessageContainer)、输入(ChatInput)、执行摘要(ExecutionSummary)、快捷表单(ShortcutRender)与多选栏(SelectionFooter)。 内置 useMessageGroup、分享与自定义 Tab 等能力;对 MessageContainer/ChatInput 下推 inputStatus(末尾 Loading 占位时推导 Fetching),适合一站式接入。 通过 props 传入 messages、shortcuts 等,事件与 ChatInput/MessageContainer 对齐;renderMode 会通过内部 provide 下传给子内容组件。",
|
|
542
542
|
"relatedComponents": [
|
|
543
543
|
{
|
|
544
544
|
"slug": "message-container",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/chat-x",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "蓝鲸智云 AI Chat 组件库 —— 遵循 AG-UI,为 AI Agent 和人类开发者共同设计的对话 UI 组件库。",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"vitepress": "2.0.0-alpha.16",
|
|
79
79
|
"vitest": "^4.0.18",
|
|
80
80
|
"vue-tsc": "^3.1.4",
|
|
81
|
-
"@blueking/chat-helper": "0.0.
|
|
81
|
+
"@blueking/chat-helper": "0.0.3"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"dev": "vite --config vite.config.ts",
|