@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.
Files changed (198) hide show
  1. package/README.md +15 -8
  2. package/dist/ag-ui/types/contents.d.ts +2 -0
  3. package/dist/ag-ui/types/messages.d.ts +6 -1
  4. package/dist/common/constants.d.ts +2 -0
  5. package/dist/components/ai-buttons/add-menu-btn/add-menu-btn.vue.d.ts +24 -0
  6. package/dist/components/chat-content/collapsible-content/collapsible-content.vue.d.ts +28 -0
  7. package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +5 -2
  8. package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +1 -0
  9. package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +1 -1
  10. package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +21 -10
  11. package/dist/components/chat-input/ai-slash-input/command.d.ts +6 -3
  12. package/dist/components/chat-input/ai-slash-input/constants.d.ts +2 -0
  13. package/dist/components/chat-input/ai-slash-input/use-menu-trigger.d.ts +17 -0
  14. package/dist/components/chat-input/build-default-placeholder.d.ts +9 -3
  15. package/dist/components/chat-input/chat-input.vue.d.ts +30 -18
  16. package/dist/components/chat-input/input-menu/constants.d.ts +60 -0
  17. package/dist/components/chat-input/input-menu/index.d.ts +4 -0
  18. package/dist/components/chat-input/input-menu/input-menu-option.vue.d.ts +14 -0
  19. package/dist/components/chat-input/input-menu/input-menu-panel.vue.d.ts +17 -0
  20. package/dist/components/chat-input/input-menu/use-input-menu.d.ts +22 -0
  21. package/dist/components/chat-input/model-selector/types.d.ts +3 -2
  22. package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -1
  23. package/dist/components/chat-message/user-message/user-message.vue.d.ts +1 -1
  24. package/dist/components/mention/create-mention-tippy.d.ts +27 -0
  25. package/dist/components/mention/index.d.ts +4 -0
  26. 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
  27. 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
  28. 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
  29. package/dist/components/resource-icon/index.d.ts +1 -0
  30. package/dist/components/resource-icon/resource-icon.vue.d.ts +11 -0
  31. package/dist/composables/index.d.ts +1 -0
  32. package/dist/composables/use-artifact-preview.d.ts +5 -2
  33. package/dist/composables/use-common.d.ts +0 -9
  34. package/dist/composables/use-global-config.d.ts +4 -0
  35. package/dist/composables/use-input-mention.d.ts +13 -0
  36. package/dist/composables/use-message-group.d.ts +1011 -72
  37. package/dist/icons/index.d.ts +1 -0
  38. package/dist/icons/input.d.ts +21 -0
  39. package/dist/icons/menu-item.d.ts +22 -0
  40. package/dist/index.css +1 -1
  41. package/dist/index.js +4953 -4429
  42. package/dist/index.js.map +1 -1
  43. package/dist/lang/lang.d.ts +13 -3
  44. package/dist/mcp/generated/docs/activity-message.md +3 -3
  45. package/dist/mcp/generated/docs/add-menu-btn.md +91 -0
  46. package/dist/mcp/generated/docs/ai-slash-input.md +72 -26
  47. package/dist/mcp/generated/docs/assistant-message.md +7 -1
  48. package/dist/mcp/generated/docs/chat-container.md +45 -6
  49. package/dist/mcp/generated/docs/chat-input.md +327 -483
  50. package/dist/mcp/generated/docs/collapsible-content.md +78 -0
  51. package/dist/mcp/generated/docs/constants.md +36 -3
  52. package/dist/mcp/generated/docs/execution-summary.md +1 -23
  53. package/dist/mcp/generated/docs/file-artifact-panel.md +24 -5
  54. package/dist/mcp/generated/docs/file-content.md +4 -0
  55. package/dist/mcp/generated/docs/file-upload-btn.md +15 -12
  56. package/dist/mcp/generated/docs/flow-agent-content.md +10 -12
  57. package/dist/mcp/generated/docs/input-menu-panel.md +166 -0
  58. package/dist/mcp/generated/docs/mention-tag.md +83 -0
  59. package/dist/mcp/generated/docs/mention-text.md +86 -0
  60. package/dist/mcp/generated/docs/message-container.md +1 -1
  61. package/dist/mcp/generated/docs/message-render.md +1 -1
  62. package/dist/mcp/generated/docs/message-tools.md +15 -4
  63. package/dist/mcp/generated/docs/messages.md +3 -0
  64. package/dist/mcp/generated/docs/model-selector.md +4 -2
  65. package/dist/mcp/generated/docs/overflow-tips.md +3 -3
  66. package/dist/mcp/generated/docs/resource-icon.md +102 -0
  67. package/dist/mcp/generated/docs/text-content.md +7 -3
  68. package/dist/mcp/generated/docs/theme.md +27 -35
  69. package/dist/mcp/generated/docs/use-artifact-preview.md +7 -3
  70. package/dist/mcp/generated/docs/use-command-selection.md +1 -1
  71. package/dist/mcp/generated/docs/use-container-scroll.md +2 -1
  72. package/dist/mcp/generated/docs/use-flow-node-actions.md +8 -15
  73. package/dist/mcp/generated/docs/use-global-config.md +11 -4
  74. package/dist/mcp/generated/docs/use-input-mention.md +119 -0
  75. package/dist/mcp/generated/docs/use-menu-keydown.md +15 -16
  76. package/dist/mcp/generated/docs/use-message-group.md +3 -6
  77. package/dist/mcp/generated/docs/user-message.md +39 -17
  78. package/dist/mcp/generated/index.json +233 -81
  79. package/dist/types/editor.d.ts +0 -29
  80. package/dist/types/index.d.ts +1 -0
  81. package/dist/types/input-menu.d.ts +46 -0
  82. package/dist/utils/artifact-tags.d.ts +36 -0
  83. package/dist/utils/collect-message-artifacts.d.ts +14 -0
  84. package/dist/utils/file.d.ts +3 -3
  85. package/dist/utils/index.d.ts +2 -1
  86. package/dist/utils/upload-file.d.ts +6 -1
  87. package/package.json +3 -2
  88. package/skills/blueking-chat-x/SKILL.md +143 -0
  89. package/skills/blueking-chat-x/references/_index.md +153 -0
  90. package/skills/blueking-chat-x/references/components/activity-layout.md +134 -0
  91. package/skills/blueking-chat-x/references/components/activity-message.md +486 -0
  92. package/skills/blueking-chat-x/references/components/add-menu-btn.md +88 -0
  93. package/skills/blueking-chat-x/references/components/ai-image.md +230 -0
  94. package/skills/blueking-chat-x/references/components/ai-loading.md +131 -0
  95. package/skills/blueking-chat-x/references/components/ai-selection.md +439 -0
  96. package/skills/blueking-chat-x/references/components/ai-slash-input.md +102 -0
  97. package/skills/blueking-chat-x/references/components/animation-text.md +202 -0
  98. package/skills/blueking-chat-x/references/components/assistant-message.md +504 -0
  99. package/skills/blueking-chat-x/references/components/chat-container.md +912 -0
  100. package/skills/blueking-chat-x/references/components/chat-input.md +614 -0
  101. package/skills/blueking-chat-x/references/components/cite-content.md +142 -0
  102. package/skills/blueking-chat-x/references/components/code-content.md +211 -0
  103. package/skills/blueking-chat-x/references/components/collapsible-content.md +76 -0
  104. package/skills/blueking-chat-x/references/components/common-error-content.md +73 -0
  105. package/skills/blueking-chat-x/references/components/content-render.md +233 -0
  106. package/skills/blueking-chat-x/references/components/delete-tool.md +191 -0
  107. package/skills/blueking-chat-x/references/components/desc-panel.md +162 -0
  108. package/skills/blueking-chat-x/references/components/detail-section.md +91 -0
  109. package/skills/blueking-chat-x/references/components/execution-summary.md +150 -0
  110. package/skills/blueking-chat-x/references/components/file-artifact-panel.md +307 -0
  111. package/skills/blueking-chat-x/references/components/file-content.md +340 -0
  112. package/skills/blueking-chat-x/references/components/file-icon.md +109 -0
  113. package/skills/blueking-chat-x/references/components/file-upload-btn.md +162 -0
  114. package/skills/blueking-chat-x/references/components/flow-agent-content.md +266 -0
  115. package/skills/blueking-chat-x/references/components/flow-agent-node-detail.md +236 -0
  116. package/skills/blueking-chat-x/references/components/highlight-keyword.md +146 -0
  117. package/skills/blueking-chat-x/references/components/image-content.md +182 -0
  118. package/skills/blueking-chat-x/references/components/image-preview-group.md +184 -0
  119. package/skills/blueking-chat-x/references/components/image-preview.md +226 -0
  120. package/skills/blueking-chat-x/references/components/info-message.md +144 -0
  121. package/skills/blueking-chat-x/references/components/input-attachment.md +49 -0
  122. package/skills/blueking-chat-x/references/components/input-info-alert.md +42 -0
  123. package/skills/blueking-chat-x/references/components/input-menu-panel.md +162 -0
  124. package/skills/blueking-chat-x/references/components/interrupt-message.md +212 -0
  125. package/skills/blueking-chat-x/references/components/key-value-content.md +128 -0
  126. package/skills/blueking-chat-x/references/components/knowledge-rag-content.md +122 -0
  127. package/skills/blueking-chat-x/references/components/latex-content.md +200 -0
  128. package/skills/blueking-chat-x/references/components/loading-message.md +192 -0
  129. package/skills/blueking-chat-x/references/components/markdown-content.md +232 -0
  130. package/skills/blueking-chat-x/references/components/mention-tag.md +79 -0
  131. package/skills/blueking-chat-x/references/components/mention-text.md +83 -0
  132. package/skills/blueking-chat-x/references/components/mermaid-content.md +189 -0
  133. package/skills/blueking-chat-x/references/components/message-container.md +645 -0
  134. package/skills/blueking-chat-x/references/components/message-loading.md +118 -0
  135. package/skills/blueking-chat-x/references/components/message-render.md +327 -0
  136. package/skills/blueking-chat-x/references/components/message-time.md +177 -0
  137. package/skills/blueking-chat-x/references/components/message-tools.md +427 -0
  138. package/skills/blueking-chat-x/references/components/model-selector.md +157 -0
  139. package/skills/blueking-chat-x/references/components/preview-toolbar.md +42 -0
  140. package/skills/blueking-chat-x/references/components/questions-container.md +85 -0
  141. package/skills/blueking-chat-x/references/components/reasoning-message.md +232 -0
  142. package/skills/blueking-chat-x/references/components/reference-content.md +135 -0
  143. package/skills/blueking-chat-x/references/components/reference-doc-content.md +109 -0
  144. package/skills/blueking-chat-x/references/components/resource-icon.md +98 -0
  145. package/skills/blueking-chat-x/references/components/scroll-btn.md +159 -0
  146. package/skills/blueking-chat-x/references/components/selection-footer.md +78 -0
  147. package/skills/blueking-chat-x/references/components/selection-question.md +88 -0
  148. package/skills/blueking-chat-x/references/components/shortcut-btn.md +204 -0
  149. package/skills/blueking-chat-x/references/components/shortcut-btns.md +266 -0
  150. package/skills/blueking-chat-x/references/components/shortcut-render.md +424 -0
  151. package/skills/blueking-chat-x/references/components/simple-table.md +101 -0
  152. package/skills/blueking-chat-x/references/components/text-content.md +80 -0
  153. package/skills/blueking-chat-x/references/components/tool-approval-card.md +183 -0
  154. package/skills/blueking-chat-x/references/components/tool-btn.md +317 -0
  155. package/skills/blueking-chat-x/references/components/tool-message.md +235 -0
  156. package/skills/blueking-chat-x/references/components/toolcall-render.md +348 -0
  157. package/skills/blueking-chat-x/references/components/user-feedback.md +233 -0
  158. package/skills/blueking-chat-x/references/components/user-message.md +444 -0
  159. package/skills/blueking-chat-x/references/components/user-question-answered-card.md +104 -0
  160. package/skills/blueking-chat-x/references/components/user-question-card.md +231 -0
  161. package/skills/blueking-chat-x/references/components/user-question-choice.md +105 -0
  162. package/skills/blueking-chat-x/references/components/user-question-option.md +42 -0
  163. package/skills/blueking-chat-x/references/components/vnode-renderer.md +122 -0
  164. package/skills/blueking-chat-x/references/composables/use-animation-text.md +196 -0
  165. package/skills/blueking-chat-x/references/composables/use-artifact-preview.md +235 -0
  166. package/skills/blueking-chat-x/references/composables/use-clipboard.md +203 -0
  167. package/skills/blueking-chat-x/references/composables/use-command-selection.md +150 -0
  168. package/skills/blueking-chat-x/references/composables/use-container-scroll.md +57 -0
  169. package/skills/blueking-chat-x/references/composables/use-custom-tab.md +158 -0
  170. package/skills/blueking-chat-x/references/composables/use-flow-node-actions.md +164 -0
  171. package/skills/blueking-chat-x/references/composables/use-full-screen.md +112 -0
  172. package/skills/blueking-chat-x/references/composables/use-global-config.md +155 -0
  173. package/skills/blueking-chat-x/references/composables/use-input-mention.md +115 -0
  174. package/skills/blueking-chat-x/references/composables/use-menu-keydown.md +161 -0
  175. package/skills/blueking-chat-x/references/composables/use-message-group.md +244 -0
  176. package/skills/blueking-chat-x/references/composables/use-observer-visible-list.md +188 -0
  177. package/skills/blueking-chat-x/references/composables/use-parent-scrolling.md +46 -0
  178. package/skills/blueking-chat-x/references/directives/index.md +61 -0
  179. package/skills/blueking-chat-x/references/directives/overflow-tips.md +205 -0
  180. package/skills/blueking-chat-x/references/icons/index.md +185 -0
  181. package/skills/blueking-chat-x/references/plugins/index.md +56 -0
  182. package/skills/blueking-chat-x/references/plugins/markdown-container.md +55 -0
  183. package/skills/blueking-chat-x/references/plugins/markdown-latex.md +205 -0
  184. package/skills/blueking-chat-x/references/plugins/markdown-mermaid.md +247 -0
  185. package/skills/blueking-chat-x/references/theme/theme.md +423 -0
  186. package/skills/blueking-chat-x/references/types/constants.md +340 -0
  187. package/skills/blueking-chat-x/references/types/index.md +120 -0
  188. package/skills/blueking-chat-x/references/types/interrupt.md +379 -0
  189. package/skills/blueking-chat-x/references/types/messages.md +556 -0
  190. package/skills/blueking-chat-x/references/types/schema.md +91 -0
  191. package/skills/blueking-chat-x/references/utils/index.md +196 -0
  192. package/skills/blueking-chat-x/scripts/generate-references.mjs +536 -0
  193. package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +0 -28
  194. package/dist/components/chat-input/ai-slash-editor/theme.d.ts +0 -24
  195. package/dist/mcp/generated/docs/ai-prompt-list.md +0 -45
  196. package/dist/mcp/generated/docs/ai-skill-list.md +0 -75
  197. package/dist/mcp/generated/docs/ai-slash-editor.md +0 -43
  198. package/dist/mcp/generated/docs/ai-slash-menu.md +0 -42
