@blueking/chat-x 0.0.47-beta.4 → 0.0.49-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ag-ui/types/file.d.ts +23 -0
- package/dist/ag-ui/types/index.d.ts +1 -0
- package/dist/ag-ui/types/messages.d.ts +2 -0
- package/dist/components/chat-input/chat-input.vue.d.ts +15 -2
- package/dist/components/chat-input/input-attachment/input-attachment.vue.d.ts +4 -2
- package/dist/components/chat-input/model-selector/capabilities.d.ts +3 -0
- package/dist/components/chat-input/model-selector/index.d.ts +3 -0
- package/dist/components/chat-input/model-selector/model-selector-panel.vue.d.ts +26 -0
- package/dist/components/chat-input/model-selector/model-selector-trigger.vue.d.ts +14 -0
- package/dist/components/chat-input/model-selector/model-selector.vue.d.ts +39 -0
- package/dist/components/chat-input/model-selector/types.d.ts +61 -0
- package/dist/components/chat-input/model-selector/use-model-selector.d.ts +17 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +14 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +8 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/preview-strategy.d.ts +9 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/html-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/markdown-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/txt-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/url-iframe-preview.vue.d.ts +6 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/use-artifact-preview-loader.d.ts +21 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/file-artifact-panel.vue.d.ts +12 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/file-icon.d.ts +29 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts +10 -0
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +2 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +59 -0
- package/dist/composables/use-message-group.d.ts +434 -0
- package/dist/icons/file.d.ts +24 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/input.d.ts +7 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2761 -1984
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +10 -1
- package/dist/mcp/generated/docs/activity-message.md +122 -97
- package/dist/mcp/generated/docs/assistant-message.md +125 -62
- package/dist/mcp/generated/docs/chat-container.md +269 -76
- package/dist/mcp/generated/docs/chat-input.md +57 -0
- package/dist/mcp/generated/docs/file-artifact-panel.md +279 -0
- package/dist/mcp/generated/docs/info-message.md +23 -7
- package/dist/mcp/generated/docs/input-attachment.md +1 -0
- package/dist/mcp/generated/docs/loading-message.md +36 -17
- package/dist/mcp/generated/docs/message-container.md +47 -0
- package/dist/mcp/generated/docs/message-render.md +44 -33
- package/dist/mcp/generated/docs/message-tools.md +5 -1
- package/dist/mcp/generated/docs/model-selector.md +157 -0
- package/dist/mcp/generated/docs/reasoning-message.md +15 -11
- package/dist/mcp/generated/docs/tool-btn.md +33 -4
- package/dist/mcp/generated/docs/tool-message.md +61 -45
- package/dist/mcp/generated/docs/use-artifact-preview.md +237 -0
- package/dist/mcp/generated/docs/use-message-group.md +24 -0
- package/dist/mcp/generated/docs/user-message.md +185 -121
- package/dist/mcp/generated/index.json +109 -11
- package/dist/types/tool.d.ts +6 -2
- package/package.json +2 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。 透传 models / selectedModel;支持 welcomeTitle 与 #welcome。 源码位置:src/components/chat-container/chat-container.vue。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-container** — 消息列表与滚动区域
|
|
8
8
|
- **chat-input** — 对话输入与快捷指令入口
|
|
9
|
+
- **model-selector** — 透传 models / selectedModel,在输入区展示模型选择器
|
|
9
10
|
- **shortcut-render** — 快捷指令表单浮层
|
|
10
11
|
- **execution-summary** — 执行摘要侧栏与定位
|
|
11
12
|
- **selection-footer** — 多选分享底部操作栏
|
|
@@ -14,30 +15,23 @@
|
|
|
14
15
|
<!-- FULL DOC -->
|
|
15
16
|
|
|
16
17
|
# ChatContainer 聊天容器
|
|
17
|
-
## 源码事实
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
- **能力域**:对话搭建
|
|
21
|
-
- **能力说明**:完整对话容器,组合消息列表、输入区、快捷指令、执行摘要、分享选择和自定义 Tab。
|
|
19
|
+
> **能力域**:对话搭建 | **源码**:`src/components/chat-container/chat-container.vue`
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
顶层聊天容器组件,整合了 `MessageContainer`(消息列表)、`ChatInput`(输入框)、`ExecutionSummary`(执行摘要面板)、`ShortcutRender`(快捷指令表单)和 `SelectionFooter`(多选操作栏)。提供完整的 AI 对话界面布局能力。
|
|
21
|
+
顶层聊天容器,整合 `MessageContainer`(消息列表)、`ChatInput`(输入框)、`ExecutionSummary`(执行摘要)、`ShortcutRender`(快捷指令表单)和 `SelectionFooter`(多选操作栏),提供完整 AI 对话界面布局。
|
|
26
22
|
|
|
27
23
|
## 核心能力
|
|
28
24
|
|
|
29
|
-
- **分栏布局**:基于 `ResizeLayout
|
|
30
|
-
- **消息分组**:内置 `useMessageGroup
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- **字号主题**:通过 `size` 控制 `small`(默认 12px)/ `normal`(14px)两档字号;根节点设置 `data-ai-size`,子组件通过 CSS 变量(`--ai-font-size` 等)响应式缩放;浮层(Tippy / Teleport)会同步 `document.body.dataset.aiSize`,卸载时自动清理
|
|
40
|
-
- **空状态欢迎页**:无消息时展示欢迎语和开场白
|
|
25
|
+
- **分栏布局**:基于 `ResizeLayout`;侧栏 Tab / 执行摘要是否展示,以及是否进入 `ai-is-collapse`,由 `executionGroups` 与搜索词 `keyword` 共同决定。无执行数据且未搜索时隐藏侧栏;搜索中(`keyword` 非空)即使暂无执行消息也保留侧栏
|
|
26
|
+
- **消息分组**:内置 `useMessageGroup`,自动分组、Tool 合并、Loading 注入
|
|
27
|
+
- **输入区状态推导**:对内 `messageStatus` 取 `inputStatus`——分组中存在 `LOADING_MESSAGE_ID`(`'__loading__'`)时用 `MessageStatus.Fetching`,否则用外部 `messageStatus`,保证「已发未流式」阶段也能停止、并避免重复发送
|
|
28
|
+
- **待审批发送阻塞**:存在 `AIDevToolApproval` 且为 `pending` / `draft` 时,输入区上方提示,并通过 `ChatInput.sendDisabledTip` 禁止发送
|
|
29
|
+
- **用户问题中断**:待回答 `UserQuestion` 时挂载 `UserQuestionCard`;结构化作答走 `onInterruptResume`,输入框直接发送走 `onSendMessage`(第三参数带 skip `payload` 与 `interrupt`),且不自动清空输入框
|
|
30
|
+
- **执行摘要 / 侧栏全屏 / 自定义 Tab**:侧栏展示工具调用与 FlowAgent 记录,支持搜索定位;Tab 栏可全屏;`useCustomTabProvider` 支持动态 Tab
|
|
31
|
+
- **模型选择**:透传 `models`、`v-model:selectedModel` 与 `@modelChange` 至 `ChatInput`,传入 `models` 后在发送按钮左侧展示 [ModelSelector](/components/input/model-selector)
|
|
32
|
+
- **分享模式 / 渲染模式**:内置多选分享;`renderMode` 经 Provider 下传。`Share` 态开放侧栏只读查看,隐藏底部输入与「重试 / 跳过」等交互
|
|
33
|
+
- **字号主题**:`size` 为 `small`(默认 12px)/ `normal`(14px);根节点 `data-ai-size`,浮层同步 `document.body.dataset.aiSize`
|
|
34
|
+
- **空状态欢迎页**:无消息时展示 Banner、`welcomeTitle`(默认「你好,我是小鲸」)与 `openingRemark`
|
|
41
35
|
|
|
42
36
|
## 组件结构
|
|
43
37
|
|
|
@@ -49,21 +43,18 @@ ai-chat-container(:data-ai-size="size")
|
|
|
49
43
|
│ ├── .ai-full-screen-wrapper(全屏目标容器,ref=fullScreenRef)
|
|
50
44
|
│ │ ├── Tab 标签页
|
|
51
45
|
│ │ │ ├── 执行情况(默认 Tab)
|
|
52
|
-
│ │ │ ├── 自定义 Tab × N(可关闭;标签可由
|
|
53
|
-
│ │ │ └── #setting
|
|
46
|
+
│ │ │ ├── 自定义 Tab × N(可关闭;标签可由 getSideTabRenderComponent 自定义)
|
|
47
|
+
│ │ │ └── #setting → 全屏/退出全屏 ToolBtn
|
|
54
48
|
│ │ ├── ExecutionSummary(执行情况 Tab 内容)
|
|
55
|
-
│ │ └── 自定义 Tab
|
|
56
|
-
│ └── collapse-button
|
|
49
|
+
│ │ └── 自定义 Tab 组件(getSideRenderComponent 优先,否则 data.component;可注入 #locateButton)
|
|
50
|
+
│ └── collapse-button(CollapsedIcon)
|
|
57
51
|
└── main(主内容区)
|
|
58
|
-
├── MessageContainer
|
|
59
|
-
|
|
60
|
-
│
|
|
61
|
-
|
|
62
|
-
├── 欢迎页(无消息时,容器 .ai-welcome-content)
|
|
63
|
-
│ └── welcome 插槽(默认:Banner + 欢迎标题 + 开场白 ContentRender;自定义则整块替换)
|
|
64
|
-
├── SelectionFooter(分享模式时)
|
|
52
|
+
├── MessageContainer(有消息时;#group / #message 可自定义)
|
|
53
|
+
├── 欢迎页(无消息时 .ai-welcome-content)
|
|
54
|
+
│ └── #welcome(默认:Banner + welcomeTitle + openingRemark;自定义则整块替换)
|
|
55
|
+
├── SelectionFooter(分享模式)
|
|
65
56
|
├── ShortcutRender(有快捷指令时)
|
|
66
|
-
└── ChatInput
|
|
57
|
+
└── ChatInput(透传 models / selectedModel;interrupt 槽展示 UserQuestionCard / InputInfoAlert)
|
|
67
58
|
```
|
|
68
59
|
|
|
69
60
|
## 基础用法
|
|
@@ -142,9 +133,9 @@ ai-chat-container(:data-ai-size="size")
|
|
|
142
133
|
|
|
143
134
|
侧边栏默认包含「执行情况」Tab,展示所有工具调用和 FlowAgent 类型的 Activity 消息。支持关键词搜索过滤和点击定位到对话中的消息位置。
|
|
144
135
|
|
|
145
|
-
**展示条件**:当 `executionGroups` 为空且 `keyword` 为空时,不渲染侧栏 Tab 与 `ExecutionSummary`(折叠按钮亦隐藏);主区域仍可正常展示 `messages` 中的对话内容。用户在执行情况中输入搜索词后,侧栏会保持展示以显示「搜索结果为空」等状态。`renderMode === Share`
|
|
136
|
+
**展示条件**:当 `executionGroups` 为空且 `keyword` 为空时,不渲染侧栏 Tab 与 `ExecutionSummary`(折叠按钮亦隐藏);主区域仍可正常展示 `messages` 中的对话内容。用户在执行情况中输入搜索词后,侧栏会保持展示以显示「搜索结果为空」等状态。`renderMode === Share` 分享态同样按上述执行数据条件展示侧栏(开放只读查看流程智能体详情/证据/执行情况),不再强制隐藏折叠;仅底部输入区保持隐藏。**例外**:当[「文件产物」Tab](#内置-文件产物-tab)存在时,侧栏不再受「`executionGroups` 为空」约束,可独立展示文件预览。
|
|
146
137
|
|
|
147
|
-
**自定义 Tab 联动**:当 `executionGroups` 变为空且搜索词已清空时,容器会**自动重置自定义 Tab**(`resetCustomTab`),避免残留节点详情等 Tab;若用户仍在搜索(`keyword`
|
|
138
|
+
**自定义 Tab 联动**:当 `executionGroups` 变为空且搜索词已清空时,容器会**自动重置自定义 Tab**(`resetCustomTab`),避免残留节点详情等 Tab;若用户仍在搜索(`keyword` 非空)或存在「文件产物」Tab,不会触发重置。
|
|
148
139
|
|
|
149
140
|
```vue
|
|
150
141
|
<template>
|
|
@@ -248,6 +239,83 @@ ai-chat-container(:data-ai-size="size")
|
|
|
248
239
|
</script>
|
|
249
240
|
```
|
|
250
241
|
|
|
242
|
+
### 内置「文件产物」Tab
|
|
243
|
+
|
|
244
|
+
除「执行情况」外,容器内置一个按需出现的固定 Tab —— **「文件产物」**(`name: 'file-artifact'`),用于聚合预览当前会话所有 `AssistantMessage.property.artifacts`:
|
|
245
|
+
|
|
246
|
+
- **触发**:点击 AI 回复中的文件卡片([ArtifactFileCard](/components/message/assistant-message))时,容器通过 `useArtifactPreviewProvider` 命中该文件并 `addCustomTab` 弹出侧栏
|
|
247
|
+
- **排序 / 关闭**:`order: -1` 排在「执行情况」之前,`closable: false` 不可关闭
|
|
248
|
+
- **显隐解耦**:该 Tab 存在时,侧栏展示不再受「`executionGroups` 为空」约束(即使当前会话没有执行类消息,也能独立展示文件产物侧栏);会话切换或无文件产物时自动移除并重置命中态
|
|
249
|
+
- **内容**:由 [FileArtifactPanel](/components/message/file-artifact-panel) 渲染列表与下载头,预览委托内部 `ArtifactPreviewHost`;`download_url` / `preview_url` 通过 `onArtifactClick` 异步获取。文本类(`html` / `markdown` / `md` / `txt` / `json`)拉 `download_url` 正文直渲染(`md` 与 `markdown` 等价);其余类型用 `preview_url` iframe(一般为后台转好的 PDF)
|
|
250
|
+
- **状态管理**:命中、切换与 URL 缓存由 [useArtifactPreview](/composables/use-artifact-preview) 提供(Provider 在容器内、Consumer 在文件卡片 / 面板内);正文加载与分类型渲染由 Host 内部完成
|
|
251
|
+
- **未传 `onArtifactClick`**:下载按钮隐藏,预览区展示无数据
|
|
252
|
+
|
|
253
|
+
详见 [FileArtifactPanel 文件产物预览](/components/message/file-artifact-panel) 与 [useArtifactPreview 文件产物预览](/composables/use-artifact-preview)。
|
|
254
|
+
|
|
255
|
+
#### 接入示例
|
|
256
|
+
|
|
257
|
+
```vue
|
|
258
|
+
<template>
|
|
259
|
+
<ChatContainer
|
|
260
|
+
v-model="input"
|
|
261
|
+
:messages="messages"
|
|
262
|
+
:on-artifact-click="onArtifactClick"
|
|
263
|
+
@send-message="handleSend"
|
|
264
|
+
/>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<script setup lang="ts">
|
|
268
|
+
import { ref, shallowRef } from 'vue'
|
|
269
|
+
import {
|
|
270
|
+
ChatContainer,
|
|
271
|
+
MessageRole,
|
|
272
|
+
MessageStatus,
|
|
273
|
+
type AIFileInfo,
|
|
274
|
+
type Message,
|
|
275
|
+
} from '@blueking/chat-x'
|
|
276
|
+
|
|
277
|
+
const input = ref('')
|
|
278
|
+
const messages = shallowRef<Message[]>([
|
|
279
|
+
{
|
|
280
|
+
id: 'u1',
|
|
281
|
+
messageId: 'u1',
|
|
282
|
+
role: MessageRole.User,
|
|
283
|
+
status: MessageStatus.Complete,
|
|
284
|
+
content: '整理本周评审材料',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 'a1',
|
|
288
|
+
messageId: 'a1',
|
|
289
|
+
uid: 'assistant-uid-1',
|
|
290
|
+
role: MessageRole.Assistant,
|
|
291
|
+
status: MessageStatus.Complete,
|
|
292
|
+
content: '已生成评审材料,点击卡片可在侧栏预览:',
|
|
293
|
+
property: {
|
|
294
|
+
artifacts: [
|
|
295
|
+
{ name: '周报.html', outputId: 'a-html', size: 10240, type: 'html' },
|
|
296
|
+
{ name: '说明.md', outputId: 'a-md', size: 8192, type: 'md' },
|
|
297
|
+
{ name: '配置.json', outputId: 'a-json', size: 2048, type: 'json' },
|
|
298
|
+
{ name: '立项.pdf', outputId: 'a-pdf', size: 204800, type: 'pdf' },
|
|
299
|
+
] satisfies AIFileInfo[],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
])
|
|
303
|
+
|
|
304
|
+
/** 文本类预览依赖 download_url;iframe 类依赖 preview_url */
|
|
305
|
+
const onArtifactClick = async (file: AIFileInfo) => {
|
|
306
|
+
const res = await api.getArtifactUrls(file.outputId)
|
|
307
|
+
return {
|
|
308
|
+
download_url: res.download_url,
|
|
309
|
+
preview_url: res.preview_url,
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const handleSend = () => {
|
|
314
|
+
/* ... */
|
|
315
|
+
}
|
|
316
|
+
</script>
|
|
317
|
+
```
|
|
318
|
+
|
|
251
319
|
### 自定义 Tab 与「在对话中定位」
|
|
252
320
|
|
|
253
321
|
`addCustomTab` 的 `data` 可携带 **`messageUid`**(与对应活动消息的 `message.uid` 一致)。`ChatContainer` 在侧栏用 `<component :is="sideRenderComponent">`(内部计算属性,见上文「侧栏渲染扩展」)渲染自定义 Tab 时,会向子组件提供 **`locateButton` 插槽**:默认渲染「在对话中定位」按钮,点击后调用内部 `handleLocateMessageGroup(messageUid)`,优先滚动到主区域 `document.getElementById(messageUid)`;若不存在该节点,则在当前 `messageGroups` 中查找包含 `message.uid === messageUid` 的消息组,并滚动到该组的容器(`MessageGroup.uid` 作为组级 `id`)。
|
|
@@ -296,7 +364,7 @@ ai-chat-container(:data-ai-size="size")
|
|
|
296
364
|
|
|
297
365
|
## 开场白
|
|
298
366
|
|
|
299
|
-
|
|
367
|
+
无消息时展示欢迎页:`welcomeTitle` 控制标题(未传时默认「你好,我是小鲸」),`openingRemark` 为开场白(支持 Markdown):
|
|
300
368
|
|
|
301
369
|
```vue
|
|
302
370
|
<template>
|
|
@@ -304,6 +372,7 @@ ai-chat-container(:data-ai-size="size")
|
|
|
304
372
|
v-model="inputValue"
|
|
305
373
|
:messages="[]"
|
|
306
374
|
:message-status="messageStatus"
|
|
375
|
+
welcome-title="你好,我是小鲸"
|
|
307
376
|
opening-remark="你好!我是 AI 小鲸 🐳,可以帮你:\n\n- 编写和优化代码\n- 解答技术问题\n- 分析和调试错误"
|
|
308
377
|
:on-send-message="handleSendMessage"
|
|
309
378
|
/>
|
|
@@ -312,7 +381,7 @@ ai-chat-container(:data-ai-size="size")
|
|
|
312
381
|
|
|
313
382
|
### 自定义欢迎内容
|
|
314
383
|
|
|
315
|
-
通过
|
|
384
|
+
通过 `#welcome` 可整块替换默认欢迎区,插槽参数为 `{ openingRemark, welcomeTitle }`:
|
|
316
385
|
|
|
317
386
|
```vue
|
|
318
387
|
<template>
|
|
@@ -320,12 +389,14 @@ ai-chat-container(:data-ai-size="size")
|
|
|
320
389
|
v-model="inputValue"
|
|
321
390
|
:messages="[]"
|
|
322
391
|
:message-status="messageStatus"
|
|
323
|
-
|
|
392
|
+
welcome-title="欢迎使用 AI 助手"
|
|
393
|
+
opening-remark="选择一个快捷入口开始对话"
|
|
324
394
|
:on-send-message="handleSendMessage"
|
|
325
395
|
>
|
|
326
|
-
<template #welcome="{ openingRemark }">
|
|
396
|
+
<template #welcome="{ openingRemark, welcomeTitle }">
|
|
327
397
|
<div class="my-welcome">
|
|
328
|
-
<h3>{{
|
|
398
|
+
<h3>{{ welcomeTitle }}</h3>
|
|
399
|
+
<p>{{ openingRemark }}</p>
|
|
329
400
|
<div class="quick-actions">
|
|
330
401
|
<button @click="handleQuickAction('code')">写代码</button>
|
|
331
402
|
<button @click="handleQuickAction('debug')">调试</button>
|
|
@@ -337,7 +408,7 @@ ai-chat-container(:data-ai-size="size")
|
|
|
337
408
|
</template>
|
|
338
409
|
```
|
|
339
410
|
|
|
340
|
-
> **注意**:使用
|
|
411
|
+
> **注意**:使用 `#welcome` 后将**整块替换**默认欢迎区(Banner、标题与开场白的 `ContentRender`),需自行编排完整欢迎页。
|
|
341
412
|
|
|
342
413
|
**渲染效果**
|
|
343
414
|
|
|
@@ -486,22 +557,103 @@ ai-chat-container(:data-ai-size="size")
|
|
|
486
557
|
</template>
|
|
487
558
|
|
|
488
559
|
<script setup lang="ts">
|
|
489
|
-
import { type Message } from '@blueking/chat-x';
|
|
560
|
+
import { type IToolBtn, type Message } from '@blueking/chat-x';
|
|
490
561
|
|
|
491
|
-
|
|
562
|
+
// 第二参数 source 为触发多选态的按钮对象,可据此区分 share / save 等不同确认场景
|
|
563
|
+
const handleConfirmShare = (selectedMessages: Message[], source?: IToolBtn) => {
|
|
564
|
+
if (source?.id === 'save') {
|
|
565
|
+
console.log('保存选中的消息:', selectedMessages);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
492
568
|
console.log('分享消息:', selectedMessages);
|
|
493
569
|
};
|
|
494
570
|
</script>
|
|
495
571
|
```
|
|
496
572
|
|
|
573
|
+
### 自定义按钮触发多选(triggerSelection)
|
|
574
|
+
|
|
575
|
+
除内置「分享」外,任意自定义工具按钮标记 `triggerSelection: true` 后,点击即可复用同一套多选流程(勾选消息 → `SelectionFooter` 确认),确认时同样触发 `confirmShare`。配合 `messageTools` / `updateTools`(合并规则见 [MessageContainer · 自定义消息工具栏](/components/setup/message-container))即可扩展如「保存」「收藏到空间」等批量操作。
|
|
576
|
+
|
|
577
|
+
```vue
|
|
578
|
+
<template>
|
|
579
|
+
<ChatContainer
|
|
580
|
+
v-model="inputValue"
|
|
581
|
+
:messages="messages"
|
|
582
|
+
message-status="complete"
|
|
583
|
+
:message-tools="customMessageTools"
|
|
584
|
+
:on-agent-action="handleAgentAction"
|
|
585
|
+
@confirm-share="handleConfirmShare"
|
|
586
|
+
/>
|
|
587
|
+
</template>
|
|
588
|
+
|
|
589
|
+
<script setup lang="ts">
|
|
590
|
+
import { DownloadIcon, type IToolBtn, type Message } from '@blueking/chat-x';
|
|
591
|
+
|
|
592
|
+
const customMessageTools: IToolBtn[] = [
|
|
593
|
+
// 追加「保存」按钮,点击进入多选态;确认走 confirmShare
|
|
594
|
+
{ id: 'save', name: '保存', description: '保存该回答', icon: DownloadIcon, triggerSelection: true },
|
|
595
|
+
];
|
|
596
|
+
|
|
597
|
+
const handleConfirmShare = (selectedMessages: Message[], source?: IToolBtn) => {
|
|
598
|
+
if (source?.id === 'save') {
|
|
599
|
+
// 处理「保存」批量确认
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
</script>
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
> `triggerSelection` 的按钮不会调用 `onAgentAction`,而是直接进入多选态;未标记该字段(且非 `share`)的按钮仍走 `onAgentAction`。
|
|
606
|
+
|
|
497
607
|
**渲染效果**(点击 AI 回复工具栏中的「分享」按钮进入多选模式)
|
|
498
608
|
|
|
499
609
|
**分享流程**:
|
|
500
610
|
|
|
501
|
-
1.
|
|
611
|
+
1. 用户点击消息工具栏中的「分享」按钮(或任意 `triggerSelection: true` 的自定义按钮)
|
|
502
612
|
2. 进入多选模式,用户勾选要分享的消息
|
|
503
613
|
3. 底部 `SelectionFooter` 提供全选、取消、确认操作
|
|
504
|
-
4. 确认后触发 `confirmShare`
|
|
614
|
+
4. 确认后触发 `confirmShare` 事件,携带选中的消息列表与触发按钮对象(`source`)
|
|
615
|
+
|
|
616
|
+
## 模型选择
|
|
617
|
+
|
|
618
|
+
`ChatContainer` 将 `models`、`v-model:selected-model` 与 `@model-change` 透传至内部 [ChatInput](/components/input/chat-input)。传入 `models` 后,发送按钮左侧展示 [ModelSelector](/components/input/model-selector);选中值为模型的 `llm_name`,发送时可读取当前 `selectedModel`。
|
|
619
|
+
|
|
620
|
+
```vue
|
|
621
|
+
<template>
|
|
622
|
+
<ChatContainer
|
|
623
|
+
v-model="inputValue"
|
|
624
|
+
v-model:selected-model="selectedModel"
|
|
625
|
+
:messages="messages"
|
|
626
|
+
message-status="complete"
|
|
627
|
+
:models="models"
|
|
628
|
+
:on-send-message="handleSendMessage"
|
|
629
|
+
@model-change="handleModelChange"
|
|
630
|
+
/>
|
|
631
|
+
</template>
|
|
632
|
+
|
|
633
|
+
<script setup lang="ts">
|
|
634
|
+
import { ref } from 'vue';
|
|
635
|
+
import { ChatContainer, type IModelOption, type Message, type TagSchema } from '@blueking/chat-x';
|
|
636
|
+
|
|
637
|
+
const inputValue = ref('');
|
|
638
|
+
// 选中值为 llm_name
|
|
639
|
+
const selectedModel = ref('GPT-4');
|
|
640
|
+
const messages = ref<Message[]>([]);
|
|
641
|
+
const models: IModelOption[] = [
|
|
642
|
+
{ id: 1, llm_name: 'GPT-4', property: { support_thinking: true } },
|
|
643
|
+
{ id: 2, llm_name: 'Claude 3', property: { support_thinking_quick: true } },
|
|
644
|
+
{ id: 3, llm_name: 'DeepSeek', property: { support_vision: true } },
|
|
645
|
+
];
|
|
646
|
+
|
|
647
|
+
const handleSendMessage = async (content: string, docSchema: TagSchema) => {
|
|
648
|
+
// 发送时可读取 selectedModel.value
|
|
649
|
+
};
|
|
650
|
+
const handleModelChange = (model: IModelOption) => {
|
|
651
|
+
console.log('切换模型:', model);
|
|
652
|
+
};
|
|
653
|
+
</script>
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
**渲染效果**(输入区发送按钮左侧可切换模型)
|
|
505
657
|
|
|
506
658
|
## 快捷指令
|
|
507
659
|
|
|
@@ -543,29 +695,33 @@ ai-chat-container(:data-ai-size="size")
|
|
|
543
695
|
|
|
544
696
|
ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`(排除 `enableSelection` 和 `messageGroups`),另外新增:
|
|
545
697
|
|
|
546
|
-
| 属性名
|
|
547
|
-
|
|
|
548
|
-
| chatLoading
|
|
549
|
-
| commonTippyOptions
|
|
550
|
-
| executionTabVisible
|
|
551
|
-
| getSideRenderComponent
|
|
552
|
-
| getSideTabRenderComponent
|
|
553
|
-
|
|
|
554
|
-
|
|
|
555
|
-
|
|
|
556
|
-
| resizeProps
|
|
557
|
-
|
|
|
558
|
-
|
|
559
|
-
|
|
698
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
699
|
+
| ------------------------- | ---------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
700
|
+
| chatLoading | `boolean` | — | 整体加载状态,`true` 时显示 Loading 遮罩 |
|
|
701
|
+
| commonTippyOptions | `AITippyProps` | — | 通用 Tippy 配置,注入到所有使用 `v-overflow-tips` 的子组件 |
|
|
702
|
+
| executionTabVisible | `boolean` | `true` | 「执行情况」Tab 是否展示;为 `false` 时从 Tab 栏隐藏,若正被选中则切到首个可见 Tab |
|
|
703
|
+
| getSideRenderComponent | `(h, props?) => VNode \| undefined` | — | 自定义侧栏内容区渲染;未返回时使用 `selectedTab.data.component` |
|
|
704
|
+
| getSideTabRenderComponent | `(h, tab, { removeCustomTab }) => VNode \| undefined` | — | 自定义侧栏 Tab 标签渲染;未返回时使用默认图标 + 文案 + 关闭按钮 |
|
|
705
|
+
| models | `IModelOption[]` | — | 可选模型列表(继承自 ChatInput);传入后在发送按钮左侧展示 ModelSelector |
|
|
706
|
+
| openingRemark | `string` | — | 开场白,无消息时显示,支持 Markdown |
|
|
707
|
+
| placement | `'left' \| 'right'` | `'left'` | 侧边栏位置 |
|
|
708
|
+
| resizeProps | `{ disabled?: boolean; initialDivide?: number \| string; max?: number; min?: number }` | — | 透传给内部 `ResizeLayout`;与默认 `collapsible: false`、`immediate: true`、`min: 400` 合并;`placement` 始终取自本组件。**数字型** `initialDivide` 还会作为内部侧栏宽度初值(驱动 `--resize-main-width`,并在展开时作为 `collapseChange` 的 `width`);百分比等字符串则回退为 `400` |
|
|
709
|
+
| size | `'normal' \| 'small'` | `'small'` | 字号主题:`small` 12px / `normal` 14px;根节点设置 `data-ai-size` 并注入 `useGlobalConfig` |
|
|
710
|
+
| welcomeTitle | `string` | — | 欢迎页标题;未传时默认展示「你好,我是小鲸」 |
|
|
711
|
+
| onCustomTabChange | `(tab: CustomTab) => Promise<any>` | — | 自定义 Tab 切换回调,返回值作为 Tab 组件 props |
|
|
712
|
+
| onArtifactClick | `(file: AIFileInfo) => Promise<{ download_url?: string; preview_url?: string }>` | — | 异步获取下载 / 预览链接(按 `outputId` 缓存)。文本类预览依赖 `download_url`,iframe 类依赖 `preview_url`;未传则隐藏下载、预览无数据 |
|
|
713
|
+
|
|
714
|
+
> 其余 Props(如 `messages`、`messageStatus`、`onSendMessage`、`shortcuts` 等)继承自 [ChatInput](/components/input/chat-input) 与 [MessageContainer](/components/setup/message-container)。
|
|
560
715
|
|
|
561
716
|
### v-model
|
|
562
717
|
|
|
563
|
-
| 属性名 | 类型 | 说明
|
|
564
|
-
| ---------------- | --------------------- |
|
|
565
|
-
| modelValue | `string \| TagSchema` | 输入框内容,支持纯文本或标签结构
|
|
566
|
-
| selectedShortcut | `Shortcut \| null` | 当前选中的快捷指令
|
|
567
|
-
| cite | `string` | 引用内容
|
|
568
|
-
| renderMode | `RenderMode` | 渲染模式(默认 `Chat`)。`Share`
|
|
718
|
+
| 属性名 | 类型 | 说明 |
|
|
719
|
+
| ---------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
720
|
+
| modelValue | `string \| TagSchema` | 输入框内容,支持纯文本或标签结构 |
|
|
721
|
+
| selectedShortcut | `Shortcut \| null` | 当前选中的快捷指令 |
|
|
722
|
+
| cite | `string` | 引用内容 |
|
|
723
|
+
| renderMode | `RenderMode` | 渲染模式(默认 `Chat`)。`Share` 开放侧栏只读查看并隐藏底部输入与交互操作;`Test` 隐藏分享按钮 |
|
|
724
|
+
| selectedModel | `string` | 当前选中模型的 `llm_name`,透传至 ChatInput 的 ModelSelector |
|
|
569
725
|
|
|
570
726
|
### Events
|
|
571
727
|
|
|
@@ -574,21 +730,22 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
574
730
|
| stopStreaming | — | 点击「停止生成」按钮 |
|
|
575
731
|
| shortcutClose | — | 关闭快捷指令表单 |
|
|
576
732
|
| shortcutSubmit | `(formModel: Record<string, unknown>)` | 提交快捷指令表单 |
|
|
577
|
-
| confirmShare | `(messages: Message[])`
|
|
733
|
+
| confirmShare | `(messages: Message[], source?: IToolBtn)` | 确认分享/多选,携带选中的消息与触发按钮对象(`source`,用于区分 share/save 等场景) |
|
|
578
734
|
| collapseChange | `(isCollapse: boolean, width: number)` | 侧边栏折叠/展开状态变化 |
|
|
579
735
|
| selectShortcut | `(shortcut: Shortcut)` | 选择快捷指令(继承自 ChatInput) |
|
|
580
736
|
| deleteShortcut | — | 删除已选快捷指令(继承自 ChatInput) |
|
|
737
|
+
| modelChange | `(model: IModelOption)` | 切换模型(继承自 ChatInput) |
|
|
581
738
|
|
|
582
739
|
### Slots
|
|
583
740
|
|
|
584
|
-
| 插槽名 | 参数
|
|
585
|
-
| ----------------- |
|
|
586
|
-
| codeHeader | `{ language: string; token: Token[] }`
|
|
587
|
-
| default |
|
|
588
|
-
| group | `{ group: MessageGroup }`
|
|
589
|
-
| interruptQuestion | `{ question, qIndex, answer, setAnswer, confirm }`
|
|
590
|
-
| message | `{ message, messageToolsStatus, onInterruptResume }`
|
|
591
|
-
| welcome | `{ openingRemark
|
|
741
|
+
| 插槽名 | 参数 | 说明 |
|
|
742
|
+
| ----------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
743
|
+
| codeHeader | `{ language: string; token: Token[] }` | 代码块头部自定义操作区域(定义于类型;透传链路同 MessageRender) |
|
|
744
|
+
| default | `{ messages, messageStatus, messageGroups, selectedUserMessages, messageToolsStatus, isShareMode, commonTippyOptions, handleAgentAction, onAgentFeedback, onInterruptResume, onUserAction, onUserInputConfirm, onUserShortcutConfirm }` | 自定义消息列表区域;未提供时渲染默认 `MessageContainer` |
|
|
745
|
+
| group | `{ group: MessageGroup }` | 自定义单个消息组,透传至 MessageContainer `#group`;替换默认 Checkbox、消息列表与工具栏 |
|
|
746
|
+
| interruptQuestion | `{ question, qIndex, answer, setAnswer, confirm }` | 自定义 UserQuestion 单题渲染,透传至 UserQuestionCard `#question` |
|
|
747
|
+
| message | `{ message, messageToolsStatus, onInterruptResume }` | 自定义单条消息;自定义中断消息时需继续透传 `onInterruptResume` |
|
|
748
|
+
| welcome | `{ openingRemark?: string; welcomeTitle?: string }` | 无消息时自定义欢迎页;传入则整块替换默认 Banner、标题与开场白 |
|
|
592
749
|
|
|
593
750
|
### Expose
|
|
594
751
|
|
|
@@ -633,7 +790,16 @@ ChatContainer 的 Props 继承自 `ChatInputProps` 和 `MessageContainerProps`
|
|
|
633
790
|
## 类型定义
|
|
634
791
|
|
|
635
792
|
```typescript
|
|
636
|
-
import {
|
|
793
|
+
import {
|
|
794
|
+
ChatContainer,
|
|
795
|
+
RenderMode,
|
|
796
|
+
MessageRole,
|
|
797
|
+
type CustomTab,
|
|
798
|
+
type IModelOption,
|
|
799
|
+
type MessageGroup,
|
|
800
|
+
type Shortcut,
|
|
801
|
+
type Message,
|
|
802
|
+
} from '@blueking/chat-x';
|
|
637
803
|
|
|
638
804
|
// 消息组(由 useMessageGroup 生成)
|
|
639
805
|
interface MessageGroup {
|
|
@@ -651,7 +817,33 @@ interface MessageGroup {
|
|
|
651
817
|
interface CustomTab<T = Record<string, unknown>> {
|
|
652
818
|
label: string;
|
|
653
819
|
name: string;
|
|
654
|
-
|
|
820
|
+
icon?: string;
|
|
821
|
+
order?: number; // 缺省 100;「执行情况」固定 0
|
|
822
|
+
visible?: boolean; // 缺省 true;false 时栏内隐藏,仍可程序化选中
|
|
823
|
+
closable?: boolean; // 缺省 true;「执行情况」强制不可关闭
|
|
824
|
+
data?: T & { messageUid?: string; component?: Component; props?: Record<string, unknown> };
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// 模型选项(透传至 ChatInput / ModelSelector,贴合后端接口结构;能力标签由 property 派生)
|
|
828
|
+
interface IModelOption {
|
|
829
|
+
id: number;
|
|
830
|
+
llm_code: string;
|
|
831
|
+
llm_name: string; // 展示名,同时作为选中值
|
|
832
|
+
llm_type: string;
|
|
833
|
+
space_auth_mode: string;
|
|
834
|
+
user_auth_mode: string;
|
|
835
|
+
max_token_size: number;
|
|
836
|
+
property: {
|
|
837
|
+
support_thinking?: boolean; // → 深度思考
|
|
838
|
+
support_thinking_quick?: boolean; // → 快速思考
|
|
839
|
+
support_vision?: boolean; // → 图生文
|
|
840
|
+
[key: string]: unknown;
|
|
841
|
+
};
|
|
842
|
+
icon?: string;
|
|
843
|
+
description?: string;
|
|
844
|
+
base_model?: string;
|
|
845
|
+
tag_names?: string[];
|
|
846
|
+
disabled?: boolean; // 前端扩展字段
|
|
655
847
|
}
|
|
656
848
|
|
|
657
849
|
// 快捷指令
|
|
@@ -666,10 +858,11 @@ interface Shortcut {
|
|
|
666
858
|
|
|
667
859
|
- [MessageContainer](/components/setup/message-container) — 消息列表区域
|
|
668
860
|
- [ChatInput](/components/input/chat-input) — 输入与快捷指令
|
|
861
|
+
- [ModelSelector](/components/input/model-selector) — 模型选择器(透传 `models` / `selectedModel`)
|
|
669
862
|
- [ShortcutRender](/components/input/shortcut-render) — 快捷指令表单
|
|
670
863
|
- [ExecutionSummary](/components/agent/execution-summary) — 执行摘要侧栏
|
|
671
864
|
- [SelectionFooter](/components/input/selection-footer) — 多选操作栏
|
|
672
|
-
- [ToolBtn](/components/feedback/tool-btn) —
|
|
865
|
+
- [ToolBtn](/components/feedback/tool-btn) — 侧栏全屏按钮
|
|
673
866
|
- [useFullScreen](/composables/use-full-screen) — 侧栏全屏控制
|
|
674
867
|
- [useGlobalConfig](/composables/use-global-config) — 注入 `size` 与 `supportUpload`
|
|
675
868
|
- [主题配置](/theme/theme) — 字号主题 CSS 变量
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
- **shortcut-btn** — 已选快捷指令以单按钮形式展示并可关闭
|
|
9
9
|
- **shortcut-render** — 快捷指令含 components 时由外层唤起表单渲染
|
|
10
10
|
- **chat-container** — 顶层聊天布局中作为输入区子组件
|
|
11
|
+
- **model-selector** — 传入 models 后在发送按钮左侧默认展示模型选择器
|
|
11
12
|
- **cite-content** — 消息引用区展示选中的上下文片段
|
|
12
13
|
|
|
13
14
|
---
|
|
@@ -38,6 +39,7 @@ ai-chat-input-container
|
|
|
38
39
|
├── FileUploadBtn(仅当 supportUpload 为 true 时显示,在 slot#attachment 外部)
|
|
39
40
|
├── 分隔线(仅当 supportUpload 为 true 且有快捷指令时显示)
|
|
40
41
|
├── slot#attachment(默认:ShortcutBtns 或已选 ShortcutBtn + 关闭图标)
|
|
42
|
+
├── slot#before-send(默认:传入 models 时渲染 ModelSelector)
|
|
41
43
|
└── slot#send-icon(默认:发送/停止图标,仅替换图标,按钮容器保留)
|
|
42
44
|
```
|
|
43
45
|
|
|
@@ -498,6 +500,57 @@ const handleSendMessage = async (
|
|
|
498
500
|
|
|
499
501
|
**渲染效果**(顶部自定义模型信息与中断提示)
|
|
500
502
|
|
|
503
|
+
## 模型选择
|
|
504
|
+
|
|
505
|
+
传入 `models` 后,会在发送按钮左侧展示 [ModelSelector](/components/input/model-selector)。选中值(模型的 `llm_name`)通过 `v-model:selected-model` 双向绑定,`@model-change` 可获取完整模型对象。能力标签由组件依据 `property` 自动派生。
|
|
506
|
+
|
|
507
|
+
```vue
|
|
508
|
+
<template>
|
|
509
|
+
<ChatInput
|
|
510
|
+
v-model="inputValue"
|
|
511
|
+
v-model:selected-model="selectedModel"
|
|
512
|
+
:message-status="messageStatus"
|
|
513
|
+
:models="models"
|
|
514
|
+
:on-send-message="handleSendMessage"
|
|
515
|
+
@model-change="handleModelChange"
|
|
516
|
+
/>
|
|
517
|
+
</template>
|
|
518
|
+
|
|
519
|
+
<script setup lang="ts">
|
|
520
|
+
import { ref } from 'vue';
|
|
521
|
+
import { ChatInput, MessageStatus, type IModelOption, type TagSchema } from '@blueking/chat-x';
|
|
522
|
+
|
|
523
|
+
const inputValue = ref('');
|
|
524
|
+
// 选中值为 llm_name
|
|
525
|
+
const selectedModel = ref('GPT-4');
|
|
526
|
+
const messageStatus = ref(MessageStatus.Complete);
|
|
527
|
+
const models: IModelOption[] = [
|
|
528
|
+
{ id: 1, llm_name: 'GPT-4', property: { support_thinking: true } },
|
|
529
|
+
{ id: 2, llm_name: 'Claude 3', property: {} },
|
|
530
|
+
];
|
|
531
|
+
|
|
532
|
+
const handleSendMessage = async (content: string, docSchema: TagSchema) => {
|
|
533
|
+
/* 发送时可读取 selectedModel.value */
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const handleModelChange = (model: IModelOption) => {
|
|
537
|
+
console.log('切换模型:', model);
|
|
538
|
+
};
|
|
539
|
+
</script>
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
也可通过 `#model-selector` 插槽完全自定义选择器,插槽参数为 `{ models, selectedModel }`:
|
|
543
|
+
|
|
544
|
+
```vue
|
|
545
|
+
<template>
|
|
546
|
+
<ChatInput v-model="inputValue" :models="models">
|
|
547
|
+
<template #model-selector="{ models, selectedModel }">
|
|
548
|
+
<span>当前:{{ selectedModel || '未选择' }}(共 {{ models.length }} 个)</span>
|
|
549
|
+
</template>
|
|
550
|
+
</ChatInput>
|
|
551
|
+
</template>
|
|
552
|
+
```
|
|
553
|
+
|
|
501
554
|
## Expose(模板引用)
|
|
502
555
|
|
|
503
556
|
通过 `ref` 获取组件实例后可调用以下方法:
|
|
@@ -532,12 +585,14 @@ const handleSendMessage = async (
|
|
|
532
585
|
| 属性名 | 类型 | 默认值 | 必填 | 说明 |
|
|
533
586
|
| ------------------ | -------------------------------------------------------------------------- | -------- | ---- | ------------------------------------------------------- |
|
|
534
587
|
| modelValue | `string \| TagSchema` | - | ✅ | 编辑器的值,支持 `v-model` |
|
|
588
|
+
| selectedModel | `string` | - | - | 当前选中模型的 `llm_name`,支持 `v-model:selected-model` |
|
|
535
589
|
| messageStatus | `MessageStatus` | - | - | 消息状态,控制按钮;输入为空时内部强制 `disabled` |
|
|
536
590
|
| cite | `string` | `''` | - | 引用内容,支持 `v-model:cite`,不为空时显示引用区 |
|
|
537
591
|
| skills | `ISkillListItem[]` | `[]` | - | Skill 列表,输入 `/` 触发,选中后插入 Skill 标签 |
|
|
538
592
|
| prompts | `string[]` | `[]` | - | Prompt 模板列表,输入 `\` 触发 |
|
|
539
593
|
| resources | `IAiSlashMenuItem[]` | `[]` | - | 资源列表,输入 `@` 触发,按 `type` 分组展示 |
|
|
540
594
|
| shortcuts | `Shortcut[]` | - | - | 快捷指令列表,显示在底部工具栏 |
|
|
595
|
+
| models | `IModelOption[]` | - | - | 可选模型列表,传入后在发送按钮左侧展示模型选择器 |
|
|
541
596
|
| shortcutId | `string` | - | - | 当前选中的快捷指令 ID,匹配时列表收起为已选样式 |
|
|
542
597
|
| placeholder | `string` | 见默认值 | - | 编辑器占位符,支持多行 |
|
|
543
598
|
| inputMaxHeight | `number` | `200` | - | 框体最大高度(px),有文件时自动加上文件预览区高度 |
|
|
@@ -563,6 +618,7 @@ const handleSendMessage = async (
|
|
|
563
618
|
| 事件名 | 参数 | 触发时机 |
|
|
564
619
|
| ----------------- | ------------------------------------------------------------------------ | --------------------------------------------------------- |
|
|
565
620
|
| update:modelValue | `(value: string \| TagSchema, selectedResourceList: IAiSlashMenuItem[])` | 编辑器值变化时触发;第二个参数为当前已选中的 `@` 资源列表 |
|
|
621
|
+
| modelChange | `(model: IModelOption)` | 用户切换模型时触发 |
|
|
566
622
|
| selectShortcut | `(shortcut: Shortcut)` | 点击底部快捷指令按钮 |
|
|
567
623
|
| deleteShortcut | - | 点击已选快捷指令旁的关闭按钮 |
|
|
568
624
|
|
|
@@ -575,6 +631,7 @@ const handleSendMessage = async (
|
|
|
575
631
|
| input-header | - | 框体内顶部,替换引用区(`CiteContent`) |
|
|
576
632
|
| files | `{ files: Partial<UploadFile>[] }` | 文件预览区 |
|
|
577
633
|
| attachment | - | 底部快捷指令区,`FileUploadBtn` 在其左侧,不受此 slot 影响 |
|
|
634
|
+
| model-selector | `{ models: IModelOption[]; selectedModel: string \| undefined }` | 发送按钮左侧模型选择区,默认渲染 ModelSelector |
|
|
578
635
|
| send-icon | - | 发送按钮内图标,按钮的点击逻辑和样式仍由组件控制 |
|
|
579
636
|
|
|
580
637
|
### Expose
|