@blueking/chat-x 0.0.50 → 0.0.51-beta.2
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 +2 -0
- package/dist/ag-ui/types/messages.d.ts +5 -0
- package/dist/common/constants.d.ts +1 -1
- package/dist/components/ai-buttons/file-upload-btn/file-upload-btn.vue.d.ts +0 -2
- package/dist/components/chat-content/file-content/file-content.vue.d.ts +5 -2
- package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +12 -0
- package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +21 -0
- package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +1 -1
- package/dist/components/chat-input/build-default-placeholder.d.ts +7 -0
- package/dist/components/chat-input/chat-input.vue.d.ts +1 -1
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -0
- package/dist/components/chat-message/message-render/message-render.vue.d.ts +2 -0
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +3 -1
- package/dist/components/index.d.ts +2 -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/use-custom-tab.d.ts +5 -3
- package/dist/composables/use-global-config.d.ts +3 -0
- package/dist/composables/use-message-group.d.ts +150 -72
- package/dist/icons/execution.d.ts +6 -0
- package/dist/icons/tools.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.js +3124 -2837
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +8 -7
- package/dist/mcp/generated/docs/ai-slash-input.md +2 -0
- package/dist/mcp/generated/docs/assistant-message.md +9 -7
- package/dist/mcp/generated/docs/chat-container.md +38 -32
- package/dist/mcp/generated/docs/chat-input.md +18 -12
- package/dist/mcp/generated/docs/cite-content.md +3 -3
- package/dist/mcp/generated/docs/desc-panel.md +32 -10
- package/dist/mcp/generated/docs/execution-summary.md +3 -3
- package/dist/mcp/generated/docs/file-artifact-panel.md +6 -4
- package/dist/mcp/generated/docs/file-content.md +89 -73
- package/dist/mcp/generated/docs/file-upload-btn.md +16 -18
- package/dist/mcp/generated/docs/message-container.md +3 -0
- package/dist/mcp/generated/docs/message-render.md +2 -1
- 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/toolcall-render.md +82 -43
- package/dist/mcp/generated/docs/use-artifact-preview.md +19 -17
- package/dist/mcp/generated/docs/use-custom-tab.md +12 -8
- package/dist/mcp/generated/docs/use-global-config.md +15 -5
- package/dist/mcp/generated/docs/user-message.md +9 -0
- package/dist/mcp/generated/docs/user-question-card.md +2 -0
- package/dist/mcp/generated/index.json +46 -6
- package/dist/types/input.d.ts +6 -0
- package/dist/utils/file.d.ts +7 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/merge-tools-by-id.d.ts +6 -0
- package/dist/utils/upload-file.d.ts +35 -0
- package/package.json +3 -2
- package/skills/blueking-chat-x/SKILL.md +139 -0
- package/skills/blueking-chat-x/references/_index.md +131 -0
- package/skills/blueking-chat-x/references/components/activity-layout.md +134 -0
- package/skills/blueking-chat-x/references/components/activity-message.md +486 -0
- package/skills/blueking-chat-x/references/components/ai-image.md +230 -0
- package/skills/blueking-chat-x/references/components/ai-loading.md +131 -0
- package/skills/blueking-chat-x/references/components/ai-prompt-list.md +44 -0
- package/skills/blueking-chat-x/references/components/ai-selection.md +439 -0
- package/skills/blueking-chat-x/references/components/ai-skill-list.md +73 -0
- package/skills/blueking-chat-x/references/components/ai-slash-editor.md +43 -0
- package/skills/blueking-chat-x/references/components/ai-slash-input.md +56 -0
- package/skills/blueking-chat-x/references/components/ai-slash-menu.md +42 -0
- package/skills/blueking-chat-x/references/components/animation-text.md +202 -0
- package/skills/blueking-chat-x/references/components/assistant-message.md +498 -0
- package/skills/blueking-chat-x/references/components/chat-container.md +869 -0
- package/skills/blueking-chat-x/references/components/chat-input.md +769 -0
- package/skills/blueking-chat-x/references/components/cite-content.md +142 -0
- package/skills/blueking-chat-x/references/components/code-content.md +211 -0
- package/skills/blueking-chat-x/references/components/common-error-content.md +73 -0
- package/skills/blueking-chat-x/references/components/content-render.md +233 -0
- package/skills/blueking-chat-x/references/components/delete-tool.md +191 -0
- package/skills/blueking-chat-x/references/components/desc-panel.md +162 -0
- package/skills/blueking-chat-x/references/components/detail-section.md +91 -0
- package/skills/blueking-chat-x/references/components/execution-summary.md +128 -0
- package/skills/blueking-chat-x/references/components/file-artifact-panel.md +289 -0
- package/skills/blueking-chat-x/references/components/file-content.md +319 -0
- package/skills/blueking-chat-x/references/components/file-icon.md +109 -0
- package/skills/blueking-chat-x/references/components/file-upload-btn.md +159 -0
- package/skills/blueking-chat-x/references/components/flow-agent-content.md +264 -0
- package/skills/blueking-chat-x/references/components/flow-agent-node-detail.md +236 -0
- package/skills/blueking-chat-x/references/components/highlight-keyword.md +146 -0
- package/skills/blueking-chat-x/references/components/image-content.md +182 -0
- package/skills/blueking-chat-x/references/components/image-preview-group.md +184 -0
- package/skills/blueking-chat-x/references/components/image-preview.md +226 -0
- package/skills/blueking-chat-x/references/components/info-message.md +144 -0
- package/skills/blueking-chat-x/references/components/input-attachment.md +49 -0
- package/skills/blueking-chat-x/references/components/input-info-alert.md +42 -0
- package/skills/blueking-chat-x/references/components/interrupt-message.md +212 -0
- package/skills/blueking-chat-x/references/components/key-value-content.md +128 -0
- package/skills/blueking-chat-x/references/components/knowledge-rag-content.md +122 -0
- package/skills/blueking-chat-x/references/components/latex-content.md +200 -0
- package/skills/blueking-chat-x/references/components/loading-message.md +192 -0
- package/skills/blueking-chat-x/references/components/markdown-content.md +232 -0
- package/skills/blueking-chat-x/references/components/mermaid-content.md +189 -0
- package/skills/blueking-chat-x/references/components/message-container.md +645 -0
- package/skills/blueking-chat-x/references/components/message-loading.md +118 -0
- package/skills/blueking-chat-x/references/components/message-render.md +327 -0
- package/skills/blueking-chat-x/references/components/message-time.md +177 -0
- package/skills/blueking-chat-x/references/components/message-tools.md +416 -0
- package/skills/blueking-chat-x/references/components/model-selector.md +155 -0
- package/skills/blueking-chat-x/references/components/preview-toolbar.md +42 -0
- package/skills/blueking-chat-x/references/components/questions-container.md +85 -0
- package/skills/blueking-chat-x/references/components/reasoning-message.md +232 -0
- package/skills/blueking-chat-x/references/components/reference-content.md +135 -0
- package/skills/blueking-chat-x/references/components/reference-doc-content.md +109 -0
- package/skills/blueking-chat-x/references/components/scroll-btn.md +159 -0
- package/skills/blueking-chat-x/references/components/selection-footer.md +78 -0
- package/skills/blueking-chat-x/references/components/selection-question.md +88 -0
- package/skills/blueking-chat-x/references/components/shortcut-btn.md +204 -0
- package/skills/blueking-chat-x/references/components/shortcut-btns.md +266 -0
- package/skills/blueking-chat-x/references/components/shortcut-render.md +424 -0
- package/skills/blueking-chat-x/references/components/simple-table.md +101 -0
- package/skills/blueking-chat-x/references/components/text-content.md +77 -0
- package/skills/blueking-chat-x/references/components/tool-approval-card.md +183 -0
- package/skills/blueking-chat-x/references/components/tool-btn.md +317 -0
- package/skills/blueking-chat-x/references/components/tool-message.md +235 -0
- package/skills/blueking-chat-x/references/components/toolcall-render.md +348 -0
- package/skills/blueking-chat-x/references/components/user-feedback.md +233 -0
- package/skills/blueking-chat-x/references/components/user-message.md +424 -0
- package/skills/blueking-chat-x/references/components/user-question-answered-card.md +104 -0
- package/skills/blueking-chat-x/references/components/user-question-card.md +231 -0
- package/skills/blueking-chat-x/references/components/user-question-choice.md +105 -0
- package/skills/blueking-chat-x/references/components/user-question-option.md +42 -0
- package/skills/blueking-chat-x/references/components/vnode-renderer.md +122 -0
- package/skills/blueking-chat-x/references/composables/use-animation-text.md +196 -0
- package/skills/blueking-chat-x/references/composables/use-artifact-preview.md +231 -0
- package/skills/blueking-chat-x/references/composables/use-clipboard.md +203 -0
- package/skills/blueking-chat-x/references/composables/use-command-selection.md +150 -0
- package/skills/blueking-chat-x/references/composables/use-container-scroll.md +57 -0
- package/skills/blueking-chat-x/references/composables/use-custom-tab.md +158 -0
- package/skills/blueking-chat-x/references/composables/use-flow-node-actions.md +157 -0
- package/skills/blueking-chat-x/references/composables/use-full-screen.md +112 -0
- package/skills/blueking-chat-x/references/composables/use-global-config.md +148 -0
- package/skills/blueking-chat-x/references/composables/use-menu-keydown.md +163 -0
- package/skills/blueking-chat-x/references/composables/use-message-group.md +247 -0
- package/skills/blueking-chat-x/references/composables/use-observer-visible-list.md +188 -0
- package/skills/blueking-chat-x/references/composables/use-parent-scrolling.md +46 -0
- package/skills/blueking-chat-x/references/theme/theme.md +431 -0
- package/skills/blueking-chat-x/references/types/constants.md +307 -0
- package/skills/blueking-chat-x/references/types/interrupt.md +379 -0
- package/skills/blueking-chat-x/references/types/messages.md +553 -0
- package/skills/blueking-chat-x/references/types/schema.md +91 -0
- package/skills/blueking-chat-x/scripts/generate-references.mjs +314 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# DeleteTool 删除确认按钮
|
|
2
|
+
|
|
3
|
+
> 能力域:工具与反馈 | 导入:`import { DeleteTool } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
消息删除二次确认工具。 源码位置:src/components/message-tools/delete-tool/delete-tool.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:tool-btn(删除图标与触发入口)、message-tools(delete 工具 id 时自动采用本组件)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# DeleteTool 删除确认按钮
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/message-tools/delete-tool/delete-tool.vue`
|
|
15
|
+
- **能力域**:工具与反馈
|
|
16
|
+
- **能力说明**:消息删除二次确认工具。
|
|
17
|
+
|
|
18
|
+
> **能力域**:工具与反馈
|
|
19
|
+
|
|
20
|
+
删除操作的二次确认组件。点击删除图标后弹出确认弹窗,用户需再次点击"删除"按钮才会触发 `confirm` 事件,防止误删。内部由 `ToolBtn`(触发按钮)+ `Tippy`(确认弹窗)组合实现。
|
|
21
|
+
|
|
22
|
+
> **提示**:此组件通常**不需要手动使用**,`MessageTools` 在工具列表中检测到 `id === 'delete'` 时会自动使用此组件替换普通 `ToolBtn`。
|
|
23
|
+
|
|
24
|
+
## 组件结构
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Tippy(trigger='click',interactive,appendTo=body)
|
|
28
|
+
│
|
|
29
|
+
├── ToolBtn(触发按钮,id/name/description/disabled 透传)
|
|
30
|
+
│
|
|
31
|
+
└── #content: div.ai-delete-confirm(width: 280px)
|
|
32
|
+
├── .ai-delete-confirm__title "确认删除该回答?"(16px, bold)
|
|
33
|
+
├── .ai-delete-confirm__desc "删除操作无法撤回,请谨慎操作!"
|
|
34
|
+
└── .ai-delete-confirm__actions(justify-content: flex-end,gap: 8px)
|
|
35
|
+
├── Button(theme="danger", size="small")→ 点击触发 confirm + 关闭弹窗
|
|
36
|
+
└── Button(size="small")→ 点击触发 cancel + 关闭弹窗
|
|
37
|
+
|
|
38
|
+
disabled=true 时:Tippy onShow 返回 false,弹窗不打开
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 基础用法
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<DeleteTool
|
|
46
|
+
id="delete"
|
|
47
|
+
name="删除"
|
|
48
|
+
description="删除消息"
|
|
49
|
+
@confirm="handleConfirm"
|
|
50
|
+
@cancel="handleCancel"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { DeleteTool } from '@blueking/chat-x';
|
|
56
|
+
|
|
57
|
+
const handleConfirm = () => {
|
|
58
|
+
console.log('用户确认删除,执行删除操作');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleCancel = () => {
|
|
62
|
+
console.log('用户取消删除');
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 禁用状态
|
|
68
|
+
|
|
69
|
+
`disabled=true` 时,点击按钮不弹出确认弹窗:
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<DeleteTool
|
|
74
|
+
id="delete"
|
|
75
|
+
name="删除"
|
|
76
|
+
description="删除消息"
|
|
77
|
+
:disabled="true"
|
|
78
|
+
@confirm="handleConfirm"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 在 MessageTools 中的自动使用
|
|
84
|
+
|
|
85
|
+
`MessageTools` 在渲染工具列表时,若检测到 `tool.id === 'delete'`,会自动使用 `DeleteTool` 替换普通 `ToolBtn`,无需手动配置:
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<template>
|
|
89
|
+
<MessageTools
|
|
90
|
+
:update-tools="updateTools"
|
|
91
|
+
:on-action="handleAction"
|
|
92
|
+
/>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script setup lang="ts">
|
|
96
|
+
import { MessageTools, type IToolBtn } from '@blueking/chat-x';
|
|
97
|
+
|
|
98
|
+
// delete 会自动使用 DeleteTool 渲染,点击弹确认框,确认后 onAction 触发
|
|
99
|
+
const updateTools: IToolBtn[] = [
|
|
100
|
+
{ id: 'like', name: '点赞', description: '点赞' },
|
|
101
|
+
{ id: 'unlike', name: '不满意', description: '不满意' },
|
|
102
|
+
{ id: 'delete', name: '删除', description: '删除消息' },
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const handleAction = async (tool: IToolBtn) => {
|
|
106
|
+
if (tool.id === 'delete') {
|
|
107
|
+
// 只有用户在弹窗中点击"删除"确认后,才会走到这里
|
|
108
|
+
console.log('执行删除:', tool.id);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## API
|
|
115
|
+
|
|
116
|
+
### Props
|
|
117
|
+
|
|
118
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
119
|
+
| ------------ | -------------------------------------------------------------------------- | ---- | ------ | -------------------------------------------------------------------- |
|
|
120
|
+
| id | `string` | 是 | — | 按钮标识,传 `"delete"` 时显示删除图标 |
|
|
121
|
+
| name | `string` | 否 | — | 按钮名称,`id` 无对应图标时作为文本内容渲染 |
|
|
122
|
+
| description | `string` | 否 | — | `ToolBtn` 的 tooltip 文本;`disabled=true` 时不显示 |
|
|
123
|
+
| disabled | `boolean` | 否 | — | 禁用态;`true` 时点击不弹出确认弹窗,`ToolBtn` 同步禁用 |
|
|
124
|
+
| tippyOptions | `Partial<Omit<TippyOptions, 'getReferenceClientRect' \| 'triggerTarget'>>` | 否 | — | 覆盖确认弹窗(`Tippy`)的默认配置;可覆盖 `placement`、`appendTo` 等 |
|
|
125
|
+
|
|
126
|
+
### Events
|
|
127
|
+
|
|
128
|
+
| 事件名 | 参数 | 触发时机 |
|
|
129
|
+
| ------- | ---- | ---------------------------------- |
|
|
130
|
+
| confirm | — | 用户在确认弹窗点击"删除"按钮后触发 |
|
|
131
|
+
| cancel | — | 用户在确认弹窗点击"取消"按钮后触发 |
|
|
132
|
+
|
|
133
|
+
## 类型定义
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import type { IToolBtn } from '@blueking/chat-x';
|
|
137
|
+
import type { TippyOptions } from 'vue-tippy';
|
|
138
|
+
|
|
139
|
+
export type DeleteToolProps = IToolBtn & {
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
tippyOptions?: Partial<Omit<TippyOptions, 'getReferenceClientRect' | 'triggerTarget'>>;
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 样式说明
|
|
146
|
+
|
|
147
|
+
确认弹窗(`.ai-delete-confirm`)样式:
|
|
148
|
+
|
|
149
|
+
```scss
|
|
150
|
+
.ai-delete-confirm {
|
|
151
|
+
width: 280px;
|
|
152
|
+
padding: 16px;
|
|
153
|
+
font-size: 12px;
|
|
154
|
+
color: #4d4f56;
|
|
155
|
+
background: #fff;
|
|
156
|
+
border: 1px solid #dcdee5;
|
|
157
|
+
box-shadow: 0 2px 6px 0 #0000001a;
|
|
158
|
+
|
|
159
|
+
&__title {
|
|
160
|
+
margin-bottom: 6px;
|
|
161
|
+
font-size: 16px;
|
|
162
|
+
font-weight: 600;
|
|
163
|
+
line-height: 22px;
|
|
164
|
+
color: #313238;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__desc {
|
|
168
|
+
margin-bottom: 16px;
|
|
169
|
+
line-height: 20px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&__actions {
|
|
173
|
+
display: flex;
|
|
174
|
+
gap: 8px;
|
|
175
|
+
justify-content: flex-end;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 注意事项
|
|
181
|
+
|
|
182
|
+
1. **确认才触发**:`confirm` 事件只在用户点击弹窗内"删除"按钮后触发;直接点击 `ToolBtn` 触发器不会触发任何业务事件
|
|
183
|
+
2. **`disabled` 双重保障**:`disabled=true` 时,`ToolBtn` 的 JS 层拦截 click,且 `Tippy` 的 `onShow` 返回 `false`,弹窗不会弹出
|
|
184
|
+
3. **弹窗挂载至 body**:默认 `appendTo: () => document.body`,避免被父容器 `overflow: hidden` 裁剪
|
|
185
|
+
4. **组件卸载自动关闭**:`onUnmounted` 时调用 `hide()` 关闭弹窗,防止组件销毁后弹窗残留
|
|
186
|
+
5. **`MessageTools` 自动处理**:通常不需要直接使用此组件,`MessageTools` 会在 `id === 'delete'` 时自动替换
|
|
187
|
+
|
|
188
|
+
## 关联组件
|
|
189
|
+
|
|
190
|
+
- [ToolBtn](/components/feedback/tool-btn) — 触发按钮
|
|
191
|
+
- [MessageTools](/components/feedback/message-tools) — 工具栏中 delete 替换入口
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# DescPanel 描述面板
|
|
2
|
+
|
|
3
|
+
> 能力域:内容渲染 | 导入:`import { DescPanel } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
将文本或 JSON 内容降级为可读描述面板。 源码位置:src/components/tool-call/desc-panel/desc-panel.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:toolcall-render(工具调用详情中渲染描述与参数)、tool-message(工具返回内容同样由 DescPanel 承载)、highlight-keyword(键值与文本匹配关键词高亮)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# DescPanel 描述面板
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/tool-call/desc-panel/desc-panel.vue`
|
|
15
|
+
- **能力域**:内容渲染
|
|
16
|
+
- **能力说明**:将文本或 JSON 内容降级为可读描述面板。
|
|
17
|
+
|
|
18
|
+
> **能力域**:内容渲染
|
|
19
|
+
|
|
20
|
+
工具调用(ToolCall)详情面板的描述区域组件,主要用于 `ToolcallRender` 内部的折叠面板中。
|
|
21
|
+
|
|
22
|
+
将 `desc` 字符串尝试解析为 JSON,解析成功且结果为对象/数组时以键值对列表渲染,否则作为纯文本展示。
|
|
23
|
+
|
|
24
|
+
## 组件结构
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
.ai-toolcall-desc(flex column,padding: 0 16px,max-height: 300px,overflow-y: auto,
|
|
28
|
+
font-size: 12px,line-height: 20px,color: #4d4f56,background: #f5f7fa,radius: 2px)
|
|
29
|
+
├── .desc-title(sticky top: 0,flex + gap 4px,padding: 12px 0 4px,加粗,背景同面板)
|
|
30
|
+
│ ├── {{ title }}
|
|
31
|
+
│ └── .desc-copy(v-if desc;CopyIcon 14×14,margin-left: auto,默认 visibility: hidden)
|
|
32
|
+
└── .desc-panel(flex column,gap: 4px,padding-bottom: 12px)
|
|
33
|
+
├── [JSON 对象/数组] v-for 逐项渲染 .desc-panel-item
|
|
34
|
+
│ ├── .desc-label → HighlightKeyword(key) + 半角冒号
|
|
35
|
+
│ └── .desc-value → HighlightKeyword(值的文本或 JSON 字符串),`word-break: break-all`
|
|
36
|
+
└── [非 JSON / 解析失败] HighlightKeyword(data),`word-break: break-all`
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
面板整体限高 **300px**,超出后内部滚动,`.desc-title` 吸顶不动。纵向留白由标题的 `padding-top` 与内容区的 `padding-bottom` 承担(容器自身不设上下 padding),避免标题吸顶时上方留白漏出滚动内容。
|
|
40
|
+
|
|
41
|
+
> **说明**:键值与纯文本均通过 `HighlightKeyword` 展示,长内容依赖换行与面板宽度展示,**不再**使用 `v-overflow-tips` 悬停气泡。
|
|
42
|
+
|
|
43
|
+
## 复制原始内容
|
|
44
|
+
|
|
45
|
+
`desc` 有值时,标题右侧渲染复制按钮(`.desc-copy`),默认 `visibility: hidden`,鼠标移入面板后显示,图标默认 `#979ba5`、hover `#3a84ff`:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// 复制的是原始 desc 字符串,而非解析后的展示内容,便于粘贴后二次使用
|
|
49
|
+
const handleCopy = () => {
|
|
50
|
+
if (props.desc) {
|
|
51
|
+
copy(props.desc);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
复制能力来自 [useClipboard](/composables/use-clipboard),复制结果的成功/失败提示由该 composable 统一处理。`desc` 为空时按钮不渲染。
|
|
57
|
+
|
|
58
|
+
## desc 解析规则
|
|
59
|
+
|
|
60
|
+
`data` 是一个 computed,逻辑如下:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const data = computed(() => {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(props.desc || ''); // desc 为 undefined/''/null 时 parse('') 会抛出
|
|
66
|
+
} catch {
|
|
67
|
+
return props.desc; // 解析失败,原样返回字符串
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
模板通过 `typeof data === 'object'` 分支渲染:
|
|
73
|
+
|
|
74
|
+
| desc 值 | JSON.parse 结果 | typeof 结果 | 渲染方式 |
|
|
75
|
+
| ------------------ | --------------- | ----------- | ------------------------ |
|
|
76
|
+
| `'{"a":1}'` | `{ a: 1 }` | `'object'` | 键值对列表 |
|
|
77
|
+
| `'[1,2,3]'` | `[1, 2, 3]` | `'object'` | 索引键值对(0:、1:、2:) |
|
|
78
|
+
| `'{}'` | `{}` | `'object'` | 键值对列表(0 行) |
|
|
79
|
+
| `'"hello"'` | `"hello"` | `'string'` | 纯文本 |
|
|
80
|
+
| `'42'` | `42` | `'number'` | 纯文本 |
|
|
81
|
+
| `'普通文本'` | 解析抛出 | — | 纯文本(原始字符串) |
|
|
82
|
+
| `''` / `undefined` | 解析抛出 | — | 纯文本(空白) |
|
|
83
|
+
|
|
84
|
+
> **嵌套对象**:值本身是对象时,文本区域通过 `JSON.stringify(value)` 展示完整 JSON(`HighlightKeyword` + `word-break: break-all`),不再使用悬停 tooltip。
|
|
85
|
+
|
|
86
|
+
## 基础用法:JSON 参数
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
<template>
|
|
90
|
+
<DescPanel
|
|
91
|
+
title="工具调用参数"
|
|
92
|
+
desc='{"query": "天气查询", "city": "北京", "unit": "celsius"}'
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import { DescPanel } from '@blueking/chat-x';
|
|
98
|
+
</script>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 纯文本描述
|
|
102
|
+
|
|
103
|
+
`desc` 不是合法 JSON 时作为纯文本渲染:
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
<template>
|
|
107
|
+
<DescPanel
|
|
108
|
+
title="执行说明"
|
|
109
|
+
desc="正在查询北京的实时天气,请稍候..."
|
|
110
|
+
/>
|
|
111
|
+
</template>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## JSON 数组
|
|
115
|
+
|
|
116
|
+
JSON 数组同样被视为 `object`,以数组索引(`0:`、`1:`…)作为键渲染:
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<template>
|
|
120
|
+
<DescPanel
|
|
121
|
+
title="文件列表"
|
|
122
|
+
desc='["report.pdf", "data.csv", "readme.md"]'
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 嵌套 JSON
|
|
128
|
+
|
|
129
|
+
嵌套对象的值在文本区域直接渲染为 `JSON.stringify(value)` 字符串,便于在面板内换行阅读:
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
<template>
|
|
133
|
+
<DescPanel
|
|
134
|
+
title="API 配置"
|
|
135
|
+
desc='{"endpoint": "/api/search", "headers": {"Authorization": "Bearer xxx", "Content-Type": "application/json"}, "timeout": 5000}'
|
|
136
|
+
/>
|
|
137
|
+
</template>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 无 desc
|
|
141
|
+
|
|
142
|
+
`desc` 为可选,不传时面板仅显示标题,内容区域为空,复制按钮也不渲染:
|
|
143
|
+
|
|
144
|
+
## API
|
|
145
|
+
|
|
146
|
+
### Props
|
|
147
|
+
|
|
148
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
149
|
+
| ------ | -------- | ---- | ----------------------------------------------------------------------------------- |
|
|
150
|
+
| title | `string` | ✓ | 面板标题,始终渲染在顶部(吸顶) |
|
|
151
|
+
| desc | `string` | — | 描述内容;尝试 `JSON.parse`,成功且为 `object` 类型时渲染键值对列表,否则渲染纯文本;有值时才渲染复制按钮 |
|
|
152
|
+
|
|
153
|
+
## 使用场景
|
|
154
|
+
|
|
155
|
+
`DescPanel` 主要由 `ToolcallRender` 在展开的详情面板中使用,渲染两块内容:**描述**(`function.description`)与**参数**(`function.arguments`);工具返回结果则由 `ToolMessage` 再包一层 `DescPanel`(标题「返回内容」)展示。通常不需要手动引入,如需独立使用,直接传入 `title` 和 `desc` 即可。
|
|
156
|
+
|
|
157
|
+
## 关联组件
|
|
158
|
+
|
|
159
|
+
- [ToolcallRender](/components/agent/toolcall-render) — 主要使用场景
|
|
160
|
+
- [ToolMessage](/components/message/tool-message) — 工具返回内容面板
|
|
161
|
+
- [HighlightKeyword](/components/helper/highlight-keyword) — 键值高亮
|
|
162
|
+
- [useClipboard](/composables/use-clipboard) — 复制按钮能力来源
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# DetailSection 详情分段
|
|
2
|
+
|
|
3
|
+
> 能力域:Agent 能力 | 导入:`import { DetailSection } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
FlowAgent 节点详情中的标题/内容分段容器。 源码位置:src/components/chat-content/flow-agent-content/detail-section.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:flow-agent-node-detail(节点详情中用于承载基础信息、输入参数、输出参数等区块)、simple-table(常作为分段内容展示结构化参数表格)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# DetailSection 详情分段
|
|
12
|
+
|
|
13
|
+
> **能力域**:Agent 能力
|
|
14
|
+
|
|
15
|
+
`DetailSection` 是 FlowAgent 节点详情页中的轻量分段容器,用于给一组相关信息提供统一标题样式。组件自身只负责渲染标题和默认插槽,不处理数据格式、折叠、空态或表格逻辑。
|
|
16
|
+
|
|
17
|
+
通常不需要单独接入,主要由 `FlowAgentNodeDetail` 内部组合使用。
|
|
18
|
+
|
|
19
|
+
## 源码事实
|
|
20
|
+
|
|
21
|
+
- **源码位置**:`src/components/chat-content/flow-agent-content/detail-section.vue`
|
|
22
|
+
- **能力说明**:FlowAgent 节点详情中的标题/内容分段容器。
|
|
23
|
+
|
|
24
|
+
## 核心能力
|
|
25
|
+
|
|
26
|
+
- **统一标题样式**:标题前带蓝色竖条,标题文本使用详情页统一字号与字重
|
|
27
|
+
- **内容完全透传**:通过默认插槽承载任意内容,如基础信息表单、`SimpleTable` 或自定义说明
|
|
28
|
+
- **无内部状态**:不维护折叠、加载、选择等状态,适合作为详情页布局基础块
|
|
29
|
+
|
|
30
|
+
## 基础用法
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<template>
|
|
34
|
+
<DetailSection title="基础信息">
|
|
35
|
+
<div class="info-row">节点名称:采集主机指标</div>
|
|
36
|
+
</DetailSection>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import DetailSection from '@blueking/chat-x/src/components/chat-content/flow-agent-content/detail-section.vue';
|
|
41
|
+
</script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**渲染效果**
|
|
45
|
+
|
|
46
|
+
## 搭配 SimpleTable
|
|
47
|
+
|
|
48
|
+
`DetailSection` 最常见的用法是包裹结构化内容,由外层负责分段标题,内部组件负责数据展示。
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<template>
|
|
52
|
+
<DetailSection title="输入参数">
|
|
53
|
+
<SimpleTable
|
|
54
|
+
:columns="columns"
|
|
55
|
+
:data="data"
|
|
56
|
+
/>
|
|
57
|
+
</DetailSection>
|
|
58
|
+
</template>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## API
|
|
62
|
+
|
|
63
|
+
### Props
|
|
64
|
+
|
|
65
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
66
|
+
| ------ | -------- | ---- | ------ | -------- |
|
|
67
|
+
| title | `string` | 是 | — | 分段标题 |
|
|
68
|
+
|
|
69
|
+
### Emits
|
|
70
|
+
|
|
71
|
+
- 无。
|
|
72
|
+
|
|
73
|
+
### Slots
|
|
74
|
+
|
|
75
|
+
| 插槽名 | 说明 |
|
|
76
|
+
| ------- | ---------------- |
|
|
77
|
+
| default | 分段主体展示内容 |
|
|
78
|
+
|
|
79
|
+
### Expose
|
|
80
|
+
|
|
81
|
+
- 无。
|
|
82
|
+
|
|
83
|
+
## 使用建议
|
|
84
|
+
|
|
85
|
+
- 用于详情页内部的短分段,不建议作为通用卡片或页面 Section 使用。
|
|
86
|
+
- 内容空态应由插槽内组件自行处理,`DetailSection` 不会主动显示空态。
|
|
87
|
+
|
|
88
|
+
## 关联组件
|
|
89
|
+
|
|
90
|
+
- [FlowAgentNodeDetail](./flow-agent-node-detail.md) — 节点详情主体。
|
|
91
|
+
- [SimpleTable](./simple-table.md) — 分段内常用的轻量表格。
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# ExecutionSummary 执行摘要
|
|
2
|
+
|
|
3
|
+
> 能力域:Agent 能力 | 导入:`import { ExecutionSummary } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
按消息流提取执行摘要,支持关键词定位和消息渲染。 源码位置:src/components/execution-summary/execution-summary.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:message-render(摘要列表内渲染消息内容)、highlight-keyword(搜索关键词注入与高亮)、chat-container(常与侧栏「执行情况」Tab 组合)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ExecutionSummary 执行摘要
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/execution-summary/execution-summary.vue`
|
|
15
|
+
- **能力域**:Agent 能力
|
|
16
|
+
- **能力说明**:按消息流提取执行摘要,支持关键词定位和消息渲染。
|
|
17
|
+
|
|
18
|
+
> **能力域**:Agent 能力
|
|
19
|
+
|
|
20
|
+
执行摘要面板组件,以时间线形式展示对话中的工具调用和 FlowAgent 活动记录。支持关键词搜索过滤和点击定位到对话中的消息位置。
|
|
21
|
+
|
|
22
|
+
通常不需要直接使用,`ChatContainer` 会在侧边栏的「执行情况」Tab 中自动渲染。
|
|
23
|
+
|
|
24
|
+
## 核心能力
|
|
25
|
+
|
|
26
|
+
- **时间线布局**:每组消息按时间节点排列,带连接线
|
|
27
|
+
- **关键词搜索**:实时过滤匹配的执行记录
|
|
28
|
+
- **对话定位**:hover 显示「在对话中定位」按钮,点击滚动到对应消息
|
|
29
|
+
- **空状态处理**:无数据或搜索无结果时显示空状态提示
|
|
30
|
+
|
|
31
|
+
## 基础用法
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<template>
|
|
35
|
+
<ExecutionSummary
|
|
36
|
+
:message-groups="executionGroups"
|
|
37
|
+
@locate-message-group="handleLocate"
|
|
38
|
+
@update-keyword="handleUpdateKeyword"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { ExecutionSummary, type MessageGroup } from '@blueking/chat-x';
|
|
44
|
+
|
|
45
|
+
const handleLocate = (uid: string, group: MessageGroup) => {
|
|
46
|
+
const dom = document.getElementById(uid);
|
|
47
|
+
dom?.scrollIntoView({ behavior: 'smooth' });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleUpdateKeyword = (keyword: string) => {
|
|
51
|
+
console.log('搜索关键词:', keyword);
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**渲染效果**(包含搜索过滤和定位功能,hover 消息组可看到「在对话中定位」按钮)
|
|
57
|
+
|
|
58
|
+
## 组件结构
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
ai-execution-summary
|
|
62
|
+
├── ai-execution-summary-header(仅 messageGroups 非空时渲染)
|
|
63
|
+
│ └── Input(关键词搜索框,clearable)
|
|
64
|
+
└── ai-execution-summary-content
|
|
65
|
+
├── 有数据时:
|
|
66
|
+
│ └── content-item × N(时间线节点)
|
|
67
|
+
│ ├── timeline-dot(时间节点圆点)
|
|
68
|
+
│ ├── content-item-time(格式化时间)
|
|
69
|
+
│ ├── content-item-locate(hover 显示定位按钮)
|
|
70
|
+
│ ├── content-item-messages(MessageRender × N)
|
|
71
|
+
│ └── timeline-line(连接线,最后一项不显示)
|
|
72
|
+
└── 无数据时:
|
|
73
|
+
└── Exception(scene="part")+「暂无数据」/「搜索结果为空」文案(有关键词时附带「清空搜索」)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 空状态
|
|
77
|
+
|
|
78
|
+
当 `messageGroups` 为空数组时,**不渲染搜索 header**,内容区整块展示空态(bkui `Exception` +「暂无数据」;若仍有搜索关键词则为「搜索结果为空」并提供「清空搜索」):
|
|
79
|
+
|
|
80
|
+
## 与 ChatContainer 配合
|
|
81
|
+
|
|
82
|
+
`ChatContainer` 通过 `useMessageGroup` 计算 `executionGroups`(仅包含工具调用和 FlowAgent 消息),并传给 `ExecutionSummary`:
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<!-- ChatContainer 内部 -->
|
|
86
|
+
<ExecutionSummary
|
|
87
|
+
:message-groups="executionGroups"
|
|
88
|
+
@locate-message-group="handleLocateMessageGroup"
|
|
89
|
+
@update-keyword="handleUpdateKeyword"
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## API
|
|
94
|
+
|
|
95
|
+
### Props
|
|
96
|
+
|
|
97
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
98
|
+
| ------------- | ---------------- | ---- | ---------------- |
|
|
99
|
+
| messageGroups | `MessageGroup[]` | ✓ | 执行摘要消息分组 |
|
|
100
|
+
|
|
101
|
+
### Events
|
|
102
|
+
|
|
103
|
+
| 事件名 | 参数 | 说明 |
|
|
104
|
+
| ------------------ | ------------------------------------- | ------------------------ |
|
|
105
|
+
| locateMessageGroup | `(uid: string, group: MessageGroup)` | 点击「在对话中定位」按钮,参数为消息组 `MessageGroup.uid` |
|
|
106
|
+
| updateKeyword | `(keyword: string)` | 搜索关键词变更 |
|
|
107
|
+
|
|
108
|
+
## 类型定义
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { type MessageGroup } from '@blueking/chat-x';
|
|
112
|
+
|
|
113
|
+
interface MessageGroup {
|
|
114
|
+
uid: string;
|
|
115
|
+
type: MessageRole;
|
|
116
|
+
messages: Message[];
|
|
117
|
+
checked: boolean;
|
|
118
|
+
isHover: boolean;
|
|
119
|
+
pause?: boolean;
|
|
120
|
+
startTime?: number;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 关联组件
|
|
125
|
+
|
|
126
|
+
- [MessageRender](/components/message/message-render) — 摘要内消息渲染
|
|
127
|
+
- [HighlightKeyword](/components/helper/highlight-keyword) — 搜索高亮
|
|
128
|
+
- [ChatContainer](/components/setup/chat-container) — 侧栏挂载场景
|