@@ -0,0 +1,185 @@
1
+ # 图标
2
+
3
+ `@blueking/chat-x` 内置了 76 个 SVG 图标:其中 70 个通过 Vue `h()` 预创建为 VNode 对象,可直接用于模板渲染;
4
+
5
+ ---
6
+
7
+ # 图标
8
+
9
+ `@blueking/chat-x` 内置了 76 个 SVG 图标:其中 70 个通过 Vue `h()` 预创建为 VNode 对象,可直接用于模板渲染;`ai.ts` 与 `menu-item.ts` 下的 6 个是 `defineComponent` 组件(需要按实例生成唯一渐变 id 或保留多色品牌配色)。
10
+
11
+ ## 快速开始
12
+
13
+ ```typescript
14
+ import { CopyIcon, LikeIcon, ToolIconsMap } from '@blueking/chat-x';
15
+ ```
16
+
17
+ 图标是模块级预创建的 **VNode 对象**(非组件定义),使用 `<component :is>` 渲染:
18
+
19
+ ```vue
20
+ <template>
21
+ <component :is="CopyIcon" />
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ import { CopyIcon } from '@blueking/chat-x';
26
+ </script>
27
+ ```
28
+
29
+ 颜色通过父元素 `color` 继承(`fill: currentColor`),大小通过 `width` / `height` 控制:
30
+
31
+ ```vue
32
+ <template>
33
+ <div style="color: #3a84ff;">
34
+ <component
35
+ :is="CopyIcon"
36
+ style="width: 24px; height: 24px;"
37
+ />
38
+ </div>
39
+ </template>
40
+ ```
41
+
42
+ ## 图标预览
43
+
44
+ ## 图标参考
45
+
46
+ ### 工具图标 `tools.ts`
47
+
48
+ 用于 `MessageTools` 工具栏。`ToolIconsMap` 提供 id → VNode 的映射,`ToolIcons` 为其 key 类型。
49
+
50
+ | 导出名 | ToolIconsMap key | class | 说明 |
51
+ | ------------------ | ---------------- | ------------------------ | ---------------- |
52
+ | `CopyIcon` | `copy` | `ai-copy-icon` | 复制 |
53
+ | `CiteIcon` | `cite` | `ai-cite-icon` | 引用 |
54
+ | `RebuildIcon` | `rebuild` | `ai-rebuild-icon` | 重新生成 |
55
+ | `ShareIcon` | `share` | `ai-share-icon` | 分享 |
56
+ | `LikeIcon` | `like` | `ai-like-icon` | 点赞(默认态) |
57
+ | `UnLikeIcon` | `unlike` | `ai-un-like-icon` | 不满意(默认态) |
58
+ | `DeleteIcon` | `delete` | `ai-delete-icon` | 删除 |
59
+ | `EditIcon` | `edit` | `ai-edit-icon` | 编辑 |
60
+ | `ActiveLikeIcon` | `activeLike` | `ai-active-like-icon` | 点赞(激活态) |
61
+ | `ActiveUnLikeIcon` | `activeUnLike` | `ai-active-un-like-icon` | 不满意(激活态) |
62
+ | `CollapsedAsideIcon` | — | `ai-collapsed-icon` | 侧栏展开/收起入口(不在 `ToolIconsMap`;业务方自建折叠按钮时可用) |
63
+
64
+ ```typescript
65
+ import { ToolIconsMap, type ToolIcons } from '@blueking/chat-x';
66
+
67
+ // 通过 key 动态获取图标
68
+ const icon = ToolIconsMap['copy']; // CopyIcon VNode
69
+
70
+ // 类型:'copy' | 'cite' | 'rebuild' | 'share' | 'like' | 'unlike' | 'delete' | 'edit' | 'activeLike' | 'activeUnLike'
71
+ type Key = ToolIcons;
72
+ ```
73
+
74
+ ### 消息图标 `messages.ts`
75
+
76
+ | 导出名 | class | 说明 |
77
+ | -------------------- | ------------------------- | ---------- |
78
+ | `SendMessageIcon` | `ai-send-message-icon` | 发送按钮 |
79
+ | `LoadingMessageIcon` | `ai-loading-message-icon` | 加载中环形 |
80
+ | `ThinkingIcon` | `ai-thinking-icon` | 思考中 |
81
+ | `CollapsedIcon` | `ai-collapsed-icon` | 折叠箭头 |
82
+ | `ErrorIcon` | `ai-error-icon` | 错误感叹号 |
83
+ | `ContentLoadingIcon` | `ai-content-loading-icon` | 内容加载中 |
84
+ | `ArrowDownIcon` | `ai-arrow-down-icon` | 返回底部 |
85
+
86
+ ### 内容图标 `content.ts`
87
+
88
+ | 导出名 | class | viewBox | 颜色 | 说明 |
89
+ | ---------------- | --------------------- | --------------- | ---------------- | ------------ |
90
+ | `DocumentIcon` | `ai-document-icon` | `0 0 1024 1024` | 硬编码 | 文档 |
91
+ | `PreviewIcon` | `ai-preview-icon` | `0 0 1024 1024` | currentColor | 预览(眼睛) |
92
+ | `TargetIcon` | `ai-target-icon` | `0 0 64 64` | currentColor | 外链跳转 |
93
+ | `RemoveIcon` | `ai-remove-icon` | `0 0 64 64` | 硬编码 `#737987` | 圆形关闭 |
94
+ | `ArrowRightIcon` | `ai-arrow-right-icon` | `0 0 1024 1024` | currentColor | 右箭头 |
95
+ | `LinkIcon` | `ai-link-icon` | `0 0 1024 1024` | currentColor | 链接 |
96
+ | `ImageErrorIcon` | `ai-image-error-icon` | `0 0 24 18` | currentColor | 图片加载失败 |
97
+
98
+ ### 快捷指令图标 `shortcuts.ts`
99
+
100
+ | 导出名 | class | 说明 |
101
+ | --------------- | -------------------- | --------------- |
102
+ | `CloseIcon` | `ai-close-icon` | 关闭 ✕ |
103
+ | `MoreIcon` | `ai-more-icon` | 更多(竖三点) |
104
+ | `AgentIcon` | `ai-agent-icon` | 星形 Agent |
105
+ | `MoreAgentIcon` | `ai-more-agent-icon` | 四格 Agent 列表 |
106
+
107
+ ### AI 图标 `ai.ts`
108
+
109
+ | 导出名 | class | viewBox | 颜色 | 说明 |
110
+ | ---------------------- | ------------------------- | ------------ | ---------- | --------------- |
111
+ | `AIBluekingIcon` | `ai-blueking-icon` | `0 0 24 24` | 硬编码渐变 | 小鲸品牌图标 |
112
+ | `AIBluekingBannerIcon` | `ai-blueking-banner-icon` | `0 0 309 93` | 硬编码渐变 | 小鲸品牌 Banner |
113
+
114
+ ### 文件图标 `file.ts`
115
+
116
+ | 导出名 | class | viewBox | 颜色 | 说明 |
117
+ | ------------------ | --------------------------- | --------------- | ------------ | -------------------- |
118
+ | `ArtifactTabIcon` | `ai-file-artifact-tab-icon` | `0 0 16 16` | currentColor | 文件产物侧栏 Tab |
119
+ | `DownloadFileIcon` | `ai-file-download-icon` | `0 0 1024 1024` | currentColor | 文件下载 |
120
+
121
+ ### 输入区图标 `input.ts`
122
+
123
+ | 导出名 | class | 说明 |
124
+ | ------------------ | ----------------------- | -------- |
125
+ | `CloseCircleIcon` | `ai-close-circle-icon` | 圆形关闭 |
126
+ | `DocLinkIcon` | `ai-doc-link-icon` | 文档链接 |
127
+ | `DeleteCircleIcon` | `ai-delete-circle-icon` | 圆形删除 |
128
+ | `FileUploadIcon` | `ai-delete-circle-icon` | 文件上传(与上一项共用 class,源码如此) |
129
+ | `ImageUploadIcon` | `ai-image-upload-icon` | 图片上传,viewBox `0 0 32 32` |
130
+ | `AddIcon` | `ai-add-icon` | 加号,[AddMenuBtn](/components/input/add-menu-btn) 唤起聚合菜单 |
131
+ | `ModuleIcon` | `ai-module-icon` | 田字格,菜单条目未提供图标时的最终兜底 |
132
+
133
+ ### 菜单条目图标 `menu-item.ts`
134
+
135
+ 菜单与资源标签的类型默认图标,由 [ResourceIcon](/components/helper/resource-icon) 按 `type` 选用。与其余图标不同,这四个是**设计给定的多色品牌图标**:
136
+
137
+ - 以 `defineComponent` 导出(不是 VNode),模板中直接 `<McpIcon />` 使用
138
+ - **不套用** `fill: currentColor`,各自配色原样保留,用 `color` 无法改色
139
+ - 尺寸统一 `1em`,跟随外层 `font-size`;`viewBox` 保持设计稿 `0 0 40 40`,由外层 `1em` 缩放到菜单图标大小
140
+ - `McpIcon` 含两组 `linearGradient` 与一个 `clipPath`,每个实例用 `useId()` 生成独立 id 前缀,避免多实例共用 id 时渐变失效
141
+
142
+ | 导出名 | class | 说明 |
143
+ | ------------------- | -------------------------- | ------ |
144
+ | `ToolIcon` | `ai-tool-icon` | 工具,`type: 'tool'` |
145
+ | `KnowledgeBaseIcon` | `ai-knowledge-base-icon` | 知识库,`type: 'knowledgebase'` / `'doc'` |
146
+ | `McpIcon` | `ai-mcp-icon` | MCP,`type: 'mcp'` |
147
+ | `PromptIcon` | `ai-prompt-icon` | Prompt,`type: 'prompt'` |
148
+
149
+ ### 执行图标 `execution.ts`
150
+
151
+ 用于流程编排 / Agent 执行状态与工具调用展示。
152
+
153
+ | 导出名 | class | viewBox | 颜色 | 说明 |
154
+ | --------------------- | --------------------------- | --------------- | --------------------- | -------- |
155
+ | `BkFlowSuccessIcon` | `ai-bk-flow-success-icon` | `0 0 16 16` | 硬编码 `#18B456` + 白 | 流程成功 |
156
+ | `BkFlowFailedIcon` | `ai-bk-flow-failed-icon` | `0 0 16 16` | 硬编码 `#EA3636` + 白 | 流程失败 |
157
+ | `BkFlowSuspendedIcon` | `ai-bk-flow-suspended-icon` | `0 0 16 16` | 硬编码 `#F59500` + 白 | 流程暂停 |
158
+ | `ExecutionIcon` | `ai-execution-icon` | `0 0 1024 1024` | currentColor | 执行时钟 |
159
+ | `NodeOutputIcon` | `ai-node-output-icon` | `0 0 1024 1024` | currentColor | 节点输出 |
160
+ | `NodeTabIcon` | `ai-node-tab-icon` | `0 0 1024 1024` | currentColor | 节点 Tab |
161
+ | `ToolCallIcon` | `ai-toolcall-icon` | `0 0 16 16` | currentColor | 工具调用(ToolcallRender 头部,16×16) |
162
+ | `ChevronRightIcon` | `ai-chevron-right-icon` | `0 0 10 10` | currentColor | 折叠箭头(10×10,展开态 rotate 90deg) |
163
+
164
+ ### 图片预览图标 `image-preview.ts`
165
+
166
+ | 导出名 | class | 说明 |
167
+ | ----------------------- | ----------------------------- | ---------------- |
168
+ | `ZoomInIcon` | `ai-zoom-in-icon` | 放大 |
169
+ | `ZoomOutIcon` | `ai-zoom-out-icon` | 缩小 |
170
+ | `RotateIcon` | `ai-rotate-icon` | 旋转 |
171
+ | `FitScreenIcon` | `ai-fit-screen-icon` | 适应屏幕 |
172
+ | `DownloadIcon` | `ai-download-icon` | 下载 |
173
+ | `PreviewCloseIcon` | `ai-close-icon` | 关闭预览 |
174
+ | `ArrowLeftIcon` | `ai-arrow-left-icon` | 上一张 |
175
+ | `ArrowRightPreviewIcon` | `ai-arrow-right-preview-icon` | 下一张 |
176
+ | `ReloadIcon` | `ai-reload-icon` | 重新加载 |
177
+ | `ImageBrokenIcon` | `ai-image-broken-icon` | 图片加载失败占位 |
178
+ | `ImageSizeIcon` | `ai-image-size-icon` | 图片尺寸 |
179
+
180
+ ## 注意事项
181
+
182
+ 1. **VNode 而非组件**:图标是 `h()` 预创建的 VNode 实例,同一个 VNode 不能被多处挂载。在列表渲染中使用 `cloneVNode()` 创建副本,或用 `defineComponent` 包装
183
+ 2. **硬编码颜色**:`DocumentIcon`、`RemoveIcon`(`#737987`)、`AIBluekingIcon` / `AIBluekingBannerIcon`(渐变)、`ImageBrokenIcon`、`BkFlowSuccessIcon`(`#18B456`)、`BkFlowFailedIcon`(`#EA3636`)、`BkFlowSuspendedIcon`(`#F59500`)内部使用固定颜色,不响应父元素 `color` 继承
184
+ 3. **非标准 viewBox**:`TargetIcon` / `RemoveIcon` 为 `0 0 64 64`,`ImageErrorIcon` 为 `0 0 24 18`,`AIBluekingIcon` 为 `0 0 24 24`,`AIBluekingBannerIcon` 为 `0 0 309 93`,`ImageBrokenIcon` 为 `0 0 200 180`,`BkFlowSuccessIcon` / `BkFlowFailedIcon` / `BkFlowSuspendedIcon` / `ArtifactTabIcon` / `ToolCallIcon` 为 `0 0 16 16`,`ChevronRightIcon` 为 `0 0 10 10`,设置 `width` / `height` 时注意比例
185
+ 4. **`FileUploadIcon` 类名**:源码中 class 为 `ai-delete-circle-icon`(与 `DeleteCircleIcon` 相同),通过 CSS 定位时需注意
@@ -0,0 +1,56 @@
1
+ # 插件
2
+
3
+ `@blueking/chat-x` 提供了一些 Markdown-it 插件,用于扩展 Markdown 的解析能力。
4
+
5
+ ---
6
+
7
+ # 插件
8
+
9
+ `@blueking/chat-x` 提供了一些 Markdown-it 插件,用于扩展 Markdown 的解析能力。
10
+
11
+ ## 插件列表
12
+
13
+ | 插件名 | 说明 | 文档 |
14
+ | ----------------- | ---------------- | ----------------------------- |
15
+ | markdownItLatex | LaTeX 公式解析 | [查看](./markdown-latex.md) |
16
+ | markdownItMermaid | Mermaid 图表解析 | [查看](./markdown-mermaid.md) |
17
+
18
+ ## 引入方式
19
+
20
+ ```typescript
21
+ import { markdownItLatex, markdownItMermaid } from '@blueking/chat-x';
22
+ ```
23
+
24
+ ## 使用示例
25
+
26
+ ```typescript
27
+ import MarkdownIt from 'markdown-it';
28
+ import { markdownItLatex, markdownItMermaid } from '@blueking/chat-x';
29
+
30
+ const md = new MarkdownIt().use(markdownItLatex, { replaceAlignStart: true }).use(markdownItMermaid);
31
+
32
+ const html = md.render(`
33
+ # 数学公式
34
+
35
+ 行内公式:$E = mc^2$
36
+
37
+ 块级公式:
38
+
39
+ $$
40
+ \\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}
41
+ $$
42
+
43
+ # 流程图
44
+
45
+ \`\`\`mermaid
46
+ graph TD
47
+ A[开始] --> B[结束]
48
+ \`\`\`
49
+ `);
50
+ ```
51
+
52
+ ## 注意事项
53
+
54
+ 1. **渲染分离**:插件只负责解析,实际渲染由对应的 Vue 组件完成
55
+ 2. **内置使用**:`ContentRender` 和 `MarkdownContent` 组件已内置这些插件
56
+ 3. **自定义场景**:如需自定义 Markdown 渲染,可单独引入插件使用
@@ -0,0 +1,55 @@
1
+ # markdownItContainer
2
+
3
+ > 未从包入口导出:内部实现 | since 1.0.0
4
+
5
+ markdownItContainer 基于 markdown-it-container,支持字符串或正则匹配容器名;MarkdownContent 中用于 hljs-left/center/right 对齐。 渲染为带 class 的 div,与 tokens-to-vnodes 及样式配合。
6
+
7
+ **关联**:markdown-content(渲染管线中注册插件)
8
+
9
+ ---
10
+
11
+ # markdownItContainer 自定义容器插件
12
+
13
+ > **分类**:plugin
14
+
15
+ 将 `::: 容器名` 开头的块解析为带 `class` 的块级容器,闭合行使用 `:::`。
16
+
17
+ ## 语法示例
18
+
19
+ ```markdown
20
+ ::: hljs-left
21
+ 左对齐内容
22
+ :::
23
+
24
+ ::: hljs-center
25
+ 居中内容
26
+ :::
27
+
28
+ ::: hljs-right
29
+ 右对齐内容
30
+ :::
31
+ ```
32
+
33
+ ## 在 MarkdownContent 中的注册方式
34
+
35
+ 组件内使用正则同时注册左/中/右三种容器名:
36
+
37
+ ```typescript
38
+ import MarkdownIt from 'markdown-it';
39
+ import { markdownItContainer } from '../../../src/plugins/markdown-container';
40
+
41
+ const md = new MarkdownIt({ html: true }).use(markdownItContainer, /^hljs-(left|center|right)$/);
42
+ ```
43
+
44
+ ## 配置说明
45
+
46
+ | 参数 | 类型 | 说明 |
47
+ | ------ | ------------------- | -------------------------------------------------- |
48
+ | `name` | `string \| RegExp` | 容器标识;字符串为精确匹配,正则用于一类名称 |
49
+ | `opts` | `ContainerOptions?` | 可选 `marker`、`validate`、`render` 覆盖默认行为 |
50
+
51
+ 更多行为见源码 `packages/chat-x/src/plugins/markdown-container.ts`。
52
+
53
+ ## 关联
54
+
55
+ - [MarkdownContent](../components/rendering/markdown-content) — 实际接入与样式
@@ -0,0 +1,205 @@
1
+ # markdownItLatex
2
+
3
+ > 导入:`import { markdownItLatex } from '@blueking/chat-x'` | since 1.0.0
4
+
5
+ markdownItLatex 为 markdown-it 插件,解析 $...$、$$...$$、\\(...\\)、\\[...\\] 为 math_inline / math_block token,可选 LatexOption.replaceAlignStart。 不负责渲染,KaTeX 在 LatexContent 中异步渲染。与 Markdown 管道、ContentRender 中的公式展示链路配合。
6
+
7
+ **关联**:latex-content(消费 math token 并 KaTeX 渲染)、markdown-content(Markdown 渲染管线)、content-render(消息内容统一渲染入口)
8
+
9
+ ---
10
+
11
+ # markdownItLatex LaTeX 解析插件
12
+
13
+ > **分类**:plugin
14
+
15
+ Markdown-it LaTeX 解析插件,用于解析 LaTeX 数学公式语法。
16
+
17
+ ## 功能说明
18
+
19
+ 此插件只负责解析 LaTeX 语法,将其转换为 `math_inline` 和 `math_block` token。实际的 KaTeX 渲染在 `LatexContent` 组件中完成。
20
+
21
+ ## 支持的语法
22
+
23
+ | 语法 | 类型 | 示例 |
24
+ | --------- | -------- | ---------------------- |
25
+ | `$...$` | 行内公式 | `$E = mc^2$` |
26
+ | `$$...$$` | 块级公式 | `$$\sum_{i=1}^{n} i$$` |
27
+ | `\(...\)` | 行内公式 | `\(E = mc^2\)` |
28
+ | `\[...\]` | 块级公式 | `\[\sum_{i=1}^{n} i\]` |
29
+
30
+ ## 基础用法
31
+
32
+ ```typescript
33
+ import MarkdownIt from 'markdown-it';
34
+ import { markdownItLatex } from '@blueking/chat-x';
35
+
36
+ const md = new MarkdownIt().use(markdownItLatex);
37
+
38
+ // 解析包含 LaTeX 的 Markdown
39
+ const tokens = md.parse(`
40
+ 行内公式:$E = mc^2$
41
+
42
+ 块级公式:
43
+
44
+ $$
45
+ \\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}
46
+ $$
47
+ `);
48
+ ```
49
+
50
+ ## 配置选项
51
+
52
+ ```typescript
53
+ import MarkdownIt from 'markdown-it';
54
+ import { markdownItLatex, type LatexOption } from '@blueking/chat-x';
55
+
56
+ const options: LatexOption = {
57
+ replaceAlignStart: true, // 将 align* 替换为 aligned(KaTeX 不支持 align*)
58
+ };
59
+
60
+ const md = new MarkdownIt().use(markdownItLatex, options);
61
+ ```
62
+
63
+ ### 配置项
64
+
65
+ | 属性名 | 类型 | 默认值 | 说明 |
66
+ | ----------------- | --------- | ------ | -------------------------------- |
67
+ | replaceAlignStart | `boolean` | `true` | 是否将 `align*` 替换为 `aligned` |
68
+
69
+ ## Token 类型
70
+
71
+ 插件会生成以下两种 token:
72
+
73
+ ### math_inline
74
+
75
+ 行内数学公式 token:
76
+
77
+ ```typescript
78
+ {
79
+ type: 'math_inline',
80
+ tag: 'math',
81
+ content: 'E = mc^2',
82
+ markup: '$',
83
+ meta: { displayMode: false }
84
+ }
85
+ ```
86
+
87
+ ### math_block
88
+
89
+ 块级数学公式 token:
90
+
91
+ ```typescript
92
+ {
93
+ type: 'math_block',
94
+ tag: 'math',
95
+ content: '\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}',
96
+ markup: '$$',
97
+ block: true,
98
+ map: [startLine, endLine]
99
+ }
100
+ ```
101
+
102
+ ## 公式示例
103
+
104
+ ### 基础公式
105
+
106
+ ```markdown
107
+ 行内公式:$E = mc^2$
108
+
109
+ 块级公式:
110
+
111
+ $$
112
+ E = mc^2
113
+ $$
114
+ ```
115
+
116
+ ### 复杂公式
117
+
118
+ ```markdown
119
+ $$
120
+ \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}
121
+ $$
122
+ ```
123
+
124
+ ### 矩阵
125
+
126
+ ```markdown
127
+ $$
128
+ \\begin{pmatrix}
129
+ a & b \\\\
130
+ c & d
131
+ \\end{pmatrix}
132
+ $$
133
+ ```
134
+
135
+ ### 多行公式
136
+
137
+ ```markdown
138
+ $$
139
+ \\begin{aligned}
140
+ f(x) &= x^2 + 2x + 1 \\\\
141
+ &= (x + 1)^2
142
+ \\end{aligned}
143
+ $$
144
+ ```
145
+
146
+ ## 转义处理
147
+
148
+ 插件会正确处理转义的分隔符:
149
+
150
+ ```markdown
151
+ 这不是公式:\$100
152
+
153
+ 这是公式:$x = 100$
154
+ ```
155
+
156
+ ## 与 KaTeX 配合
157
+
158
+ 渲染由 `LatexContent` 组件完成,使用 KaTeX 库:
159
+
160
+ ```vue
161
+ <template>
162
+ <LatexContent :token="latexTokens" />
163
+ </template>
164
+
165
+ <script setup lang="ts">
166
+ import { LatexContent } from '@blueking/chat-x';
167
+
168
+ // latexTokens 是包含 math_inline 或 math_block 的 token 数组
169
+ </script>
170
+ ```
171
+
172
+ ## KaTeX 支持说明
173
+
174
+ KaTeX 支持的功能:
175
+
176
+ - 大多数 LaTeX 数学符号
177
+ - 分数、根号、指数
178
+ - 矩阵和数组
179
+ - 括号和分隔符
180
+ - 希腊字母和运算符
181
+ - 上下标和大型运算符
182
+
183
+ KaTeX 限制:
184
+
185
+ - 不支持 `align*` 环境(插件会自动替换为 `aligned`)
186
+ - 部分 LaTeX 宏不支持
187
+
188
+ ## 使用场景
189
+
190
+ - AI 数学问答
191
+ - 技术文档展示
192
+ - 教育类应用
193
+ - 科学计算结果展示
194
+
195
+ ## 注意事项
196
+
197
+ 1. **双反斜杠**:在 JavaScript 字符串中,`\` 需要写成 `\\`
198
+ 2. **环境支持**:建议使用 `aligned` 替代 `align*`
199
+ 3. **性能考虑**:KaTeX 渲染在组件中异步进行,避免阻塞主线程
200
+
201
+ ## 关联组件
202
+
203
+ - [LatexContent](../components/rendering/latex-content) — KaTeX 渲染
204
+ - [MarkdownContent](../components/rendering/markdown-content) — Markdown 内容
205
+ - [ContentRender](../components/rendering/content-render) — 内容渲染