@blueking/chat-x 0.0.51-beta.5 → 0.0.52-dev.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/README.md +15 -8
- package/dist/ag-ui/types/contents.d.ts +2 -0
- package/dist/ag-ui/types/messages.d.ts +6 -1
- package/dist/common/constants.d.ts +2 -0
- package/dist/components/ai-buttons/add-menu-btn/add-menu-btn.vue.d.ts +24 -0
- package/dist/components/chat-content/collapsible-content/collapsible-content.vue.d.ts +28 -0
- package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +5 -2
- package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +1 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +1 -1
- package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +21 -10
- package/dist/components/chat-input/ai-slash-input/command.d.ts +6 -3
- package/dist/components/chat-input/ai-slash-input/constants.d.ts +2 -0
- package/dist/components/chat-input/ai-slash-input/use-menu-trigger.d.ts +17 -0
- package/dist/components/chat-input/build-default-placeholder.d.ts +9 -3
- package/dist/components/chat-input/chat-input.vue.d.ts +30 -18
- package/dist/components/chat-input/input-menu/constants.d.ts +60 -0
- package/dist/components/chat-input/input-menu/index.d.ts +4 -0
- package/dist/components/chat-input/input-menu/input-menu-option.vue.d.ts +14 -0
- package/dist/components/chat-input/input-menu/input-menu-panel.vue.d.ts +17 -0
- package/dist/components/chat-input/input-menu/use-input-menu.d.ts +22 -0
- package/dist/components/chat-input/model-selector/types.d.ts +3 -2
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -1
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +1 -1
- package/dist/components/mention/create-mention-tippy.d.ts +27 -0
- package/dist/components/mention/index.d.ts +4 -0
- package/dist/components/{chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue.d.ts → mention/mention-popover.vue.d.ts} +3 -2
- package/dist/components/{chat-input/ai-slash-input/ai-skill-list/ai-skill-list.vue.d.ts → mention/mention-tag.vue.d.ts} +7 -3
- package/dist/components/{chat-input/ai-slash-input/ai-slash-menu/ai-slash-menu.vue.d.ts → mention/mention-text.vue.d.ts} +3 -3
- package/dist/components/resource-icon/index.d.ts +1 -0
- package/dist/components/resource-icon/resource-icon.vue.d.ts +11 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +5 -2
- package/dist/composables/use-common.d.ts +0 -9
- package/dist/composables/use-global-config.d.ts +4 -0
- package/dist/composables/use-input-mention.d.ts +13 -0
- package/dist/composables/use-message-group.d.ts +1011 -72
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/input.d.ts +21 -0
- package/dist/icons/menu-item.d.ts +22 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4953 -4429
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +13 -3
- package/dist/mcp/generated/docs/activity-message.md +3 -3
- package/dist/mcp/generated/docs/add-menu-btn.md +91 -0
- package/dist/mcp/generated/docs/ai-slash-input.md +72 -26
- package/dist/mcp/generated/docs/assistant-message.md +7 -1
- package/dist/mcp/generated/docs/chat-container.md +45 -6
- package/dist/mcp/generated/docs/chat-input.md +327 -483
- package/dist/mcp/generated/docs/collapsible-content.md +78 -0
- package/dist/mcp/generated/docs/constants.md +36 -3
- package/dist/mcp/generated/docs/execution-summary.md +1 -23
- package/dist/mcp/generated/docs/file-artifact-panel.md +24 -5
- package/dist/mcp/generated/docs/file-content.md +4 -0
- package/dist/mcp/generated/docs/file-upload-btn.md +15 -12
- package/dist/mcp/generated/docs/flow-agent-content.md +10 -12
- package/dist/mcp/generated/docs/input-menu-panel.md +166 -0
- package/dist/mcp/generated/docs/mention-tag.md +83 -0
- package/dist/mcp/generated/docs/mention-text.md +86 -0
- package/dist/mcp/generated/docs/message-container.md +1 -1
- package/dist/mcp/generated/docs/message-render.md +1 -1
- package/dist/mcp/generated/docs/message-tools.md +15 -4
- package/dist/mcp/generated/docs/messages.md +3 -0
- package/dist/mcp/generated/docs/model-selector.md +4 -2
- package/dist/mcp/generated/docs/overflow-tips.md +3 -3
- package/dist/mcp/generated/docs/resource-icon.md +102 -0
- package/dist/mcp/generated/docs/text-content.md +7 -3
- package/dist/mcp/generated/docs/theme.md +27 -35
- package/dist/mcp/generated/docs/use-artifact-preview.md +7 -3
- package/dist/mcp/generated/docs/use-command-selection.md +1 -1
- package/dist/mcp/generated/docs/use-container-scroll.md +2 -1
- package/dist/mcp/generated/docs/use-flow-node-actions.md +8 -15
- package/dist/mcp/generated/docs/use-global-config.md +11 -4
- package/dist/mcp/generated/docs/use-input-mention.md +119 -0
- package/dist/mcp/generated/docs/use-menu-keydown.md +15 -16
- package/dist/mcp/generated/docs/use-message-group.md +3 -6
- package/dist/mcp/generated/docs/user-message.md +39 -17
- package/dist/mcp/generated/index.json +233 -81
- package/dist/types/editor.d.ts +0 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/input-menu.d.ts +46 -0
- package/dist/utils/artifact-tags.d.ts +36 -0
- package/dist/utils/collect-message-artifacts.d.ts +14 -0
- package/dist/utils/file.d.ts +3 -3
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/upload-file.d.ts +6 -1
- package/package.json +3 -2
- package/skills/blueking-chat-x/SKILL.md +143 -0
- package/skills/blueking-chat-x/references/_index.md +153 -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/add-menu-btn.md +88 -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-selection.md +439 -0
- package/skills/blueking-chat-x/references/components/ai-slash-input.md +102 -0
- package/skills/blueking-chat-x/references/components/animation-text.md +202 -0
- package/skills/blueking-chat-x/references/components/assistant-message.md +504 -0
- package/skills/blueking-chat-x/references/components/chat-container.md +912 -0
- package/skills/blueking-chat-x/references/components/chat-input.md +614 -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/collapsible-content.md +76 -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 +150 -0
- package/skills/blueking-chat-x/references/components/file-artifact-panel.md +307 -0
- package/skills/blueking-chat-x/references/components/file-content.md +340 -0
- package/skills/blueking-chat-x/references/components/file-icon.md +109 -0
- package/skills/blueking-chat-x/references/components/file-upload-btn.md +162 -0
- package/skills/blueking-chat-x/references/components/flow-agent-content.md +266 -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/input-menu-panel.md +162 -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/mention-tag.md +79 -0
- package/skills/blueking-chat-x/references/components/mention-text.md +83 -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 +427 -0
- package/skills/blueking-chat-x/references/components/model-selector.md +157 -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/resource-icon.md +98 -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 +80 -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 +444 -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 +235 -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 +164 -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 +155 -0
- package/skills/blueking-chat-x/references/composables/use-input-mention.md +115 -0
- package/skills/blueking-chat-x/references/composables/use-menu-keydown.md +161 -0
- package/skills/blueking-chat-x/references/composables/use-message-group.md +244 -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/directives/index.md +61 -0
- package/skills/blueking-chat-x/references/directives/overflow-tips.md +205 -0
- package/skills/blueking-chat-x/references/icons/index.md +185 -0
- package/skills/blueking-chat-x/references/plugins/index.md +56 -0
- package/skills/blueking-chat-x/references/plugins/markdown-container.md +55 -0
- package/skills/blueking-chat-x/references/plugins/markdown-latex.md +205 -0
- package/skills/blueking-chat-x/references/plugins/markdown-mermaid.md +247 -0
- package/skills/blueking-chat-x/references/theme/theme.md +423 -0
- package/skills/blueking-chat-x/references/types/constants.md +340 -0
- package/skills/blueking-chat-x/references/types/index.md +120 -0
- package/skills/blueking-chat-x/references/types/interrupt.md +379 -0
- package/skills/blueking-chat-x/references/types/messages.md +556 -0
- package/skills/blueking-chat-x/references/types/schema.md +91 -0
- package/skills/blueking-chat-x/references/utils/index.md +196 -0
- package/skills/blueking-chat-x/scripts/generate-references.mjs +536 -0
- package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +0 -28
- package/dist/components/chat-input/ai-slash-editor/theme.d.ts +0 -24
- package/dist/mcp/generated/docs/ai-prompt-list.md +0 -45
- package/dist/mcp/generated/docs/ai-skill-list.md +0 -75
- package/dist/mcp/generated/docs/ai-slash-editor.md +0 -43
- package/dist/mcp/generated/docs/ai-slash-menu.md +0 -42
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!-- AI SUMMARY -->
|
|
2
|
+
## 快速了解
|
|
3
|
+
|
|
4
|
+
MentionTag 渲染「图标 + 蓝色名称」的内联资源标签:节点数据全部落在 data-tag-* 属性上, 既是编辑器 void 节点的识别依据,也让消息里复制的标签能原样还原; description 非空时 hover / 点击弹出「类型:名称 + 描述」气泡;type 为 artifact 且存在产物预览上下文时点击打开侧栏预览。 源码位置:src/components/mention/mention-tag.vue(气泡见 mention-popover.vue 与 create-mention-tippy.ts)。
|
|
5
|
+
|
|
6
|
+
### 关联组件
|
|
7
|
+
- **mention-text** — 按文档结构批量渲染标签与文本
|
|
8
|
+
- **ai-slash-input** — 编辑器内的 tag 节点由本组件渲染
|
|
9
|
+
- **resource-icon** — 标签左侧图标
|
|
10
|
+
- **file-artifact-panel** — artifact 标签点击后打开的侧栏预览
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
<!-- FULL DOC -->
|
|
14
|
+
|
|
15
|
+
# MentionTag 资源标签
|
|
16
|
+
|
|
17
|
+
> **能力域**:内容渲染
|
|
18
|
+
|
|
19
|
+
## 源码事实
|
|
20
|
+
|
|
21
|
+
- **标签**:`src/components/mention/mention-tag.vue`
|
|
22
|
+
- **气泡内容**:`src/components/mention/mention-popover.vue`
|
|
23
|
+
- **气泡配置**:`src/components/mention/create-mention-tippy.ts`
|
|
24
|
+
- **能力说明**:设计稿形态为「图标 + 蓝色文字」内联展示,无背景块;高度 22px,`vertical-align: bottom`。
|
|
25
|
+
|
|
26
|
+
## data-tag-\* 属性
|
|
27
|
+
|
|
28
|
+
标签把节点数据全部写在 DOM 属性上,这不是冗余:
|
|
29
|
+
|
|
30
|
+
| 属性 | 作用 |
|
|
31
|
+
| ---------------------- | -------------------------------------------------------- |
|
|
32
|
+
| `data-tag-type` | 与 `contenteditable="false"` 一起作为编辑器 void 节点的识别依据 |
|
|
33
|
+
| `data-tag-value` | 资源 id,`artifact` 点击预览、`skill` 序列化都取它 |
|
|
34
|
+
| `data-tag-label` | 展示名,避免从 `textContent` 读取时混入图标带来的空白 |
|
|
35
|
+
| `data-tag-icon` | 图标 URL(组件形式的图标无法序列化,此时为空) |
|
|
36
|
+
| `data-tag-description` | 描述文案,让气泡脱离 `menuSources` 独立工作 |
|
|
37
|
+
|
|
38
|
+
因此从消息里复制一段带标签的文本再粘贴回输入框,标签能被原样还原。
|
|
39
|
+
|
|
40
|
+
## 交互
|
|
41
|
+
|
|
42
|
+
- **描述气泡**:`description` 非空时才创建气泡(否则 `onShow` 直接返回 `false`)。标题格式为 `类型:名称`,类型名与菜单分组标题同源(`getMenuTypeLabel`)。
|
|
43
|
+
- **触发方式**:`mouseenter focus click`,展示延迟 300ms、关闭无延迟;`hideOnClick` 关闭并改用 `onClickOutside` 收起,因此再次点击标签不会把气泡收掉,触屏也能点开。
|
|
44
|
+
- **产物预览**:`type` 为 `artifact` 且存在 [useArtifactPreview](/composables/use-artifact-preview) 上下文时,点击标签以 `{ file: { outputId: value } }` 打开侧栏预览。
|
|
45
|
+
- **可交互暗示**:仅在「有描述」或「可预览」时给出 `cursor: pointer` 与名称下划线。
|
|
46
|
+
|
|
47
|
+
::: info 为什么用指令而不是 `<Tippy>` 组件
|
|
48
|
+
标签渲染在 `contenteditable` 内部,多包一层元素会干扰编辑器对 void 节点的识别与 DOM 比对,因此气泡走 `v-tippy` 指令。
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
## 渲染示例
|
|
52
|
+
|
|
53
|
+
> 前三个标签中「翻译」「天气查询」带描述,hover 可见气泡;`artifact` 标签在有产物预览上下文时可点击。
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
### Props
|
|
58
|
+
|
|
59
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
60
|
+
| ----------- | -------- | ---- | ----------------------------------------------------- |
|
|
61
|
+
| label | `string` | ✅ | 标签展示名 |
|
|
62
|
+
| value | `string` | ✅ | 资源 id |
|
|
63
|
+
| type | `string` | ✅ | 资源类型,决定兜底图标、气泡标题与是否可预览 |
|
|
64
|
+
| icon | `string` | - | 图标 URL;缺省时按 `type` 兜底 |
|
|
65
|
+
| description | `string` | - | 描述文案,非空时启用气泡 |
|
|
66
|
+
|
|
67
|
+
### MentionPopover Props
|
|
68
|
+
|
|
69
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
70
|
+
| ----------- | -------- | ---- | ------------------------------------ |
|
|
71
|
+
| title | `string` | ✅ | 形如「工具:天气查询」 |
|
|
72
|
+
| description | `string` | - | 描述正文,最大宽度 240px,自动换行 |
|
|
73
|
+
|
|
74
|
+
### Emits / Slots / Expose
|
|
75
|
+
|
|
76
|
+
- 无。
|
|
77
|
+
|
|
78
|
+
## 关联组件
|
|
79
|
+
|
|
80
|
+
- [MentionText](/components/rendering/mention-text) — 按文档结构批量渲染
|
|
81
|
+
- [AiSlashInput](/components/input/ai-slash-input) — 编辑器内的标签宿主
|
|
82
|
+
- [ResourceIcon](/components/helper/resource-icon) — 标签图标
|
|
83
|
+
- [useArtifactPreview](/composables/use-artifact-preview) — 产物预览上下文
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!-- AI SUMMARY -->
|
|
2
|
+
## 快速了解
|
|
3
|
+
|
|
4
|
+
MentionText 接收一份 TagSchema 文档(二维数组:行 → 节点),逐行渲染:text 节点输出文本、 tag 节点交给 MentionTag;行间用 <br> 分隔,空白以 pre-wrap 保留。 UserMessage 在 property.docSchema 含标签时用它替代 TextContent。 源码位置:src/components/mention/mention-text.vue。
|
|
5
|
+
|
|
6
|
+
### 关联组件
|
|
7
|
+
- **mention-tag** — tag 节点的实际渲染者
|
|
8
|
+
- **user-message** — 用户消息在文档含标签时改用本组件回显
|
|
9
|
+
- **text-content** — 纯文本消息仍走 TextContent
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
<!-- FULL DOC -->
|
|
13
|
+
|
|
14
|
+
# MentionText 标签文本
|
|
15
|
+
|
|
16
|
+
> **能力域**:内容渲染
|
|
17
|
+
|
|
18
|
+
## 源码事实
|
|
19
|
+
|
|
20
|
+
- **源码位置**:`src/components/mention/mention-text.vue`
|
|
21
|
+
- **能力说明**:把 `TagSchema` 文档渲染成「文本 + 资源标签」,让用户消息里 `@` 选中的资源保持标签形态而不是退化成纯文本。
|
|
22
|
+
- **样式**:`width: fit-content`、`word-break: break-all`、`white-space: pre-wrap`(行间换行由 `<br>` 承担,行内连续空格与纯文本分支表现一致)。
|
|
23
|
+
|
|
24
|
+
## 数据流:消息里的标签怎么活下来
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
用户在输入框选中资源
|
|
28
|
+
→ onSendMessage(content, docSchema) content 仍是纯文本,不改后端契约
|
|
29
|
+
→ 业务侧把 docSchema 存进 message.property.docSchema
|
|
30
|
+
→ UserMessage 检测到文档中存在 tag 节点
|
|
31
|
+
→ 用 MentionText 渲染(否则回退 TextContent)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
业务侧不保存 `docSchema` 时一切照旧:历史消息与第三方消息仍走 [TextContent](/components/rendering/text-content) 渲染纯文本。编辑消息后也需要把新的 `docSchema` 写回,否则改完这条消息标签就丢了。
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// 发送
|
|
38
|
+
const handleSendMessage = async (content: UserMessage['content'], docSchema: TagSchema) => {
|
|
39
|
+
messages.value.push({
|
|
40
|
+
id, messageId: id, role: MessageRole.User, content,
|
|
41
|
+
property: { docSchema },
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// 编辑确认
|
|
46
|
+
const handleUserInputConfirm = async (message: Message, content: UserMessage['content'], docSchema: TagSchema) => {
|
|
47
|
+
target.content = content;
|
|
48
|
+
target.property = { ...target.property, docSchema };
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 渲染示例
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
### Props
|
|
57
|
+
|
|
58
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
59
|
+
| ------ | ----------- | ---- | ------------------------------------------ |
|
|
60
|
+
| doc | `TagSchema` | ✅ | 发送时随消息一起保存的编辑器文档 |
|
|
61
|
+
|
|
62
|
+
### Emits / Slots / Expose
|
|
63
|
+
|
|
64
|
+
- 无。
|
|
65
|
+
|
|
66
|
+
### 文档结构
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
type TagSchema = Array<
|
|
70
|
+
Array<
|
|
71
|
+
| { type: 'text'; text: string }
|
|
72
|
+
| {
|
|
73
|
+
type: 'tag';
|
|
74
|
+
data: { label: string; value: string; type: string; icon: string; description: string };
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
>;
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
外层数组是行,内层数组是行内节点。渲染时第 2 行起前置一个 `<br>`。
|
|
81
|
+
|
|
82
|
+
## 关联组件
|
|
83
|
+
|
|
84
|
+
- [MentionTag](/components/rendering/mention-tag) — 单个标签渲染与气泡
|
|
85
|
+
- [UserMessage](/components/message/user-message) — 使用方
|
|
86
|
+
- [TextContent](/components/rendering/text-content) — 无文档时的回退渲染
|
|
@@ -543,7 +543,7 @@ AI 回复状态为 `error` 时,消息以错误样式展示:
|
|
|
543
543
|
|
|
544
544
|
`MessageContainer` 内部对 `copy` 工具操作进行了特殊处理:当 `tool.id === 'copy'` 时,自动将当前消息组中所有**非 reasoning 消息**的内容拼接后复制到剪贴板,**无需在 `onAgentAction` 中自行实现**。
|
|
545
545
|
|
|
546
|
-
其他工具操作(`like`、`unlike`、`
|
|
546
|
+
其他工具操作(`like`、`unlike`、`share` 等)仍正常转发给 `onAgentAction` 回调。
|
|
547
547
|
|
|
548
548
|
## 滚动控制
|
|
549
549
|
|
|
@@ -232,7 +232,7 @@ h(ContentRender, { content: message.content || '', status: message.status }, /*
|
|
|
232
232
|
|
|
233
233
|
## 与 MessageContainer / ChatContainer 配合
|
|
234
234
|
|
|
235
|
-
自定义 `ChatContainer` 的 `#message` 时,插槽参数只有 `message` / `messageToolsStatus` / `onInterruptResume
|
|
235
|
+
自定义 `ChatContainer` 的 `#message` 时,插槽参数只有 `message` / `messageToolsStatus` / `onInterruptResume`。用户消息工具相关回调需由外层自行绑定透传,否则删除/编辑/复制会失效(AI 消息工具栏在 `MessageContainer` 内渲染,不受 `#message` 影响):
|
|
236
236
|
|
|
237
237
|
```vue
|
|
238
238
|
<template>
|
|
@@ -30,7 +30,7 @@ AI 消息的操作工具栏组件,由**左侧消息工具区**和**右侧更
|
|
|
30
30
|
│ .ai-message-tools-container(display: flex,gap: 4px) │
|
|
31
31
|
│ ┌────────┐ ┌─────────────────────┐ │ ┌───────────────┐ ┌───────┐ │
|
|
32
32
|
│ │#prepend│ │ messageTools │ │ │ updateTools │ │#append│ │
|
|
33
|
-
│ │ │ │ copy
|
|
33
|
+
│ │ │ │ copy rebuild share │ │ │ like unlike… │ │ │ │
|
|
34
34
|
│ └────────┘ └─────────────────────┘ │ └───────────────┘ └───────┘ │
|
|
35
35
|
│ 插槽区 左侧区域 分隔线 右侧区域 插槽区 │
|
|
36
36
|
└───────────────────────────────────────────────────────────────────────┘
|
|
@@ -114,12 +114,23 @@ onAction 返回 string[](反馈选项列表)
|
|
|
114
114
|
```typescript
|
|
115
115
|
const CONST_MESSAGE_TOOLS = [
|
|
116
116
|
{ id: 'copy', name: '复制', description: '复制' },
|
|
117
|
-
{ id: '
|
|
118
|
-
{ id: 'rebuild', name: '重新生成', description: '重新生成' },
|
|
117
|
+
{ id: 'rebuild', name: '重新生成', description: '重新生成将清空下文内容' },
|
|
119
118
|
{ id: 'share', name: '分享', description: '分享' },
|
|
120
119
|
];
|
|
121
120
|
```
|
|
122
121
|
|
|
122
|
+
用户消息的内置列表(`CONST_USER_MESSAGE_TOOLS`,由 [UserMessage](/components/message/user-message) 使用):
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const CONST_USER_MESSAGE_TOOLS = [
|
|
126
|
+
{ id: 'copy', name: '复制', description: '复制' },
|
|
127
|
+
{ id: 'edit', name: '编辑', description: '编辑' },
|
|
128
|
+
{ id: 'delete', name: '删除', description: '删除' },
|
|
129
|
+
];
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> `cite`(引用)已从两份内置列表中移除,后续不再支持;`ToolBtn` 仍保留该 id 的图标,业务侧可自行把它作为自定义按钮传入。
|
|
133
|
+
|
|
123
134
|
### updateTools(右侧)
|
|
124
135
|
|
|
125
136
|
```typescript
|
|
@@ -139,7 +150,7 @@ const CONST_UPDATE_TOOLS = [
|
|
|
139
150
|
| ID | 图标说明 |
|
|
140
151
|
| -------------- | ------------------------------------ |
|
|
141
152
|
| `copy` | 复制 |
|
|
142
|
-
| `cite` |
|
|
153
|
+
| `cite` | 引用(不再属于内置列表,可用于自定义按钮) |
|
|
143
154
|
| `rebuild` | 重新生成 |
|
|
144
155
|
| `share` | 分享 |
|
|
145
156
|
| `like` | 点赞(空心) |
|
|
@@ -131,7 +131,7 @@ interface IModelOption {
|
|
|
131
131
|
base_model?: string;
|
|
132
132
|
description?: string; // 选项 hover 的 title 提示
|
|
133
133
|
disabled?: boolean; // 前端扩展字段,禁用项不可选中
|
|
134
|
-
icon?: string;
|
|
134
|
+
icon?: Component | string; // 图标 URL 或 Vue 组件,由 ResourceIcon 渲染
|
|
135
135
|
id: number;
|
|
136
136
|
llm_code: string;
|
|
137
137
|
llm_name: string; // 展示名,同时作为选中值
|
|
@@ -150,8 +150,10 @@ interface IModelOption {
|
|
|
150
150
|
2. 选中值为模型的 `llm_name`;能力标签由组件依据 `property` 的 `support_thinking` / `support_thinking_quick` / `support_vision` 派生,文案走内置 i18n。
|
|
151
151
|
3. `description` 会作为选项 hover 的 `title` 提示展示。
|
|
152
152
|
4. 展开面板后会自动聚焦搜索框;列表支持键盘上下选择与 Enter 确认(复用 `useMenuKeydown`)。
|
|
153
|
+
5. 图标由 [ResourceIcon](/components/helper/resource-icon) 渲染(`type="model"`):支持图片 URL 或 Vue 组件,URL 加载失败自动回退到内置兜底图标;未提供 `icon` 时不渲染图标位。
|
|
153
154
|
|
|
154
155
|
## 关联组件
|
|
155
156
|
|
|
156
157
|
- [ChatInput](/components/input/chat-input):传入 `models` 后默认在发送按钮左侧渲染本组件,也可通过 `#model-selector` 插槽完全自定义。
|
|
157
|
-
- [ChatContainer](/components/setup/chat-container):透传 `models` 与 `v-model:selected-model`,并向上 emit `modelChange`。
|
|
158
|
+
- [ChatContainer](/components/setup/chat-container):透传 `models` 与 `v-model:selected-model`,并向上 emit `modelChange`。
|
|
159
|
+
- [ResourceIcon](/components/helper/resource-icon):触发器与选项的图标渲染。
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
v-overflow-tips 在元素水平溢出(scrollWidth > clientWidth)时于 mouseenter 懒创建 Tippy,展示完整文本或自定义 text/content。 结合 IntersectionObserver 仅在可见时绑定悬停;隐藏时销毁实例。指令值为 Partial<TippyProps> 与 disabled 等。 DescPanel、ExecutionSummary、ToolcallRender、
|
|
4
|
+
v-overflow-tips 在元素水平溢出(scrollWidth > clientWidth)时于 mouseenter 懒创建 Tippy,展示完整文本或自定义 text/content。 结合 IntersectionObserver 仅在可见时绑定悬停;隐藏时销毁实例。指令值为 Partial<TippyProps> 与 disabled 等。 DescPanel、ExecutionSummary、ToolcallRender、InputMenuPanel 等用于标题或列表溢出提示。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **desc-panel** — 工具描述面板溢出
|
|
8
8
|
- **execution-summary** — 执行摘要标签溢出
|
|
9
9
|
- **toolcall-render** — 工具标题行溢出
|
|
10
|
-
- **
|
|
10
|
+
- **input-menu-panel** — 菜单条目名称溢出
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
<!-- FULL DOC -->
|
|
@@ -206,4 +206,4 @@ type OverflowTipsValue = Partial<TippyProps> & {
|
|
|
206
206
|
- [DescPanel](../components/rendering/desc-panel) — 描述区溢出
|
|
207
207
|
- [ExecutionSummary](../components/agent/execution-summary) — 侧栏摘要标签
|
|
208
208
|
- [ToolcallRender](../components/agent/toolcall-render) — 工具调用标题
|
|
209
|
-
- [
|
|
209
|
+
- [InputMenuPanel](../components/input/input-menu-panel) — 菜单条目名称溢出
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!-- AI SUMMARY -->
|
|
2
|
+
## 快速了解
|
|
3
|
+
|
|
4
|
+
ResourceIcon 统一渲染资源图标:icon 为字符串按 img 加载(加载失败回退内置图标)、 为 Vue 组件直接渲染、缺省时按 type 查内置图标表(artifact 交给 FileIcon 按文件名后缀推导, 未登记类型回退 ModuleIcon);尺寸由 --ai-icon-size 控制,默认 16px。 源码位置:src/components/resource-icon/resource-icon.vue。
|
|
5
|
+
|
|
6
|
+
### 关联组件
|
|
7
|
+
- **input-menu-panel** — 菜单条目左侧图标
|
|
8
|
+
- **mention-tag** — 输入框与消息中的资源标签图标
|
|
9
|
+
- **model-selector** — 模型选择器的触发器与选项图标
|
|
10
|
+
- **file-icon** — artifact 类型委托给 FileIcon 按后缀推导
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
<!-- FULL DOC -->
|
|
14
|
+
|
|
15
|
+
# ResourceIcon 资源图标
|
|
16
|
+
|
|
17
|
+
> **能力域**:辅助能力
|
|
18
|
+
|
|
19
|
+
## 源码事实
|
|
20
|
+
|
|
21
|
+
- **源码位置**:`src/components/resource-icon/resource-icon.vue`
|
|
22
|
+
- **内置图标表**:`file` → `FileUploadIcon`、`mcp` → `McpIcon`、`tool` → `ToolIcon`、`knowledgebase` / `doc` → `KnowledgeBaseIcon`、`prompt` → `PromptIcon`
|
|
23
|
+
- **特殊分支**:`artifact` 走 [FileIcon](/components/helper/file-icon) 按 `name` 的文件后缀推导
|
|
24
|
+
- **最终兜底**:以上都不命中时渲染 `ModuleIcon`(田字格)
|
|
25
|
+
|
|
26
|
+
## 渲染优先级
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
icon 有值?
|
|
30
|
+
├── 字符串 → <img :src="icon">
|
|
31
|
+
│ └── onerror → 降级到「按 type 兜底」
|
|
32
|
+
└── Vue 组件 → <component :is="icon">
|
|
33
|
+
icon 缺省
|
|
34
|
+
├── type === 'artifact' → FileIcon(按 name 后缀)
|
|
35
|
+
├── type 命中内置图标表 → 对应内置图标
|
|
36
|
+
└── 其他 → ModuleIcon
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`icon` 变化时会重置失效标记,换成新的 URL 会重新尝试加载。
|
|
40
|
+
|
|
41
|
+
::: info 内部组件
|
|
42
|
+
本组件不在包入口导出,由菜单、标签与模型选择器内部使用。内置图标(`McpIcon` / `ToolIcon` / `KnowledgeBaseIcon` / `PromptIcon` / `ModuleIcon` / `FileUploadIcon` / `ImageUploadIcon`)从包入口导出,可单独使用,见 [Icons 图标](/icons/)。
|
|
43
|
+
:::
|
|
44
|
+
|
|
45
|
+
## 用法
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<template>
|
|
49
|
+
<!-- 远程图标 -->
|
|
50
|
+
<ResourceIcon icon="https://example.com/tool.png" name="天气查询" type="tool" />
|
|
51
|
+
<!-- Vue 组件图标 -->
|
|
52
|
+
<ResourceIcon :icon="McpIcon" name="database-server" type="mcp" />
|
|
53
|
+
<!-- 按类型兜底 -->
|
|
54
|
+
<ResourceIcon name="API 接口文档" type="knowledgebase" />
|
|
55
|
+
<ResourceIcon name="写文章" type="prompt" />
|
|
56
|
+
<!-- 会话产物按后缀推导 -->
|
|
57
|
+
<ResourceIcon name="巡检报告.pdf" type="artifact" />
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { McpIcon } from '@blueking/chat-x';
|
|
62
|
+
</script>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**渲染效果**(均未传 `icon`,展示按类型兜底的结果)
|
|
66
|
+
|
|
67
|
+
## 控制尺寸
|
|
68
|
+
|
|
69
|
+
容器宽高与 `font-size` 都取 `var(--ai-icon-size, 16px)`,图片以 `object-fit: contain` 填充并带 2px 圆角。需要改尺寸时覆盖该变量,不要直接改 svg:
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<span style="--ai-icon-size: 24px">
|
|
74
|
+
<ResourceIcon name="巡检报告.pdf" type="artifact" />
|
|
75
|
+
</span>
|
|
76
|
+
</template>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## API
|
|
80
|
+
|
|
81
|
+
### Props
|
|
82
|
+
|
|
83
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
84
|
+
| ------ | ----------------------- | ---- | -------------------------------------------------------- |
|
|
85
|
+
| icon | `Component \| string` | - | 图标 URL 或 Vue 组件;缺省时按 `type` 回退 |
|
|
86
|
+
| name | `string` | ✅ | 资源名称;`type` 为 `artifact` 时据此推导文件类型图标 |
|
|
87
|
+
| type | `string` | ✅ | 资源类型,决定兜底图标 |
|
|
88
|
+
|
|
89
|
+
### Emits / Slots / Expose
|
|
90
|
+
|
|
91
|
+
- 无。
|
|
92
|
+
|
|
93
|
+
## 扩展新类型
|
|
94
|
+
|
|
95
|
+
新增类型只需在组件内的 `TYPE_FALLBACK_ICONS` 表里补一行,不必往模板加分支。`model` 等未登记的类型会落到 `ModuleIcon`,因此 [ModelSelector](/components/input/model-selector) 在模型没有 `icon` 时不会缺图。
|
|
96
|
+
|
|
97
|
+
## 关联组件
|
|
98
|
+
|
|
99
|
+
- [InputMenuPanel](/components/input/input-menu-panel) — 菜单条目图标
|
|
100
|
+
- [MentionTag](/components/rendering/mention-tag) — 资源标签图标
|
|
101
|
+
- [ModelSelector](/components/input/model-selector) — 模型图标
|
|
102
|
+
- [FileIcon](/components/helper/file-icon) — `artifact` 类型的实际渲染者
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **markdown-content** — 需要富文本时的替代方案
|
|
8
8
|
- **user-message** — 用户消息中纯文本内容展示
|
|
9
|
+
- **mention-text** — 文档含资源标签时的替代渲染
|
|
9
10
|
|
|
10
11
|
---
|
|
11
12
|
<!-- FULL DOC -->
|
|
@@ -29,11 +30,12 @@ div.ai-text-content
|
|
|
29
30
|
padding: 8px 12px; border-radius: 4px
|
|
30
31
|
background-color: #e1ecff(浅蓝色气泡)
|
|
31
32
|
word-break: break-all(无空格长文本按字符换行)
|
|
33
|
+
white-space: pre-wrap(保留 \n 换行与连续空格)
|
|
32
34
|
│
|
|
33
35
|
└── {{ content }}(文本插值,HTML 标签不被解析)
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
>
|
|
38
|
+
> **换行说明**:内容来自输入框,多行文本以 `\n` 承载,因此组件带 `white-space: pre-wrap`——`\n` 会渲染为视觉换行,连续空格与空行也会保留,无需在外层额外加样式。
|
|
37
39
|
|
|
38
40
|
## 基础用法
|
|
39
41
|
|
|
@@ -47,9 +49,9 @@ div.ai-text-content
|
|
|
47
49
|
</script>
|
|
48
50
|
```
|
|
49
51
|
|
|
50
|
-
##
|
|
52
|
+
## 长文本与多行
|
|
51
53
|
|
|
52
|
-
`word-break: break-all` 确保无空格的长字符串(如 URL
|
|
54
|
+
`word-break: break-all` 确保无空格的长字符串(如 URL、哈希值)也能在容器内正常换行;`white-space: pre-wrap` 让 `\n` 直接生效:
|
|
53
55
|
|
|
54
56
|
## XSS 安全
|
|
55
57
|
|
|
@@ -70,10 +72,12 @@ div.ai-text-content
|
|
|
70
72
|
| 场景 | 推荐组件 |
|
|
71
73
|
| --------------------------------- | ----------------- |
|
|
72
74
|
| 纯文本气泡(用户消息、简单提示) | `TextContent` |
|
|
75
|
+
| 含 `@` 资源标签的用户消息 | `MentionText` |
|
|
73
76
|
| 含 Markdown / 代码块 / 公式的内容 | `MarkdownContent` |
|
|
74
77
|
| 工具调用结果描述 | `DescPanel` |
|
|
75
78
|
|
|
76
79
|
## 关联组件
|
|
77
80
|
|
|
78
81
|
- [MarkdownContent](/components/rendering/markdown-content) — 富文本替代
|
|
82
|
+
- [MentionText](/components/rendering/mention-text) — 含资源标签文档的渲染
|
|
79
83
|
- [UserMessage](/components/message/user-message) — 用户消息气泡
|
|
@@ -73,56 +73,48 @@ import { ChatInput, MessageContainer } from '@blueking/chat-x';
|
|
|
73
73
|
|
|
74
74
|
## SCSS 变量
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
组件库在 `src/styles/variables.scss` 中定义了以下 SCSS 变量(构建期生效,仅供库内组件 `@use` 复用;消费方无法在运行时覆盖,需要改色请用 CSS 变量或类名覆盖):
|
|
77
77
|
|
|
78
78
|
### 尺寸变量
|
|
79
79
|
|
|
80
80
|
```scss
|
|
81
|
-
//
|
|
82
|
-
$chat-input-min-width:
|
|
83
|
-
$chat-input-max-width:
|
|
81
|
+
// 输入框宽度(.chat-input-wrapper)
|
|
82
|
+
$chat-input-min-width: 168px;
|
|
83
|
+
$chat-input-max-width: 1000px;
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
###
|
|
86
|
+
### 语义色变量
|
|
87
87
|
|
|
88
88
|
```scss
|
|
89
|
-
//
|
|
90
|
-
$
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
$
|
|
94
|
-
$
|
|
95
|
-
$
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
$bg-
|
|
99
|
-
$
|
|
100
|
-
$bg-color-hover: #f0f1f5;
|
|
101
|
-
|
|
102
|
-
// 边框色
|
|
103
|
-
$border-color: #dcdee5;
|
|
104
|
-
$border-color-hover: #c4c6cc;
|
|
89
|
+
$color-title: #313238; // 标题 / 主文字
|
|
90
|
+
$color-text: #4d4f56; // 常规文字
|
|
91
|
+
$color-text-secondary: #979ba5; // 次要文字 / 占位
|
|
92
|
+
$color-primary: #3a84ff; // 主题色
|
|
93
|
+
$color-border: #dcdee5; // 边框
|
|
94
|
+
$color-border-light: #eaebf0; // 浅边框 / 线条中
|
|
95
|
+
$color-bg-light: #fafbfd; // 浅背景
|
|
96
|
+
$color-bg-tab: #f0f1f5; // 分段控件 / tab 背景
|
|
97
|
+
$color-bg-hover: #f5f7fa; // 列表 / 卡片 hover 背景
|
|
98
|
+
$color-bg-selected: #e1ecff; // 选中态背景(背景蓝)
|
|
99
|
+
$content-loading-icon-color-list: (#cddffe, #699df4, #1768ef); // 内容加载动画三色
|
|
105
100
|
```
|
|
106
101
|
|
|
107
|
-
|
|
102
|
+
> 旧版用于 `@` 资源标签配色的 `$resourceTypeMap`(tool / skill / shortcut / doc / knowledgebase / mcp 六组配色)随输入区重构一并移除——现在资源标签统一为「图标 + 主题蓝文字」,不再按类型分配底色,详见 [MentionTag](/components/rendering/mention-tag)。
|
|
108
103
|
|
|
109
|
-
|
|
104
|
+
> 其余色值(如 hover 边框 `#c4c6cc`)目前直接写在各组件样式中,未抽为变量。
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
// 基础 z-index
|
|
113
|
-
$chat-z-index: 9999;
|
|
114
|
-
|
|
115
|
-
// 编辑器 z-index
|
|
116
|
-
$editor-z-index: $chat-z-index + 1;
|
|
106
|
+
### Z-Index 分层
|
|
117
107
|
|
|
118
|
-
|
|
119
|
-
$editor-menu-z-index: $editor-z-index + 1;
|
|
108
|
+
层级由 TS 常量维护(`src/common/constants.ts`),从包入口导出,组件通过 inline style 写成 CSS 变量下发:
|
|
120
109
|
|
|
121
|
-
|
|
122
|
-
|
|
110
|
+
```typescript
|
|
111
|
+
import { CHAT_Z_INDEX, EDITOR_MENU_Z_INDEX, SELECTION_Z_INDEX } from '@blueking/chat-x';
|
|
123
112
|
|
|
124
|
-
//
|
|
125
|
-
|
|
113
|
+
CHAT_Z_INDEX; // 9999 对话主层
|
|
114
|
+
EDITOR_Z_INDEX; // 10000 编辑器
|
|
115
|
+
EDITOR_MENU_Z_INDEX; // 10001 编辑器菜单 / 资源标签气泡
|
|
116
|
+
SHORTCUT_MENU_Z_INDEX; // 10002 快捷指令菜单
|
|
117
|
+
SELECTION_Z_INDEX; // 10003 划词浮窗
|
|
126
118
|
```
|
|
127
119
|
|
|
128
120
|
## CSS 类覆盖
|
|
@@ -163,7 +163,7 @@ const onArtifactClick = async (file: AIFileInfo) => {
|
|
|
163
163
|
| ------------------- | ----------------------------------------- | -------------------------------------------------------------------- |
|
|
164
164
|
| activeArtifactId | `ShallowRef<string>` | 当前命中的文件 `outputId` |
|
|
165
165
|
| canResolveArtifactUrl | `ComputedRef<boolean>` | 是否具备异步取链能力(有 `onArtifactClick` 时为 true,下载按钮据此显隐) |
|
|
166
|
-
| openPreview | `(payload: OpenArtifactPreviewPayload) => void` |
|
|
166
|
+
| openPreview | `(payload: OpenArtifactPreviewPayload) => void` | 由文件卡片或 `artifact` 资源标签触发:以 `file.outputId` 更新命中态、调用 `onOpen`;入参只需 `{ file: { outputId } }` |
|
|
167
167
|
| resolveArtifactUrls | `(file: AIFileInfo) => Promise<ArtifactUrlResult>` | 调用 `onArtifactClick` 取链;每次重新获取,不缓存;同文件并发去重 |
|
|
168
168
|
| setActiveArtifactId | `(id: string) => void` | 直接设置命中文件 `outputId`;侧栏列表内切换选中时使用 |
|
|
169
169
|
|
|
@@ -172,9 +172,13 @@ const onArtifactClick = async (file: AIFileInfo) => {
|
|
|
172
172
|
```typescript
|
|
173
173
|
import type { AIFileInfo, ArtifactUrlResult, OnArtifactClick } from '@blueking/chat-x';
|
|
174
174
|
|
|
175
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* 打开预览时的入参。
|
|
177
|
+
* 命中逻辑只依赖 outputId,因此不要求完整的 AIFileInfo——
|
|
178
|
+
* 输入框内的 @ 文件标签只持有 id 与名称,无需为了调用而伪造 size / type。
|
|
179
|
+
*/
|
|
176
180
|
type OpenArtifactPreviewPayload = {
|
|
177
|
-
file: AIFileInfo
|
|
181
|
+
file: Pick<AIFileInfo, 'outputId'>;
|
|
178
182
|
};
|
|
179
183
|
|
|
180
184
|
/**
|
|
@@ -54,7 +54,7 @@ import { watch } from 'vue';
|
|
|
54
54
|
const { commandSelection, GetCursorPosition, GetDocSnapshot, docSnapshot } = useCommandSelection();
|
|
55
55
|
|
|
56
56
|
// 用户从 @xxx 菜单中选择资源时:
|
|
57
|
-
const insertTagAtCursor = (tag:
|
|
57
|
+
const insertTagAtCursor = (tag: IInputMenuItem) => {
|
|
58
58
|
editor.command(GetCursorPosition);
|
|
59
59
|
const { column, line } = commandSelection.value;
|
|
60
60
|
editor.command(DeleteTag, [line, column - keyword.value.length - 1], [line, column]);
|
|
@@ -38,7 +38,8 @@ useContainerScrollProvider(containerRef, bottomRef)
|
|
|
38
38
|
├── jumpToBottom() → autoScrollEnabled=true + container.scrollTop = scrollHeight(瞬时)
|
|
39
39
|
├── toScrollBottom(behavior?) → autoScrollEnabled=true;
|
|
40
40
|
│ behavior 缺省时:距底部 > INSTANT_SCROLL_DISTANCE(600) → jumpToBottom()
|
|
41
|
-
│ 否则 / 显式 'smooth' →
|
|
41
|
+
│ 否则 / 显式 'smooth' → container.scrollTo({ top: scrollHeight, behavior:'smooth' })
|
|
42
|
+
│ (只滚消息容器,不用 scrollIntoView,避免带动 window)
|
|
42
43
|
├── toScrollTop() → containerRef.scrollTo({ top:0, behavior:'smooth' })
|
|
43
44
|
│
|
|
44
45
|
└── provide(CONTAINER_SCROLL_TOKEN, computed(() => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
useFlowNodeActions 接收 onInterruptResume 与 openNodeDetail,返回 getNodeActions 与 isNodePending。 失败节点按 retryable/skippable 展示重试/跳过,详情恒在末尾;点击后进入 pending 防重复提交, 以 task_id:node_id:retry 为键自动收敛;点击 resume 时不传 interrupt。
|
|
4
|
+
useFlowNodeActions 接收 onInterruptResume 与 openNodeDetail,返回 getNodeActions 与 isNodePending。 失败节点按 retryable/skippable 展示重试/跳过,详情恒在末尾;点击后进入 pending 防重复提交, 以 task_id:node_id:retry 为键自动收敛;点击 resume 时不传 interrupt。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **flow-agent-content** — FlowAgentContent 内部消费,驱动节点行尾按钮组渲染
|
|
@@ -21,7 +21,7 @@ useFlowNodeActions 接收 onInterruptResume 与 openNodeDetail,返回 getNodeA
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
function useFlowNodeActions(options: {
|
|
24
|
-
/** 隐藏重试 / 跳过等交互式 resume
|
|
24
|
+
/** 隐藏重试 / 跳过等交互式 resume 操作(分享态只读,仅保留「详情」查看入口) */
|
|
25
25
|
hideResumeActions?: Ref<boolean>;
|
|
26
26
|
/** resume 回调(与第三方审批取消同一回调,按 payload.operation 分流) */
|
|
27
27
|
onInterruptResume: Ref<OnInterruptResume | undefined>;
|
|
@@ -71,16 +71,13 @@ interface FlowNodeActionVM {
|
|
|
71
71
|
|
|
72
72
|
| 操作 | `id` | 显隐条件 | 点击行为 |
|
|
73
73
|
| ---- | ------------------ | ------------------------------------------ | --------------------------------------------- |
|
|
74
|
-
| 重试 | `flow_node_retry` | `convergedState === 'failed'` 且 `retryable
|
|
75
|
-
| 跳过 | `flow_node_skip` | `convergedState === 'failed'` 且 `skippable
|
|
76
|
-
| 详情 | `detail` |
|
|
74
|
+
| 重试 | `flow_node_retry` | `convergedState === 'failed'` 且 `retryable` | 调用 `onInterruptResume`,**不传** `interrupt` |
|
|
75
|
+
| 跳过 | `flow_node_skip` | `convergedState === 'failed'` 且 `skippable` | 同上 |
|
|
76
|
+
| 详情 | `detail` | 始终(含 Share 分享态) | 调用 `openNodeDetail(task.raw, node.raw)` |
|
|
77
77
|
|
|
78
78
|
展示顺序:重试 → 跳过 → 详情。
|
|
79
79
|
|
|
80
|
-
>
|
|
81
|
-
>
|
|
82
|
-
> - `RenderMode.Share` 分享态
|
|
83
|
-
> - 侧栏「执行情况」面板内(`ExecutionSummary` 通过 `EXECUTION_PANEL_TOKEN` 提供上下文,组件用 `useExecutionPanelInject` 读取)
|
|
80
|
+
> **分享态过滤**:传入 `hideResumeActions`(`Ref<boolean>`,如 `RenderMode.Share`)为 `true` 时,`getNodeActions` 直接过滤掉重试 / 跳过,仅返回「详情」查看入口;用于只读分享场景放开查看、禁止交互。
|
|
84
81
|
|
|
85
82
|
## pending 态与防重复提交
|
|
86
83
|
|
|
@@ -118,13 +115,9 @@ import { toRef } from 'vue';
|
|
|
118
115
|
import { useFlowNodeActions } from '@blueking/chat-x';
|
|
119
116
|
// 或相对路径:'./use-flow-node-actions'
|
|
120
117
|
|
|
121
|
-
// 是否处于侧栏「执行情况」面板内;缺省 false,即对话流内渲染
|
|
122
|
-
// useExecutionPanelInject 来自内部 src/composables/use-common.ts,未从包入口导出
|
|
123
|
-
const isInExecutionPanel = useExecutionPanelInject();
|
|
124
|
-
|
|
125
118
|
const { getNodeActions, isNodePending } = useFlowNodeActions({
|
|
126
|
-
//
|
|
127
|
-
hideResumeActions: computed(() => renderMode.value === RenderMode.Share
|
|
119
|
+
// 分享态只读:过滤重试 / 跳过,仅保留详情
|
|
120
|
+
hideResumeActions: computed(() => renderMode.value === RenderMode.Share),
|
|
128
121
|
onInterruptResume: toRef(props, 'onInterruptResume'),
|
|
129
122
|
openNodeDetail,
|
|
130
123
|
});
|