@blueking/chat-x 0.0.51 → 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 +5116 -4595
- 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-selection.md +1 -1
- 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 +4 -3
- 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,159 @@
|
|
|
1
|
+
# ScrollBtn 滚动按钮
|
|
2
|
+
|
|
3
|
+
> 能力域:工具与反馈 | 导入:`import { ScrollBtn } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
停止生成或返回底部等滚动/状态按钮。 源码位置:src/components/ai-buttons/scroll-btn/scroll-btn.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:message-container(消息列表底部固定区挂载滚动与停止按钮)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ScrollBtn 滚动按钮
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/ai-buttons/scroll-btn/scroll-btn.vue`
|
|
15
|
+
- **能力域**:工具与反馈
|
|
16
|
+
- **能力说明**:停止生成或返回底部等滚动/状态按钮。
|
|
17
|
+
|
|
18
|
+
> **能力域**:工具与反馈
|
|
19
|
+
|
|
20
|
+
聊天容器底部浮动操作按钮的外壳组件,提供统一的胶囊样式(圆角 26px、高 24px、阴影),内容完全由插槽定制。
|
|
21
|
+
|
|
22
|
+
由 `MessageContainer` 内部管理"停止生成"和"返回底部"两个按钮的显示逻辑,通常不需要手动引入。
|
|
23
|
+
|
|
24
|
+
## 组件结构
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
div.ai-scroll-btn(flex,gap: 4px,width: fit-content,min-width: 84px,height: 24px)
|
|
28
|
+
.is-loading / .is-disabled → cursor: not-allowed,opacity: 0.65
|
|
29
|
+
border: 1px solid #dcdee5,border-radius: 26px
|
|
30
|
+
box-shadow: 0 -2px 6px 0 #0000001a
|
|
31
|
+
hover → border: #c4c6cc,box-shadow 加深,cursor: pointer
|
|
32
|
+
│
|
|
33
|
+
├── Loading(loading=true 时显示旋转加载图标)
|
|
34
|
+
├── <slot name="icon">(loading=false 时显示,无默认内容)
|
|
35
|
+
│ 子图标自动继承 .ai-common-icon 样式:14×14px,font-size: 14px
|
|
36
|
+
│
|
|
37
|
+
└── <slot name="title">(默认内容:{{ title }},XSS 安全)
|
|
38
|
+
传入 title slot 时完全替换 title prop 的文本
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> **`loading` / `disabled` prop**:`loading` 为 `true` 时显示旋转加载图标替代 icon slot,且点击无效;`disabled` 为 `true` 时点击同样无效。两者均添加 `not-allowed` 光标和 `0.65` 透明度。
|
|
42
|
+
>
|
|
43
|
+
> **`@click` 事件**:通过内部 `handleClick` 处理,`loading` 或 `disabled` 时不触发。
|
|
44
|
+
|
|
45
|
+
## 基础用法:返回底部
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<template>
|
|
49
|
+
<ScrollBtn
|
|
50
|
+
title="返回底部"
|
|
51
|
+
@click="toScrollBottom"
|
|
52
|
+
>
|
|
53
|
+
<template #icon>
|
|
54
|
+
<ArrowDownIcon />
|
|
55
|
+
</template>
|
|
56
|
+
</ScrollBtn>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { ScrollBtn } from '@blueking/chat-x';
|
|
61
|
+
import { ArrowDownIcon } from '@blueking/chat-x';
|
|
62
|
+
|
|
63
|
+
const toScrollBottom = () => {
|
|
64
|
+
/* 滚动逻辑 */
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 停止生成
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<ScrollBtn
|
|
74
|
+
title="停止生成"
|
|
75
|
+
@click="stopStreaming"
|
|
76
|
+
>
|
|
77
|
+
<template #icon>
|
|
78
|
+
<CloseCircleIcon />
|
|
79
|
+
</template>
|
|
80
|
+
</ScrollBtn>
|
|
81
|
+
</template>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 仅图标(不传 title)
|
|
85
|
+
|
|
86
|
+
不传 `title` prop 时,`title` slot 渲染空文本,按钮收缩至 `min-width: 84px`:
|
|
87
|
+
|
|
88
|
+
## 自定义 title slot
|
|
89
|
+
|
|
90
|
+
传入 `#title` 插槽时,完全覆盖 `title` prop 的文本渲染:
|
|
91
|
+
|
|
92
|
+
```vue
|
|
93
|
+
<template>
|
|
94
|
+
<ScrollBtn
|
|
95
|
+
title="此文本被覆盖"
|
|
96
|
+
@click="handleClick"
|
|
97
|
+
>
|
|
98
|
+
<template #icon>
|
|
99
|
+
<ArrowDownIcon />
|
|
100
|
+
</template>
|
|
101
|
+
<template #title>
|
|
102
|
+
<span style="color: #3a84ff; font-weight: 600;">新消息 ↓</span>
|
|
103
|
+
</template>
|
|
104
|
+
</ScrollBtn>
|
|
105
|
+
</template>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## API
|
|
109
|
+
|
|
110
|
+
### Props
|
|
111
|
+
|
|
112
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
113
|
+
| -------- | --------- | ---- | ------------------------------------------------------------------------- |
|
|
114
|
+
| title | `string` | — | 按钮文本;被 `#title` 插槽覆盖时无效;XSS 安全(文本插值) |
|
|
115
|
+
| loading | `boolean` | — | 加载状态;为 `true` 时显示旋转 Loading 图标替代 icon slot,点击不触发事件 |
|
|
116
|
+
| disabled | `boolean` | — | 禁用状态;为 `true` 时点击不触发事件 |
|
|
117
|
+
|
|
118
|
+
### Events
|
|
119
|
+
|
|
120
|
+
| 事件名 | 参数 | 说明 |
|
|
121
|
+
| ------ | --------------------- | ------------------------------------------------ |
|
|
122
|
+
| click | `(event: MouseEvent)` | 点击按钮时触发;`loading` 或 `disabled` 时不触发 |
|
|
123
|
+
|
|
124
|
+
### Slots
|
|
125
|
+
|
|
126
|
+
| 插槽名 | 说明 |
|
|
127
|
+
| ------ | ------------------------------------------------------------------------- |
|
|
128
|
+
| icon | 图标区域,无默认内容;放置 `@blueking/chat-x` 图标时自动应用 14×14px 样式 |
|
|
129
|
+
| title | 文本区域,默认渲染 `title` prop;传入后**完全替换** prop 文本 |
|
|
130
|
+
|
|
131
|
+
## 在 MessageContainer 中的使用
|
|
132
|
+
|
|
133
|
+
`ScrollBtn` 由 `MessageContainer` 内置,根据状态自动控制显隐,无需手动管理:
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<!-- 停止生成:仅在流式输出时显示 -->
|
|
137
|
+
<ScrollBtn
|
|
138
|
+
v-show="messageStatus === MessageStatus.Streaming"
|
|
139
|
+
:title="t('停止生成')"
|
|
140
|
+
@click="$emit('stopStreaming')"
|
|
141
|
+
>
|
|
142
|
+
<template #icon><CloseCircleIcon /></template>
|
|
143
|
+
</ScrollBtn>
|
|
144
|
+
|
|
145
|
+
<!-- 返回底部:距底部超过 100px 且不在底部时显示 -->
|
|
146
|
+
<ScrollBtn
|
|
147
|
+
v-show="!isScrollBottom && scrollBottomHeight > 100"
|
|
148
|
+
:title="t('返回底部')"
|
|
149
|
+
@click="toScrollBottom"
|
|
150
|
+
>
|
|
151
|
+
<template #icon><ArrowDownIcon /></template>
|
|
152
|
+
</ScrollBtn>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
两个按钮都渲染在 `div.ai-message-fixed-bottom` 容器内,由父布局定位到消息列表底部中央。
|
|
156
|
+
|
|
157
|
+
## 关联组件
|
|
158
|
+
|
|
159
|
+
- [MessageContainer](/components/setup/message-container) — 底部固定区集成
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# SelectionFooter 多选操作栏
|
|
2
|
+
|
|
3
|
+
> 能力域:输入交互 | 导入:`import { SelectionFooter } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
消息多选/分享模式下的底部操作栏。 源码位置:src/components/selection-footer/selection-footer.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:chat-container(多选/分享模式由容器渲染底部栏)、message-container(与消息列表勾选状态联动)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# SelectionFooter 选择操作栏
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/selection-footer/selection-footer.vue`
|
|
15
|
+
- **能力域**:输入交互
|
|
16
|
+
- **能力说明**:消息多选/分享模式下的底部操作栏。
|
|
17
|
+
|
|
18
|
+
> **能力域**:输入交互
|
|
19
|
+
|
|
20
|
+
消息多选模式下的底部操作栏,提供全选、取消和确认操作。由 `ChatContainer` 在分享模式下自动渲染,通常不需要单独使用。
|
|
21
|
+
|
|
22
|
+
## 基础用法
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<template>
|
|
26
|
+
<SelectionFooter
|
|
27
|
+
:is-all-selected="isAllSelected"
|
|
28
|
+
:selected-count="selectedCount"
|
|
29
|
+
:loading="false"
|
|
30
|
+
@toggle-all="handleToggleAll"
|
|
31
|
+
@cancel="handleCancel"
|
|
32
|
+
@confirm="handleConfirm"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { ref } from 'vue';
|
|
38
|
+
import { SelectionFooter } from '@blueking/chat-x';
|
|
39
|
+
|
|
40
|
+
const isAllSelected = ref(false);
|
|
41
|
+
const selectedCount = ref(0);
|
|
42
|
+
|
|
43
|
+
const handleToggleAll = (checked: boolean) => {
|
|
44
|
+
isAllSelected.value = checked;
|
|
45
|
+
};
|
|
46
|
+
const handleCancel = () => {
|
|
47
|
+
console.log('取消');
|
|
48
|
+
};
|
|
49
|
+
const handleConfirm = () => {
|
|
50
|
+
console.log('确认');
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**渲染效果**
|
|
56
|
+
|
|
57
|
+
## API
|
|
58
|
+
|
|
59
|
+
### Props
|
|
60
|
+
|
|
61
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
62
|
+
| ------------- | --------- | ---- | ------- | ----------------------------- |
|
|
63
|
+
| isAllSelected | `boolean` | ✓ | — | 是否全选 |
|
|
64
|
+
| selectedCount | `number` | ✓ | — | 已选数量,为 0 时确认按钮禁用 |
|
|
65
|
+
| loading | `boolean` | — | `false` | 确认按钮加载状态 |
|
|
66
|
+
|
|
67
|
+
### Events
|
|
68
|
+
|
|
69
|
+
| 事件名 | 参数 | 说明 |
|
|
70
|
+
| ---------- | -------------------- | ------------ |
|
|
71
|
+
| toggle-all | `(checked: boolean)` | 切换全选状态 |
|
|
72
|
+
| cancel | — | 点击取消按钮 |
|
|
73
|
+
| confirm | — | 点击确认按钮 |
|
|
74
|
+
|
|
75
|
+
## 关联组件
|
|
76
|
+
|
|
77
|
+
- [ChatContainer](/components/setup/chat-container) — 分享模式挂载
|
|
78
|
+
- [MessageContainer](/components/setup/message-container) — 多选与消息列表
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# SelectionQuestion 选择问题占位
|
|
2
|
+
|
|
3
|
+
> 能力域:辅助能力 | 未从包入口导出:内部组件,请通过上层组件使用 | since 1.0.0
|
|
4
|
+
|
|
5
|
+
源码为空文件,没有 props、emits、slots 或渲染能力;不建议作为功能组件使用。 源码位置:src/components/ai-questions/selection-question.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:user-question-card(选择类问题交互请使用实际可渲染的问题卡片组件)、user-question-option(单个选项行由实际问题组件渲染)、interrupt-message(HITL 中断消息由 InterruptMessage 分发到具体问题组件)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# SelectionQuestion 选择问题占位
|
|
12
|
+
|
|
13
|
+
> **能力域**:辅助能力
|
|
14
|
+
|
|
15
|
+
`SelectionQuestion` 当前只是保留在源码目录中的空文件,占位路径为 `src/components/ai-questions/selection-question.vue`。它没有模板、脚本、样式、props、emits、slots 或任何选择交互能力。
|
|
16
|
+
|
|
17
|
+
本文档保留该条目,是为了明确它不是当前可用的问题选择组件,避免业务误接入。
|
|
18
|
+
|
|
19
|
+
## 源码事实
|
|
20
|
+
|
|
21
|
+
- **源码位置**:`src/components/ai-questions/selection-question.vue`
|
|
22
|
+
- **文件大小**:`0` 字节
|
|
23
|
+
- **能力说明**:源码为空文件,没有 props、emits、slots 或渲染能力;不建议作为功能组件使用。
|
|
24
|
+
|
|
25
|
+
## 当前状态
|
|
26
|
+
|
|
27
|
+
| 项目 | 状态 |
|
|
28
|
+
| -------- | ---- |
|
|
29
|
+
| 模板 | 无 |
|
|
30
|
+
| 脚本逻辑 | 无 |
|
|
31
|
+
| 样式 | 无 |
|
|
32
|
+
| Props | 无 |
|
|
33
|
+
| Emits | 无 |
|
|
34
|
+
| Slots | 无 |
|
|
35
|
+
| Expose | 无 |
|
|
36
|
+
|
|
37
|
+
## 不可用示例
|
|
38
|
+
|
|
39
|
+
下面的写法不会产生选择题 UI,也不会发出确认事件:
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<template>
|
|
43
|
+
<!-- 不建议使用:当前组件为空文件 -->
|
|
44
|
+
<SelectionQuestion />
|
|
45
|
+
</template>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 推荐替代
|
|
49
|
+
|
|
50
|
+
选择类用户问题请走中断消息链路,由已实现的组件负责展示选项和处理确认:
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<template>
|
|
54
|
+
<UserQuestionCard
|
|
55
|
+
:content="content"
|
|
56
|
+
@confirm="handleConfirm"
|
|
57
|
+
/>
|
|
58
|
+
</template>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
相关文档:
|
|
62
|
+
|
|
63
|
+
- [UserQuestionCard](../agent/user-question-card.md) — 用户问题中断交互面板。
|
|
64
|
+
- [UserQuestionOption](../agent/user-question-option.md) — 用户问题选项行。
|
|
65
|
+
- [InterruptMessage](../agent/interrupt-message.md) — 中断消息分发入口。
|
|
66
|
+
|
|
67
|
+
## API
|
|
68
|
+
|
|
69
|
+
### Props
|
|
70
|
+
|
|
71
|
+
- 无。
|
|
72
|
+
|
|
73
|
+
### Emits
|
|
74
|
+
|
|
75
|
+
- 无。
|
|
76
|
+
|
|
77
|
+
### Slots
|
|
78
|
+
|
|
79
|
+
- 无。
|
|
80
|
+
|
|
81
|
+
### Expose
|
|
82
|
+
|
|
83
|
+
- 无。
|
|
84
|
+
|
|
85
|
+
## 使用建议
|
|
86
|
+
|
|
87
|
+
- 不建议在业务中使用该组件。
|
|
88
|
+
- 如果后续补齐实现,需要同步更新本文档的示例、选择交互事件、API 与关联组件。
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# ShortcutBtn 快捷指令按钮
|
|
2
|
+
|
|
3
|
+
> 能力域:输入交互 | 导入:`import { ShortcutBtn } from '@blueking/chat-x'` | since 1.0.0
|
|
4
|
+
|
|
5
|
+
单个快捷指令按钮,支持默认/append 插槽和 expose focus。 源码位置:src/components/ai-shortcut/shortcut-btn/shortcut-btn.vue。
|
|
6
|
+
|
|
7
|
+
**关联**:shortcut-btns(快捷指令横向列表中作为单项渲染)、ai-selection(划词浮窗内展示快捷操作按钮或溢出菜单项)、chat-input(已选快捷指令在输入框底部以单按钮展示)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ShortcutBtn 快捷指令按钮
|
|
12
|
+
## 源码事实
|
|
13
|
+
|
|
14
|
+
- **源码位置**:`src/components/ai-shortcut/shortcut-btn/shortcut-btn.vue`
|
|
15
|
+
- **能力域**:输入交互
|
|
16
|
+
- **能力说明**:单个快捷指令按钮,支持默认/append 插槽和 expose focus。
|
|
17
|
+
|
|
18
|
+
> **能力域**:输入交互
|
|
19
|
+
|
|
20
|
+
单个快捷指令的渲染单元,封装图标选择逻辑和两种布局模式(按钮 / 菜单项)。
|
|
21
|
+
|
|
22
|
+
被 `ShortcutBtns`(快捷指令栏)、`AiSelection`(划词浮窗)和 `ChatInput`(已选指令展示)内部使用,通常不需要手动引入。
|
|
23
|
+
|
|
24
|
+
## 组件结构
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
button.ai-shortcut-btn(flex,gap: 4px,height: 28px,padding: 0 4px,white-space: nowrap)
|
|
28
|
+
border: none,border-radius: 4px,background: transparent
|
|
29
|
+
transition: background-color 0.2s
|
|
30
|
+
mode="menu" → 追加 .is-menu-mode(height: 32px,padding: 0 12px,width: 100%,justify-content: flex-start)
|
|
31
|
+
│
|
|
32
|
+
├── <slot name="default">(覆盖后图标+名称全部替换)
|
|
33
|
+
│ ├── [shortcut.icon 为字符串 && 以 'http' 开头]
|
|
34
|
+
│ │ 加载成功:<img … />;加载失败:回退 AgentIcon.ai-shortcut-btn-icon
|
|
35
|
+
│ ├── [shortcut.icon 为字符串 && 不以 'http' 开头]
|
|
36
|
+
│ │ <span :class="icon" />(CSS 图标类名,无其他 class)
|
|
37
|
+
│ ├── [shortcut.icon 为函数或组件]
|
|
38
|
+
│ │ <component :is="typeof icon==='function' ? icon(h) : icon" class="ai-shortcut-btn-icon" />
|
|
39
|
+
│ ├── [shortcut 存在,无 icon,components 为空/未设置] → AgentIcon.ai-shortcut-btn-icon
|
|
40
|
+
│ ├── [shortcut 存在,无 icon,components 有内容] → 无图标
|
|
41
|
+
│ └── {{ shortcut?.name }}(XSS 安全,文本插值)
|
|
42
|
+
│
|
|
43
|
+
└── <slot name="append" />(渲染在名称之后,常用于关闭按钮)
|
|
44
|
+
|
|
45
|
+
defineExpose: { get $el() { return el.value } }(懒 getter,返回 button 元素引用)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> **`hover` cursor 说明**:CSS 中 `:hover` 先写 `cursor: pointer` 再写 `cursor: default`,后者覆盖前者,实际 hover 时显示默认指针。仅 `append` 槽内的 `.ai-close-icon` 恢复 `cursor: pointer`。
|
|
49
|
+
|
|
50
|
+
## 图标渲染规则
|
|
51
|
+
|
|
52
|
+
| `shortcut.icon` 类型 | 渲染结果 | 额外说明 |
|
|
53
|
+
| ------------------------------------- | --------------------------- | ---------------------------------------------------------------- |
|
|
54
|
+
| 未设置(且 `components` 为空/未设置) | `AgentIcon`(默认图标) | `components: []` 与不传效果相同 |
|
|
55
|
+
| 未设置(且 `components` 有内容) | 无图标 | 表单类快捷指令 |
|
|
56
|
+
| `string`,以 `'http'` 开头 | `<img>`,失败时 `AgentIcon` | `.ai-common-icon .ai-shortcut-btn-icon`;`@error` 后回退默认图标 |
|
|
57
|
+
| `string`,不以 `'http'` 开头 | `<span :class="icon">` | 视为 CSS 图标类名,无其他 class |
|
|
58
|
+
| 函数 `(h) => Component/VNode` | `<component :is="icon(h)">` | 有 `.ai-shortcut-btn-icon` |
|
|
59
|
+
| 组件对象 | `<component :is="icon">` | 有 `.ai-shortcut-btn-icon` |
|
|
60
|
+
|
|
61
|
+
## 基础用法
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<template>
|
|
65
|
+
<ShortcutBtn
|
|
66
|
+
:shortcut="shortcut"
|
|
67
|
+
@click="handleClick"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { ShortcutBtn } from '@blueking/chat-x';
|
|
73
|
+
import type { Shortcut } from '@blueking/chat-x';
|
|
74
|
+
|
|
75
|
+
const shortcut: Shortcut = { id: 'ask-whale', name: '问问小鲸' };
|
|
76
|
+
|
|
77
|
+
const handleClick = (shortcut?: Shortcut) => {
|
|
78
|
+
console.log('选择了:', shortcut?.name);
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> 从左到右:无 `icon`(默认 AgentIcon)、`components: []`(同样显示 AgentIcon)、有 `components`(无图标)。
|
|
84
|
+
|
|
85
|
+
## 图标类型对比
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<template>
|
|
89
|
+
<!-- URL 图片图标 -->
|
|
90
|
+
<ShortcutBtn :shortcut="{ id: '1', name: '图片图标', icon: 'https://…/icon.png' }" />
|
|
91
|
+
|
|
92
|
+
<!-- CSS 类名图标(字体图标) -->
|
|
93
|
+
<ShortcutBtn :shortcut="{ id: '2', name: 'CSS 类图标', icon: 'bk-icon icon-star-shape' }" />
|
|
94
|
+
|
|
95
|
+
<!-- 函数/渲染函数图标 -->
|
|
96
|
+
<ShortcutBtn :shortcut="{ id: '3', name: '函数图标', icon: h => h('span', {}, '🚀') }" />
|
|
97
|
+
</template>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 菜单模式(mode="menu")
|
|
101
|
+
|
|
102
|
+
`mode="menu"` 时切换为 `is-menu-mode` 布局:左对齐、`width: 100%`、高 32px、padding `0 12px`:
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<template>
|
|
106
|
+
<div class="shortcut-menu">
|
|
107
|
+
<ShortcutBtn
|
|
108
|
+
v-for="item in shortcuts"
|
|
109
|
+
:key="item.id"
|
|
110
|
+
mode="menu"
|
|
111
|
+
:shortcut="item"
|
|
112
|
+
@click="handleClick"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## append 插槽:添加关闭按钮
|
|
119
|
+
|
|
120
|
+
`#append` 渲染在名称之后,`@click.stop` 可阻止冒泡到 `@click`(父 ChatInput 使用场景):
|
|
121
|
+
|
|
122
|
+
```vue
|
|
123
|
+
<template>
|
|
124
|
+
<ShortcutBtn
|
|
125
|
+
:shortcut="shortcut"
|
|
126
|
+
@click="handleSelect"
|
|
127
|
+
>
|
|
128
|
+
<template #append>
|
|
129
|
+
<CloseIcon @click.stop="handleRemove" />
|
|
130
|
+
</template>
|
|
131
|
+
</ShortcutBtn>
|
|
132
|
+
</template>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## default 插槽:完全自定义内容
|
|
136
|
+
|
|
137
|
+
`default` 插槽覆盖**全部**默认内容(图标 + 名称),`shortcut` prop 仅传递给 `@click` 事件:
|
|
138
|
+
|
|
139
|
+
```vue
|
|
140
|
+
<template>
|
|
141
|
+
<ShortcutBtn
|
|
142
|
+
:shortcut="shortcut"
|
|
143
|
+
@click="handleClick"
|
|
144
|
+
>
|
|
145
|
+
<MoreAgentIcon />
|
|
146
|
+
<span>更多</span>
|
|
147
|
+
</ShortcutBtn>
|
|
148
|
+
</template>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## API
|
|
152
|
+
|
|
153
|
+
### Props
|
|
154
|
+
|
|
155
|
+
| 属性名 | 类型 | 必填 | 说明 |
|
|
156
|
+
| -------- | ----------------- | ---- | ------------------------------------------------------------ |
|
|
157
|
+
| shortcut | `Shortcut` | — | 快捷指令配置;缺省时按钮无内容,`click` 事件传递 `undefined` |
|
|
158
|
+
| mode | `'btn' \| 'menu'` | — | 布局模式;缺省为 `btn`(水平居中),`menu` 切换为列表项布局 |
|
|
159
|
+
|
|
160
|
+
### Events
|
|
161
|
+
|
|
162
|
+
| 事件名 | 参数 | 说明 |
|
|
163
|
+
| ------ | ----------------------- | -------------------------------------------------------------------- |
|
|
164
|
+
| click | `(shortcut?: Shortcut)` | 点击按钮时触发,传递当前 `shortcut` prop(无 prop 则为 `undefined`) |
|
|
165
|
+
|
|
166
|
+
### Slots
|
|
167
|
+
|
|
168
|
+
| 插槽名 | 说明 |
|
|
169
|
+
| ------- | -------------------------------------------------------------------- |
|
|
170
|
+
| default | 覆盖全部默认渲染(图标 + 名称);`shortcut` prop 仍用于 `click` 事件 |
|
|
171
|
+
| append | 追加在名称之后;常用于关闭/删除图标,建议配合 `@click.stop` 阻止冒泡 |
|
|
172
|
+
|
|
173
|
+
### Expose
|
|
174
|
+
|
|
175
|
+
| 属性名 | 类型 | 说明 |
|
|
176
|
+
| ------ | --------------------- | ------------------------------------------------------------------------- |
|
|
177
|
+
| `$el` | `HTMLElement \| null` | 懒 getter,返回根 `<button>` 元素引用;供 `ShortcutBtns` 计算可见性时使用 |
|
|
178
|
+
|
|
179
|
+
## 类型定义
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
interface Shortcut {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
description?: string;
|
|
186
|
+
icon?: string | Component | ((h: typeof h) => Component | VNode);
|
|
187
|
+
components?: ShortcutComponent[]; // 有内容时不显示默认 AgentIcon
|
|
188
|
+
formModel?: Record<string, unknown>;
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## 在各组件中的使用场景
|
|
193
|
+
|
|
194
|
+
| 使用方 | 模式 | 特殊用法 |
|
|
195
|
+
| -------------- | ------------- | -------------------------------------------------------------------------------------------- |
|
|
196
|
+
| `ShortcutBtns` | btn | 可见项正常渲染;溢出项隐藏(CSS `visibility: hidden`),放入下拉菜单以 `mode="menu"` 展示 |
|
|
197
|
+
| `AiSelection` | btn / menu | 最多显示 `maxShortcutCount` 个按钮,超出时以 `#default` 插槽显示"更多",下拉用 `mode="menu"` |
|
|
198
|
+
| `ChatInput` | btn(已选态) | 使用 `#append` 插槽放置 `CloseIcon`,点击关闭删除已选快捷指令 |
|
|
199
|
+
|
|
200
|
+
## 关联组件
|
|
201
|
+
|
|
202
|
+
- [ShortcutBtns](/components/input/shortcut-btns) — 快捷指令列表容器
|
|
203
|
+
- [AiSelection](/components/input/ai-selection) — 划词浮窗内使用
|
|
204
|
+
- [ChatInput](/components/input/chat-input) — 已选快捷指令展示
|