@blueking/chat-x 0.0.52-dev.6 → 2.4.1
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/components/chat-content/flow-agent-content/flow-agent-state.d.ts +25 -8
- package/dist/components/chat-content/flow-agent-content/use-flow-agent.d.ts +6 -1
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +1 -1
- package/dist/composables/use-common.d.ts +9 -0
- package/dist/icons/execution.d.ts +4 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2726 -2668
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +4 -2
- package/dist/mcp/generated/docs/activity-layout.md +4 -2
- package/dist/mcp/generated/docs/activity-message.md +18 -16
- package/dist/mcp/generated/docs/ai-selection.md +5 -2
- package/dist/mcp/generated/docs/ai-slash-input.md +4 -0
- package/dist/mcp/generated/docs/animation-text.md +5 -1
- package/dist/mcp/generated/docs/assistant-message.md +1 -1
- package/dist/mcp/generated/docs/chat-container.md +3 -1
- package/dist/mcp/generated/docs/chat-input.md +1 -0
- package/dist/mcp/generated/docs/cite-content.md +6 -2
- package/dist/mcp/generated/docs/common-error-content.md +8 -2
- package/dist/mcp/generated/docs/delete-tool.md +6 -1
- package/dist/mcp/generated/docs/desc-panel.md +5 -1
- package/dist/mcp/generated/docs/detail-section.md +3 -1
- package/dist/mcp/generated/docs/execution-summary.md +23 -1
- package/dist/mcp/generated/docs/file-content.md +8 -2
- package/dist/mcp/generated/docs/file-upload-btn.md +3 -1
- package/dist/mcp/generated/docs/flow-agent-content.md +40 -26
- package/dist/mcp/generated/docs/flow-agent-node-detail.md +5 -2
- package/dist/mcp/generated/docs/highlight-keyword.md +9 -31
- package/dist/mcp/generated/docs/input-attachment.md +3 -0
- package/dist/mcp/generated/docs/input-info-alert.md +3 -0
- package/dist/mcp/generated/docs/interrupt-message.md +6 -1
- package/dist/mcp/generated/docs/key-value-content.md +6 -1
- package/dist/mcp/generated/docs/knowledge-rag-content.md +4 -1
- package/dist/mcp/generated/docs/markdown-container.md +3 -0
- package/dist/mcp/generated/docs/markdown-content.md +2 -2
- package/dist/mcp/generated/docs/mention-tag.md +2 -0
- package/dist/mcp/generated/docs/mention-text.md +3 -0
- package/dist/mcp/generated/docs/message-container.md +4 -4
- package/dist/mcp/generated/docs/preview-toolbar.md +4 -0
- package/dist/mcp/generated/docs/reference-content.md +6 -1
- package/dist/mcp/generated/docs/reference-doc-content.md +3 -1
- package/dist/mcp/generated/docs/simple-table.md +3 -1
- package/dist/mcp/generated/docs/text-content.md +5 -1
- package/dist/mcp/generated/docs/tool-btn.md +10 -4
- package/dist/mcp/generated/docs/toolcall-render.md +8 -8
- package/dist/mcp/generated/docs/use-animation-text.md +2 -1
- package/dist/mcp/generated/docs/use-artifact-preview.md +11 -1
- package/dist/mcp/generated/docs/use-flow-node-actions.md +20 -10
- package/dist/mcp/generated/docs/user-question-card.md +31 -0
- package/dist/mcp/generated/docs/vnode-renderer.md +3 -3
- package/dist/mcp/generated/index.json +93 -100
- package/dist/mcp/index.js +0 -0
- package/dist/mcp/tools/list-components.js +1 -0
- package/dist/mcp/tools/list-components.js.map +1 -1
- package/dist/mcp/utils/doc-loader.d.ts +1 -0
- package/dist/mcp/utils/doc-loader.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/package.json +22 -21
- package/skills/blueking-chat-x/references/components/activity-message.md +15 -13
- package/skills/blueking-chat-x/references/components/ai-selection.md +1 -1
- package/skills/blueking-chat-x/references/components/flow-agent-content.md +14 -10
- package/dist/mcp/generated/docs/questions-container.md +0 -88
- package/dist/mcp/generated/docs/selection-question.md +0 -91
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
# FlowAgentContent FlowAgent 执行内容
|
|
15
15
|
|
|
16
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
17
|
+
> 业务请通过 [MessageRender](/components/message/message-render) 渲染 `role: 'activity'`(见本页「推荐入口」)。
|
|
18
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { FlowAgentContent } from '@blueking/chat-x'`。
|
|
19
|
+
|
|
16
20
|
> **能力域**:Agent 能力
|
|
17
21
|
|
|
18
22
|
渲染 FlowAgent(标准运维 / 流程编排)执行过程的活动组件,以「任务 → 节点」两级结构展示执行状态、耗时统计与详情入口。组件内部消费 `useCustomTabConsumer`,点击节点「详情」会向侧栏的自定义 Tab 注入 `FlowAgentNodeDetail` 渲染节点输入输出。
|
|
@@ -26,25 +30,29 @@
|
|
|
26
30
|
|
|
27
31
|
## 核心能力
|
|
28
32
|
|
|
29
|
-
- **状态聚合统计**:汇总所有任务的 `statistics.state_counts`,在标题栏按「执行中 / 成功 / 失败 / 挂起 /
|
|
33
|
+
- **状态聚合统计**:汇总所有任务的 `statistics.state_counts`,在标题栏按「执行中 / 成功 / 失败 / 挂起 / 已终止 / 待执行 / 跳过」分类展示带颜色的计数(超过 99 显示 `99+`)
|
|
34
|
+
- **已终止整体覆盖**:任一任务 `task_state === REVOKED` 时,标题栏在统计前展示橙红色「已终止」,并用括号包裹统计:`执行情况:已终止(…)`;任务行使用终止图标,叶子节点使用已终止圆点(`#F55B0E` 描边 / `#FEE8DD` 浅底)
|
|
30
35
|
- **两级折叠**:任务整体由 `ActivityLayout` 折叠;每个任务节点列表可单独展开/收起
|
|
31
36
|
- **耗时格式化**:节点耗时与任务总耗时按 `d/h/m/s` 紧凑展示,小于 1 秒显示 `<1s`
|
|
32
37
|
- **节点行尾操作**:hover 失败节点行显示「重试 / 跳过 / 详情」按钮组(间距 12px);成功 / 运行中等非失败节点仅显示「详情」。重试 / 跳过依赖节点 `retryable` / `skippable` 能力位,通过 `onInterruptResume` 回传 Agent
|
|
33
38
|
- **重试 / 跳过进行中态**:点击后节点行进入 `is-pending`,按钮组常驻显示(无需 hover);进行中按钮切换为 loading +「重试中 / 跳过中」,重试与跳过互斥禁用;被阻塞按钮 hover 显示提示(如「任务正在重试中,不可跳过」);详情不受影响。pending 以 `task_id:node_id:retry` 为键,后端 `retry` 计数变化后自动失效
|
|
34
39
|
- **详情入口联动**:「详情」按钮点击后通过自定义 Tab 挂载 `FlowAgentNodeDetail`
|
|
35
40
|
- **分享态只读查看**:`RenderMode.Share` 下保留耗时、「详情」「有效证据」等只读查看入口,仅隐藏「重试 / 跳过」等交互式 resume 操作
|
|
41
|
+
- **侧栏执行情况面板只读**:侧栏「执行情况」Tab 内经 `ExecutionSummary` 渲染的同一组件同样只保留「详情」,不展示「重试 / 跳过」;面板身份由 `ExecutionSummary` 通过 `EXECUTION_PANEL_TOKEN` 提供,组件以 `useExecutionPanelInject` 读取。因此重试 / 跳过只出现在对话流内的执行情况
|
|
36
42
|
|
|
37
43
|
## 状态映射
|
|
38
44
|
|
|
39
|
-
组件将后端原始 `state` / `task_state`
|
|
45
|
+
组件将后端原始 `state` / `task_state` 归一为收敛状态(`getConvergedState`),用于图标、颜色与统计分类。配置源为 `STATE_DEFS`:
|
|
40
46
|
|
|
41
|
-
| 收敛状态
|
|
42
|
-
|
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
47
|
+
| 收敛状态 | 颜色 | 原始状态 | 统计 | 整体 header |
|
|
48
|
+
| ------------- | ----------- | --------------------------------------------------------------------------------- | ---- | ----------- |
|
|
49
|
+
| `running` | `#3A84FF` | `CREATED`、`LOOP_READY`、`READY`、`RUNNING`、`BLOCKED`、`ROLLING_BACK`、`ROLL_BACK_SUCCESS` 及未知状态(兜底) | 是 | 否 |
|
|
50
|
+
| `success` | `#65C389` | `FINISHED` | 是 | 否 |
|
|
51
|
+
| `failed` | `#EA3636` | `FAILED`、`ROLL_BACK_FAILED` | 是 | 否 |
|
|
52
|
+
| `suspended` | `#F59500` | `SUSPENDED` | 是 | 否 |
|
|
53
|
+
| `terminated` | `#F55B0E` | `REVOKED` | 是 | 是 |
|
|
54
|
+
| `pending` | `#4D4F56` | `PENDING` | 是 | 否 |
|
|
55
|
+
| `skipped` | `#5B7290` | `SKIPPED` | 是 | 否 |
|
|
48
56
|
|
|
49
57
|
## 基础用法
|
|
50
58
|
|
|
@@ -61,8 +69,8 @@
|
|
|
61
69
|
</template>
|
|
62
70
|
|
|
63
71
|
<script setup lang="ts">
|
|
64
|
-
import { FlowAgentContent } from '@blueking/chat-x';
|
|
65
72
|
import type { BkFlowMessageContent, OnInterruptResume } from '@blueking/chat-x';
|
|
73
|
+
// FlowAgentContent 未从包入口导出;文档站 demo 使用相对路径 FlowAgentContentComp
|
|
66
74
|
|
|
67
75
|
const messageUid = 'flow-msg-1';
|
|
68
76
|
const status = 'success';
|
|
@@ -94,7 +102,7 @@
|
|
|
94
102
|
|
|
95
103
|
## 失败节点重试 / 跳过
|
|
96
104
|
|
|
97
|
-
失败节点(`convergedState === 'failed'
|
|
105
|
+
失败节点(`convergedState === 'failed'`)且具备对应能力位时,在**对话流内**的执行情况 hover 行尾展示「重试」或「跳过」按钮(侧栏「执行情况」面板与 Share 分享态不展示,见下方显隐条件)。点击后:
|
|
98
106
|
|
|
99
107
|
1. 节点行添加 `is-pending` class,按钮组常驻显示(设计稿:鼠标移出后仍可见进行中反馈)
|
|
100
108
|
2. 被点击按钮进入 loading +「重试中 / 跳过中」,重试与跳过均禁用(`is-disabled`,置灰色 `#c4c6cc`)
|
|
@@ -125,11 +133,11 @@ onInterruptResume?.({
|
|
|
125
133
|
|
|
126
134
|
| 按钮 | 显隐条件 | 进行中表现 | `operation` |
|
|
127
135
|
| ---- | ------------------------------------- | ---------------------------------- | ---------------------- |
|
|
128
|
-
| 重试 | 失败态且 `node.retryable === true
|
|
129
|
-
| 跳过 | 失败态且 `node.skippable === true
|
|
130
|
-
| 详情 | 始终展示(含 Share
|
|
136
|
+
| 重试 | 失败态且 `node.retryable === true`;且不在 Share 分享态、不在侧栏「执行情况」面板内 | loading +「重试中」,二者均禁用 | `flow_node_retry` |
|
|
137
|
+
| 跳过 | 失败态且 `node.skippable === true`;且不在 Share 分享态、不在侧栏「执行情况」面板内 | loading +「跳过中」,二者均禁用 | `flow_node_skip` |
|
|
138
|
+
| 详情 | 始终展示(含 Share 分享态与侧栏面板) | 不受 pending 影响 | —(打开侧栏 Tab,不走 resume) |
|
|
131
139
|
|
|
132
|
-
行尾操作由内部 composable [`useFlowNodeActions`](/composables/use-flow-node-actions)
|
|
140
|
+
行尾操作由内部 composable [`useFlowNodeActions`](/composables/use-flow-node-actions) 聚合为声明式列表,组件层仅遍历渲染;两类只读场景合并为它的 `hideResumeActions` 入参。
|
|
133
141
|
|
|
134
142
|
## 节点详情联动
|
|
135
143
|
|
|
@@ -140,7 +148,7 @@ addCustomTab?.({
|
|
|
140
148
|
label: node.name,
|
|
141
149
|
name: `${task.task_id}|${node.id}|${node.name}`,
|
|
142
150
|
data: {
|
|
143
|
-
component:
|
|
151
|
+
component: FlowAgentNodeDetail,
|
|
144
152
|
messageUid: props.messageUid,
|
|
145
153
|
props: {
|
|
146
154
|
loading: true,
|
|
@@ -162,7 +170,8 @@ addCustomTab?.({
|
|
|
162
170
|
ActivityLayout(activity-type=flow_agent,v-model:collapsed)
|
|
163
171
|
├── #title(执行情况统计栏)
|
|
164
172
|
│ ├── AiLoading / ArrowRightIcon(加载态 / 折叠箭头)
|
|
165
|
-
│
|
|
173
|
+
│ ├── flow-agent-flow-header(任一任务 REVOKED 时展示「已终止」)
|
|
174
|
+
│ └── flow-agent-stat-item × N(按收敛状态分类的计数,含 terminated)
|
|
166
175
|
└── flow-agent-task-group × N(任务)
|
|
167
176
|
├── flow-agent-task-header(点击折叠当前任务)
|
|
168
177
|
│ ├── task-arrow(任务展开箭头)
|
|
@@ -176,9 +185,9 @@ ActivityLayout(activity-type=flow_agent,v-model:collapsed)
|
|
|
176
185
|
└── node-trailing(含 Share 分享态)
|
|
177
186
|
├── node-time(节点耗时,hover / pending 时隐藏)
|
|
178
187
|
└── node-actions(hover 或 `is-pending` 时显示,间距 12px)
|
|
179
|
-
├── node-action-btn「重试」(失败 + retryable;Share
|
|
180
|
-
├── node-action-btn「跳过」(失败 + skippable;Share
|
|
181
|
-
└── node-action-btn「详情」(始终可用,含 Share
|
|
188
|
+
├── node-action-btn「重试」(失败 + retryable;Share 态与侧栏面板隐藏;进行中 loading + 禁用)
|
|
189
|
+
├── node-action-btn「跳过」(失败 + skippable;Share 态与侧栏面板隐藏;进行中 loading + 禁用)
|
|
190
|
+
└── node-action-btn「详情」(始终可用,含 Share 态与侧栏面板,点击挂载详情 Tab)
|
|
182
191
|
```
|
|
183
192
|
|
|
184
193
|
## API
|
|
@@ -187,14 +196,17 @@ ActivityLayout(activity-type=flow_agent,v-model:collapsed)
|
|
|
187
196
|
|
|
188
197
|
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
189
198
|
| ---------- | ------------------------ | ---- | ----------- | -------------------------------------------------------------------------- |
|
|
190
|
-
| content | `BkFlowMessageContent` | 否 |
|
|
199
|
+
| content | `BkFlowMessageContent` | 否 | — | 任务数组;传入单个 `BkFlowTask` 时自动包装为单元素数组 |
|
|
200
|
+
| collapsed | `boolean` | 否 | `false` | `v-model:collapsed`,控制活动布局折叠 |
|
|
191
201
|
| messageUid | `string` | 否 | — | 所属消息唯一标识,注入到节点详情 Tab 的 `data.messageUid`,用于异步回填数据 |
|
|
192
202
|
| onInterruptResume | `OnInterruptResume` | 否 | — | 节点「重试 / 跳过」与第三方审批取消复用同一回调,按 `payload.operation` 分流;流程节点操作时不传 `interrupt` |
|
|
193
203
|
| status | `MessageStatus` | 否 | — | 消息状态;`pending` / `streaming` 时标题栏显示加载动画 |
|
|
194
204
|
|
|
195
205
|
### Emits
|
|
196
206
|
|
|
197
|
-
|
|
207
|
+
| 事件名 | 说明 |
|
|
208
|
+
| --- | --- |
|
|
209
|
+
| `update:collapsed` | `v-model:collapsed` 回写 |
|
|
198
210
|
|
|
199
211
|
### Slots
|
|
200
212
|
|
|
@@ -242,7 +254,7 @@ interface BkFlowNode {
|
|
|
242
254
|
|
|
243
255
|
- `AiLoading` — 标题栏流式加载动画
|
|
244
256
|
- `ActivityLayout` — 可折叠活动容器外壳
|
|
245
|
-
- `
|
|
257
|
+
- `FlowAgentNodeDetail` — 节点详情面板(经自定义 Tab 挂载)
|
|
246
258
|
- `Loading`(bkui-vue) — 运行中状态的旋转指示
|
|
247
259
|
- `HighlightKeyword` — 任务 / 节点名称的搜索关键词高亮
|
|
248
260
|
|
|
@@ -253,9 +265,11 @@ interface BkFlowNode {
|
|
|
253
265
|
3. **任务总耗时为节点累加**:`task-time` 由各节点 `elapsed_time` 求和得到,并非任务级独立字段。
|
|
254
266
|
4. **`task_outputs` 暂不渲染**:模板中任务输出展示区块已注释,传入也不会显示。
|
|
255
267
|
5. **未知状态兜底为 `running`**:`getConvergedState` 对未识别的原始状态统一归为运行中。
|
|
256
|
-
6.
|
|
257
|
-
7.
|
|
258
|
-
8.
|
|
268
|
+
6. **已终止整体覆盖**:判定只看任务 `task_state`(不扫节点);叶子节点 `state === REVOKED` 使用已终止圆点;`REVOKED` 计入标题栏 / tooltip 统计,与叶子节点同色 `#F55B0E`。
|
|
269
|
+
7. **Share 模式只读查看**:`RenderMode.Share` 下保留节点/任务耗时与「详情」「有效证据」查看入口,仅过滤「重试 / 跳过」等交互式 resume 操作(由 `useFlowNodeActions` 的 `hideResumeActions` 收敛)。
|
|
270
|
+
8. **侧栏「执行情况」面板同为只读**:面板内经 `ExecutionSummary` → `MessageRender` 渲染的本组件不展示「重试 / 跳过」,只保留「详情」;判定来自 `useExecutionPanelInject()`(内部上下文,未从包入口导出;缺省 `false`),与 Share 态一起并入 `hideResumeActions`。因此脱离 `ExecutionSummary` 独立使用组件时,行为与对话流内一致。
|
|
271
|
+
9. **`onInterruptResume` 透传链路**:`MessageRender` → `ActivityMessage` → `FlowAgentContent`;未传入时重试 / 跳过按钮仍展示但点击无回调。
|
|
272
|
+
10. **pending 自动收敛**:`useFlowNodeActions` 以 `task_id:node_id:retry` 为 pending 键;节点重试再次失败(`retry` +1)后键变化,进行中态自动解除,无需手动清理。
|
|
259
273
|
|
|
260
274
|
## 关联组件
|
|
261
275
|
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
# FlowAgentNodeDetail FlowAgent 节点详情
|
|
16
16
|
|
|
17
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
18
|
+
> 由 [FlowAgentContent](/components/agent/flow-agent-content) 挂到自定义 Tab。
|
|
19
|
+
|
|
17
20
|
> **能力域**:Agent 能力
|
|
18
21
|
|
|
19
22
|
`FlowAgentNodeDetail` 用于展示 FlowAgent 单个节点的配置与输出详情。它通常被 `FlowAgentContent` 通过自定义 Tab 挂载到侧栏,应用层再根据 `messageUid`、`task_id`、`node_id` 拉取真实节点详情并回填到 `data`。
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
</template>
|
|
54
57
|
|
|
55
58
|
<script setup lang="ts">
|
|
56
|
-
|
|
59
|
+
// FlowAgentNodeDetail 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
57
60
|
import type { NodeDetailData } from '@blueking/chat-x';
|
|
58
61
|
|
|
59
62
|
const nodeDetailData: Partial<NodeDetailData> = {
|
|
@@ -127,7 +130,7 @@ addCustomTab?.({
|
|
|
127
130
|
label: node.name,
|
|
128
131
|
name: `${task.task_id}|${node.id}|${node.name}`,
|
|
129
132
|
data: {
|
|
130
|
-
component:
|
|
133
|
+
component: FlowAgentNodeDetail,
|
|
131
134
|
messageUid: props.messageUid,
|
|
132
135
|
props: {
|
|
133
136
|
loading: true,
|
|
@@ -74,42 +74,20 @@ ExecutionSummary
|
|
|
74
74
|
└── HighlightKeyword(:text) ← inject(keyword)
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
## 配套 Composables
|
|
77
|
+
## 配套 Composables(内部,未从包入口导出)
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
`useKeywordProvider` / `useKeywordInject` / `useKeywordMatch` 在 `src/composables/use-common.ts`,**不能** `from '@blueking/chat-x'`。业务侧把 `HighlightKeyword` 放在 [ChatContainer](/components/setup/chat-container) / [ExecutionSummary](/components/agent/execution-summary) 子树即可,库已注入关键词。
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
库内或文档站高级用法用相对路径:
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
|
-
import { useKeywordProvider } from '
|
|
84
|
+
import { useKeywordProvider, useKeywordInject, useKeywordMatch } from '../../../src/composables/use-common';
|
|
85
85
|
|
|
86
86
|
const { keyword } = useKeywordProvider();
|
|
87
87
|
keyword.value = '搜索词';
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### useKeywordInject
|
|
91
|
-
|
|
92
|
-
在后代组件中注入关键词,返回 `ComputedRef<string> | undefined`:
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
import { useKeywordInject } from '@blueking/chat-x';
|
|
96
|
-
|
|
97
|
-
const keyword = useKeywordInject();
|
|
98
|
-
console.log(keyword?.value); // 当前搜索关键词
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### useKeywordMatch
|
|
102
|
-
|
|
103
|
-
用于判断组件的可搜索文本是否与当前关键词匹配。内部调用 `useKeywordInject` 获取关键词,根据传入的文本提取函数判断是否命中:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import { useKeywordMatch } from '@blueking/chat-x';
|
|
107
88
|
|
|
89
|
+
const injected = useKeywordInject();
|
|
108
90
|
const { keywordMatched } = useKeywordMatch(() => [props.title, props.description, props.content]);
|
|
109
|
-
|
|
110
|
-
// keywordMatched.value === true 表示命中搜索
|
|
111
|
-
// keywordMatched.value === false 表示未命中(可据此隐藏组件)
|
|
112
|
-
// keyword 为空时始终返回 true
|
|
113
91
|
```
|
|
114
92
|
|
|
115
93
|
`useKeywordMatch` 的典型用途是在 `ExecutionSummary` 的搜索过滤中,让组件自行判断是否匹配搜索词,与 `HighlightKeyword` 配合实现搜索 + 高亮。
|
|
@@ -132,9 +110,9 @@ const { keywordMatched } = useKeywordMatch(() => [props.title, props.description
|
|
|
132
110
|
|
|
133
111
|
| 函数名 | 参数 | 返回值 | 说明 |
|
|
134
112
|
| -------------------- | ----------------------------------------------- | ------------------------------------------ | --------------------------------------------- |
|
|
135
|
-
| `useKeywordProvider` | — | `{ keyword: ShallowRef<string> }` |
|
|
136
|
-
| `useKeywordInject` | — | `ComputedRef<string> \| undefined` |
|
|
137
|
-
| `useKeywordMatch` | `getSearchTexts: () => (string \| undefined)[]` | `{ keywordMatched: ComputedRef<boolean> }` |
|
|
113
|
+
| `useKeywordProvider` | — | `{ keyword: ShallowRef<string> }` | 内部 API,见 `src/composables/use-common.ts` |
|
|
114
|
+
| `useKeywordInject` | — | `ComputedRef<string> \| undefined` | 内部 API,见 `src/composables/use-common.ts` |
|
|
115
|
+
| `useKeywordMatch` | `getSearchTexts: () => (string \| undefined)[]` | `{ keywordMatched: ComputedRef<boolean> }` | 内部 API;空关键词返回 true |
|
|
138
116
|
|
|
139
117
|
### CSS 类名
|
|
140
118
|
|
|
@@ -144,6 +122,6 @@ const { keywordMatched } = useKeywordMatch(() => [props.title, props.description
|
|
|
144
122
|
|
|
145
123
|
## 关联组件
|
|
146
124
|
|
|
147
|
-
- [
|
|
125
|
+
- [ToolCallRender](/components/agent/toolcall-render) — 工具调用头部高亮
|
|
148
126
|
- [DescPanel](/components/rendering/desc-panel) — 详情面板键值高亮
|
|
149
127
|
- [ExecutionSummary](/components/agent/execution-summary) — 执行摘要搜索
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
---
|
|
13
13
|
<!-- FULL DOC -->
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# InterruptMessageRender 中断消息
|
|
16
|
+
|
|
17
|
+
| 名称 | 种类 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `InterruptMessage` | TS 消息类型 |
|
|
20
|
+
| `InterruptMessageRender` | 包入口 Vue 组件 |
|
|
16
21
|
## 源码事实
|
|
17
22
|
|
|
18
23
|
- **源码位置**:`src/components/chat-message/interrupt-message/interrupt-message.vue`
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
<!-- FULL DOC -->
|
|
11
11
|
|
|
12
12
|
# KeyValueContent 键值对内容
|
|
13
|
+
|
|
14
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
15
|
+
> 业务请通过 [UserMessage](/components/message/user-message) / [MessageRender](/components/message/message-render) 使用。
|
|
16
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { KeyValueContent } from '@blueking/chat-x'`。
|
|
17
|
+
|
|
13
18
|
## 源码事实
|
|
14
19
|
|
|
15
20
|
- **源码位置**:`src/components/chat-content/key-value-content/key-value-content.vue`
|
|
@@ -48,7 +53,7 @@ div.ai-key-value-content(flex column,gap: 8px,font-size: 12px,color: #4d
|
|
|
48
53
|
</template>
|
|
49
54
|
|
|
50
55
|
<script setup lang="ts">
|
|
51
|
-
|
|
56
|
+
// KeyValueContent 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
52
57
|
|
|
53
58
|
const data = [
|
|
54
59
|
{ key: '名称', value: '蓝鲸智云' },
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
# KnowledgeRagContent 知识召回内容
|
|
16
16
|
|
|
17
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
18
|
+
> 业务请通过 [MessageRender](/components/message/message-render) 渲染 `role: 'activity'`。
|
|
19
|
+
|
|
17
20
|
> **能力域**:Agent 能力
|
|
18
21
|
|
|
19
22
|
`KnowledgeRagContent` 用于渲染知识召回活动内容,包含活动标题、加载态、Markdown 摘要和引用来源列表。它是 `ActivityMessage` 在 `activityType === 'knowledge_rag'` 时使用的具体内容组件。
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
|
|
47
50
|
<script setup lang="ts">
|
|
48
51
|
import { ref } from 'vue';
|
|
49
|
-
|
|
52
|
+
// KnowledgeRagContent 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
50
53
|
import type { KnowledgeRagMessageContent } from '@blueking/chat-x';
|
|
51
54
|
|
|
52
55
|
const collapsed = ref(false);
|
|
@@ -11,6 +11,9 @@ markdownItContainer 基于 markdown-it-container,支持字符串或正则匹
|
|
|
11
11
|
|
|
12
12
|
# markdownItContainer 自定义容器插件
|
|
13
13
|
|
|
14
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
15
|
+
> 由 [MarkdownContent](/components/rendering/markdown-content) 内部注册。请用相对路径引入源码,不要写 `import { markdownItContainer } from '@blueking/chat-x'`。
|
|
16
|
+
|
|
14
17
|
> **分类**:plugin
|
|
15
18
|
|
|
16
19
|
将 `::: 容器名` 开头的块解析为带 `class` 的块级容器,闭合行使用 `:::`。
|
|
@@ -28,7 +28,7 @@ AI 消息内容渲染的核心基础组件,集成代码高亮、LaTeX 公式
|
|
|
28
28
|
## 组件结构与渲染流程
|
|
29
29
|
|
|
30
30
|
```
|
|
31
|
-
props.content → completeMarkdownSyntax → md.parse → groupTokens → groupedTokens
|
|
31
|
+
props.content → completeMarkdownSyntax().content → md.parse → groupTokens → groupedTokens
|
|
32
32
|
│
|
|
33
33
|
div.ai-markdown-content(contain: layout style)
|
|
34
34
|
│
|
|
@@ -148,7 +148,7 @@ props.content → completeMarkdownSyntax → md.parse → groupTokens → groupe
|
|
|
148
148
|
| 机制 | 实现 | 作用 |
|
|
149
149
|
| ----------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
150
150
|
| 极速节流 | `parseMarkdownContent` throttle **5ms**,leading + trailing | 每 5ms 最多解析一次,兼顾实时性与性能 |
|
|
151
|
-
| Markdown 语法补全 | `completeMarkdownSyntax(content)`
|
|
151
|
+
| Markdown 语法补全 | `completeMarkdownSyntax(content).content` | 自动闭合代码块、行内代码、粗斜体、删除线、链接等未完成语法 |
|
|
152
152
|
| LaTeX 防闪烁 | `isIncomplete=true` 且已有渲染结果 → **跳过本次更新** | 正在输入 LaTeX 命令时保持上一帧,避免闪白 |
|
|
153
153
|
| 子组件 throttle | `handleTokenMounted` throttle 100ms | 限制子组件挂载后触发的滚动到底部频率 |
|
|
154
154
|
| CSS contain | `.ai-markdown-content { contain: layout style }`<br>`.ai-markdown-body { contain: content }` | 限制重排/重绘范围,减少流式渲染的布局开销 |
|
|
@@ -13,6 +13,9 @@ MentionText 接收一份 TagSchema 文档(二维数组:行 → 节点),
|
|
|
13
13
|
|
|
14
14
|
# MentionText 标签文本
|
|
15
15
|
|
|
16
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
17
|
+
> 业务请通过 [UserMessage](/components/message/user-message) / [MessageRender](/components/message/message-render) 使用。
|
|
18
|
+
|
|
16
19
|
> **能力域**:内容渲染
|
|
17
20
|
|
|
18
21
|
## 源码事实
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
负责按传入的 `messageGroups` 渲染、滚动控制、工具栏和消息插槽透传。 源码位置:src/components/chat-message/message-container/message-container.vue。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-render** — 按组渲染每条消息时委托 MessageRender
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
- **源码位置**:`src/components/chat-message/message-container/message-container.vue`
|
|
19
19
|
- **能力域**:对话搭建
|
|
20
|
-
-
|
|
20
|
+
- **能力说明**:负责按传入的 `messageGroups` 渲染、滚动控制、工具栏和消息插槽透传。
|
|
21
21
|
|
|
22
22
|
> **能力域**:对话搭建
|
|
23
23
|
|
|
@@ -564,7 +564,7 @@ AI 回复状态为 `error` 时,消息以错误样式展示:
|
|
|
564
564
|
| 属性名 | 类型 | 默认值 | 说明 |
|
|
565
565
|
| ------------------------ | -------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
566
566
|
| messages | `Message[]` | — | **必填**,消息列表 |
|
|
567
|
-
| messageGroups | `MessageGroup[]` | — |
|
|
567
|
+
| messageGroups | `MessageGroup[]` | — | **必填**。本组件不分组;由调用方用 `useMessageGroup` 算好后传入。`ChatContainer` 会代为计算。 |
|
|
568
568
|
| messageStatus | `MessageStatus` | — | 当前整体消息状态,控制底部「停止生成」按钮显示;`ChatContainer` 会结合末尾 Loading 占位推导 `fetching` 等再传入 |
|
|
569
569
|
| messageTools | `IToolBtn[]` | — | AI 消息左侧工具(复制/引用等)的自定义配置;按 `id` 与内置 `CONST_MESSAGE_TOOLS` 合并(覆盖同 id、追加新 id、`hidden` 过滤),详见「自定义消息工具栏」 |
|
|
570
570
|
| updateTools | `IToolBtn[]` | — | AI 消息右侧反馈工具(点赞/踩/删除等)的自定义配置;按 `id` 与内置 `CONST_UPDATE_TOOLS` 合并,规则同上 |
|
|
@@ -605,7 +605,7 @@ AI 回复状态为 `error` 时,消息以错误样式展示:
|
|
|
605
605
|
```typescript
|
|
606
606
|
import { MessageRole, MessageStatus, MessageToolsStatus, type Message, type MessageGroup, type IToolBtn } from '@blueking/chat-x';
|
|
607
607
|
|
|
608
|
-
//
|
|
608
|
+
// 消息组(必须传入 useMessageGroup 的结果)
|
|
609
609
|
interface MessageGroup {
|
|
610
610
|
checked: boolean;
|
|
611
611
|
isHover: boolean;
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
# PreviewToolbar 图片预览工具栏
|
|
10
10
|
|
|
11
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
12
|
+
> 业务请通过 [ImagePreview](/components/medias/image-preview) 使用。
|
|
13
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { PreviewToolbar } from '@blueking/chat-x'`。
|
|
14
|
+
|
|
11
15
|
> **能力域**:媒体文件
|
|
12
16
|
|
|
13
17
|
## 源码事实
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
<!-- FULL DOC -->
|
|
12
12
|
|
|
13
13
|
# ReferenceContent 引用文档内容
|
|
14
|
+
|
|
15
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
16
|
+
> 业务请通过 [ContentRender](/components/rendering/content-render) / [ActivityMessage](/components/message/activity-message) 使用。
|
|
17
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { ReferenceContent } from '@blueking/chat-x'`。
|
|
18
|
+
|
|
14
19
|
## 源码事实
|
|
15
20
|
|
|
16
21
|
- **源码位置**:`src/components/chat-content/reference-content/reference-content.vue`
|
|
@@ -68,8 +73,8 @@ gotoLink(url, event):
|
|
|
68
73
|
</template>
|
|
69
74
|
|
|
70
75
|
<script setup lang="ts">
|
|
71
|
-
import { ReferenceContent } from '@blueking/chat-x';
|
|
72
76
|
import type { ReferenceDocumentContent } from '@blueking/chat-x';
|
|
77
|
+
// ReferenceContent 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
73
78
|
|
|
74
79
|
const references: ReferenceDocumentContent[] = [
|
|
75
80
|
{ name: '蓝鲸 PaaS 平台文档', url: 'https://bk.tencent.com', originFile: '' },
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
# ReferenceDocContent 引用文档活动
|
|
15
15
|
|
|
16
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
17
|
+
|
|
16
18
|
> **能力域**:Agent 能力
|
|
17
19
|
|
|
18
20
|
`ReferenceDocContent` 用于渲染“引用 N 篇资料作为参考”这类活动消息。组件基于 `ActivityLayout` 提供折叠外壳,并将文档数组交给 `ReferenceContent` 展示。
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
|
|
44
46
|
<script setup lang="ts">
|
|
45
47
|
import { ref } from 'vue';
|
|
46
|
-
|
|
48
|
+
// ReferenceDocContent 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
47
49
|
import type { ReferenceDocumentContent } from '@blueking/chat-x';
|
|
48
50
|
|
|
49
51
|
const collapsed = ref(false);
|
|
@@ -12,6 +12,8 @@ FlowAgent 节点详情中的轻量表格展示组件。 源码位置:src/compo
|
|
|
12
12
|
|
|
13
13
|
# SimpleTable 简易表格
|
|
14
14
|
|
|
15
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
16
|
+
|
|
15
17
|
> **能力域**:Agent 能力
|
|
16
18
|
|
|
17
19
|
`SimpleTable` 是 FlowAgent 节点详情中的轻量只读表格,用于展示参数名、参数值、插件输出定义等结构化信息。组件只根据 `columns` 和 `data` 渲染表格,不提供排序、筛选、分页或编辑能力。
|
|
@@ -41,7 +43,7 @@ FlowAgent 节点详情中的轻量表格展示组件。 源码位置:src/compo
|
|
|
41
43
|
</template>
|
|
42
44
|
|
|
43
45
|
<script setup lang="ts">
|
|
44
|
-
|
|
46
|
+
// SimpleTable 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
45
47
|
|
|
46
48
|
const columns = [
|
|
47
49
|
{ key: 'key', label: '参数名' },
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
<!-- FULL DOC -->
|
|
13
13
|
|
|
14
14
|
# TextContent 文本内容
|
|
15
|
+
|
|
16
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
17
|
+
> 业务请通过 [ContentRender](/components/rendering/content-render) / [MessageRender](/components/message/message-render) 使用。
|
|
18
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { TextContent } from '@blueking/chat-x'`。
|
|
15
19
|
## 源码事实
|
|
16
20
|
|
|
17
21
|
- **源码位置**:`src/components/chat-content/text-content/text-content.vue`
|
|
@@ -45,7 +49,7 @@ div.ai-text-content
|
|
|
45
49
|
</template>
|
|
46
50
|
|
|
47
51
|
<script setup lang="ts">
|
|
48
|
-
|
|
52
|
+
// TextContent 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
49
53
|
</script>
|
|
50
54
|
```
|
|
51
55
|
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
<!-- FULL DOC -->
|
|
12
12
|
|
|
13
13
|
# ToolBtn 工具按钮
|
|
14
|
+
|
|
15
|
+
> **导出状态**:内部实现,未从 `@blueking/chat-x` 包入口导出。
|
|
16
|
+
> 业务请通过 [MessageTools](/components/feedback/message-tools) 使用。
|
|
17
|
+
> 文档站 demo 使用相对路径引入源码;不要写 `import { ToolBtn } from '@blueking/chat-x'`。
|
|
14
18
|
## 源码事实
|
|
15
19
|
|
|
16
20
|
- **源码位置**:`src/components/ai-buttons/tool-btn/tool-btn.vue`
|
|
@@ -117,7 +121,7 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
117
121
|
</template>
|
|
118
122
|
|
|
119
123
|
<script setup lang="ts">
|
|
120
|
-
|
|
124
|
+
// ToolBtn 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
121
125
|
import type { IToolBtn } from '@blueking/chat-x';
|
|
122
126
|
|
|
123
127
|
const handleClick = (data: IToolBtn & { active?: boolean; disabled?: boolean }, event: MouseEvent) => {
|
|
@@ -153,7 +157,7 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
153
157
|
|
|
154
158
|
<script setup lang="ts">
|
|
155
159
|
import { ref } from 'vue';
|
|
156
|
-
|
|
160
|
+
// ToolBtn 未从包入口导出;文档站 demo 使用页面顶部相对路径
|
|
157
161
|
import type { IToolBtn } from '@blueking/chat-x';
|
|
158
162
|
|
|
159
163
|
const activeId = ref<string | null>(null);
|
|
@@ -212,7 +216,8 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
212
216
|
</template>
|
|
213
217
|
|
|
214
218
|
<script setup lang="ts">
|
|
215
|
-
import {
|
|
219
|
+
import { DownloadIcon } from '@blueking/chat-x';
|
|
220
|
+
// ToolBtn 未从包入口导出
|
|
216
221
|
</script>
|
|
217
222
|
```
|
|
218
223
|
|
|
@@ -234,7 +239,8 @@ click 事件:disabled=true 时被 JS 拦截,不触发 emit
|
|
|
234
239
|
</template>
|
|
235
240
|
|
|
236
241
|
<script setup lang="ts">
|
|
237
|
-
import {
|
|
242
|
+
import { FullScreenIcon } from '@blueking/chat-x';
|
|
243
|
+
// ToolBtn 未从包入口导出
|
|
238
244
|
|
|
239
245
|
const handleFullScreen = () => {
|
|
240
246
|
// 进入全屏逻辑
|