@blueking/chat-x 0.0.49-beta.1 → 0.0.49-beta.10
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/constants.d.ts +1 -0
- package/dist/ag-ui/types/file.d.ts +1 -11
- package/dist/ag-ui/types/messages.d.ts +2 -0
- package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +12 -1
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +0 -2
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +6 -3
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/preview-strategy.d.ts +4 -5
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/code-preview.vue.d.ts +8 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/renderers/image-preview.vue.d.ts +7 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/use-artifact-preview-loader.d.ts +1 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/file-artifact-panel.vue.d.ts +1 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts +0 -1
- package/dist/components/chat-message/interrupt-message/user-question/use-user-question.d.ts +7 -2
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +15 -2
- package/dist/components/file-icon/file-icon.vue.d.ts +7 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/message-tools/message-time/format-message-time.d.ts +8 -0
- package/dist/components/message-tools/message-time/message-time.vue.d.ts +8 -0
- package/dist/components/message-tools/message-tools.vue.d.ts +11 -1
- package/dist/composables/use-artifact-preview.d.ts +8 -18
- package/dist/composables/use-container-scroll.d.ts +9 -2
- package/dist/composables/use-custom-tab.d.ts +7 -3
- package/dist/composables/use-global-config.d.ts +3 -0
- package/dist/composables/use-message-group.d.ts +145 -74
- package/dist/icons/file-icons.d.ts +4 -0
- package/dist/icons/file.d.ts +0 -18
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/tools.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2939 -2587
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +4 -1
- package/dist/mcp/generated/docs/assistant-message.md +28 -20
- package/dist/mcp/generated/docs/chat-container.md +36 -31
- package/dist/mcp/generated/docs/chat-input.md +2 -10
- package/dist/mcp/generated/docs/constants.md +3 -1
- package/dist/mcp/generated/docs/content-render.md +2 -10
- package/dist/mcp/generated/docs/execution-summary.md +3 -3
- package/dist/mcp/generated/docs/file-artifact-panel.md +60 -46
- package/dist/mcp/generated/docs/file-icon.md +111 -0
- package/dist/mcp/generated/docs/info-message.md +6 -5
- package/dist/mcp/generated/docs/interrupt.md +1 -0
- package/dist/mcp/generated/docs/message-container.md +27 -23
- package/dist/mcp/generated/docs/message-render.md +4 -27
- package/dist/mcp/generated/docs/message-time.md +180 -0
- package/dist/mcp/generated/docs/message-tools.md +47 -12
- package/dist/mcp/generated/docs/messages.md +9 -0
- package/dist/mcp/generated/docs/reasoning-message.md +2 -9
- package/dist/mcp/generated/docs/toolcall-render.md +18 -10
- package/dist/mcp/generated/docs/use-artifact-preview.md +52 -55
- package/dist/mcp/generated/docs/use-container-scroll.md +6 -2
- package/dist/mcp/generated/docs/use-custom-tab.md +25 -8
- package/dist/mcp/generated/docs/use-global-config.md +15 -5
- package/dist/mcp/generated/docs/use-message-group.md +21 -13
- package/dist/mcp/generated/docs/user-message.md +6 -0
- package/dist/mcp/generated/docs/user-question-card.md +6 -3
- package/dist/mcp/generated/index.json +68 -12
- package/dist/utils/file-type.d.ts +14 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/chat-message/assistant-message/message-artifacts/file-icon.d.ts +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
useCustomTabProvider 返回 tabs、selectedTab、isCollapse 及 add/remove/selectCustomTab,并通过 provide 共享;可选 onTabChange
|
|
4
|
+
useCustomTabProvider 返回 tabs、selectedTab、isCollapse 及 add/ensure/remove/selectCustomTab,并通过 provide 共享;可选 onTabChange 在切换时拉取数据、可选 collapsed 注入受控折叠态 ref。 ensureCustomTab 只挂载/合并元信息,不展开侧栏、不主动切换选中;addCustomTab 会展开并选中。 未被主动切换过时,选中态默认跟随 Tab 栏首位(order 最小),如常驻的「文件产物」。 useCustomTabConsumer 在后代注入同一套 API,常用于侧栏动态节点详情等。EXECUTION_TAB_NAME 标识默认「执行情况」Tab。 ChatContainer 侧栏集成 Provider 与 Tab UI。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **chat-container** — Provider 与侧栏 Tab 主场景
|
|
@@ -21,6 +21,8 @@ Provider/Consumer 模式的自定义 Tab 管理,用于 `ChatContainer` 侧边
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
function useCustomTabProvider<T extends Record<string, unknown>>(options: {
|
|
24
|
+
// 侧栏折叠态;由容器传入受控 ref(如 ChatContainer 的 v-model:asideCollapsed),缺省内部自持
|
|
25
|
+
collapsed?: Ref<boolean>;
|
|
24
26
|
// 执行情况 Tab 是否展示,缺省 true;传 getter 以保持响应式
|
|
25
27
|
executionTabVisible?: () => boolean | undefined;
|
|
26
28
|
onTabChange?: (tab: CustomTab<T>) => void;
|
|
@@ -28,8 +30,9 @@ function useCustomTabProvider<T extends Record<string, unknown>>(options: {
|
|
|
28
30
|
tabs: ShallowRef<CustomTab<T>[]>;
|
|
29
31
|
displayTabs: ComputedRef<CustomTab<T>[]>;
|
|
30
32
|
selectedTab: Ref<CustomTab<T>>;
|
|
31
|
-
isCollapse:
|
|
33
|
+
isCollapse: Ref<boolean>;
|
|
32
34
|
addCustomTab: (tab: CustomTab<T>) => void;
|
|
35
|
+
ensureCustomTab: (tab: CustomTab<T>) => void;
|
|
33
36
|
removeCustomTab: (tabName: string) => void;
|
|
34
37
|
selectCustomTab: (tab: CustomTab<T>) => void;
|
|
35
38
|
resetCustomTab: () => void;
|
|
@@ -46,6 +49,7 @@ function useCustomTabConsumer<T extends Record<string, unknown>>():
|
|
|
46
49
|
displayTabs: ComputedRef<CustomTab<T>[]>;
|
|
47
50
|
selectedTab: ShallowRef<CustomTab<T> | null>;
|
|
48
51
|
addCustomTab: (tab: CustomTab<T>) => void;
|
|
52
|
+
ensureCustomTab: (tab: CustomTab<T>) => void;
|
|
49
53
|
removeCustomTab: (tabName: string) => void;
|
|
50
54
|
selectCustomTab: (tab: CustomTab<T>) => void;
|
|
51
55
|
resetCustomTab: () => void;
|
|
@@ -59,7 +63,7 @@ function useCustomTabConsumer<T extends Record<string, unknown>>():
|
|
|
59
63
|
```typescript
|
|
60
64
|
import { useCustomTabProvider, EXECUTION_TAB_NAME } from '@blueking/chat-x';
|
|
61
65
|
|
|
62
|
-
const { tabs, selectedTab, isCollapse, addCustomTab, removeCustomTab, selectCustomTab, resetCustomTab } =
|
|
66
|
+
const { tabs, selectedTab, isCollapse, addCustomTab, ensureCustomTab, removeCustomTab, selectCustomTab, resetCustomTab } =
|
|
63
67
|
useCustomTabProvider({
|
|
64
68
|
onTabChange: async tab => {
|
|
65
69
|
// Tab 切换时加载数据
|
|
@@ -76,7 +80,7 @@ import { useCustomTabConsumer } from '@blueking/chat-x';
|
|
|
76
80
|
|
|
77
81
|
const tabManager = useCustomTabConsumer();
|
|
78
82
|
|
|
79
|
-
// 添加一个自定义 Tab
|
|
83
|
+
// 添加一个自定义 Tab(展开侧栏并选中)
|
|
80
84
|
tabManager?.addCustomTab({
|
|
81
85
|
name: 'node-detail-123',
|
|
82
86
|
label: '节点详情',
|
|
@@ -86,6 +90,14 @@ tabManager?.addCustomTab({
|
|
|
86
90
|
},
|
|
87
91
|
});
|
|
88
92
|
|
|
93
|
+
// 仅确保 Tab 存在(不展开、不切换选中)—— 如常驻挂上文件产物 Tab
|
|
94
|
+
tabManager?.ensureCustomTab({
|
|
95
|
+
name: 'file-artifact',
|
|
96
|
+
label: '文件产物',
|
|
97
|
+
closable: false,
|
|
98
|
+
order: -1,
|
|
99
|
+
});
|
|
100
|
+
|
|
89
101
|
// 移除 Tab
|
|
90
102
|
tabManager?.removeCustomTab('node-detail-123');
|
|
91
103
|
```
|
|
@@ -104,9 +116,10 @@ tabManager?.removeCustomTab('node-detail-123');
|
|
|
104
116
|
| --------------- | --------------------------- | ------------------------------------------------- |
|
|
105
117
|
| tabs | `ShallowRef<CustomTab[]>` | 所有 Tab 列表(含默认的执行情况 Tab,保留隐藏项) |
|
|
106
118
|
| displayTabs | `ComputedRef<CustomTab[]>` | Tab 栏实际展示列表:过滤 `visible === false`,按 `order` 升序稳定排序 |
|
|
107
|
-
| selectedTab | `Ref<CustomTab>` | 当前选中的 Tab
|
|
108
|
-
| isCollapse | `
|
|
109
|
-
| addCustomTab | `(tab: CustomTab) => void` |
|
|
119
|
+
| selectedTab | `Ref<CustomTab>` | 当前选中的 Tab;未被主动切换过时跟随 Tab 栏首位,选中项被隐藏时自动回退到首个可见 Tab |
|
|
120
|
+
| isCollapse | `Ref<boolean>` | 侧边栏折叠状态;传入 `collapsed` 时即该受控 ref(读写都作用于外部),否则为内部状态;`addCustomTab` 时自动设为 `false` |
|
|
121
|
+
| addCustomTab | `(tab: CustomTab) => void` | 添加/合并 Tab,**展开侧栏并选中**目标 Tab |
|
|
122
|
+
| ensureCustomTab | `(tab: CustomTab) => void` | 添加/合并 Tab,**不展开、不主动切换选中**;用于常驻挂载(如文件产物) |
|
|
110
123
|
| removeCustomTab | `(tabName: string) => void` | 移除指定 Tab |
|
|
111
124
|
| selectCustomTab | `(tab: CustomTab) => void` | 切换到指定 Tab,触发 `onTabChange` 回调 |
|
|
112
125
|
| resetCustomTab | `() => void` | 重置为仅保留「执行情况」Tab、折叠侧栏并选中默认 Tab;`ChatContainer` 在卸载时调用,避免残留自定义 Tab |
|
|
@@ -136,7 +149,11 @@ interface CustomTab<T = Record<string, unknown>> {
|
|
|
136
149
|
- 排序为稳定排序,`order` 相同的 Tab 保持插入先后顺序
|
|
137
150
|
- 选中的 Tab 被配置隐藏时,内容不再渲染,自动切换到首个可见 Tab
|
|
138
151
|
- `addCustomTab` 同时展开侧边栏(`isCollapse = false`)并在 `nextTick` 后自动选中目标 Tab;同名 Tab 合并更新
|
|
152
|
+
- `ensureCustomTab` 与 `addCustomTab` 共用合并逻辑,但不改 `isCollapse`、自身不切换 `selectedTab`;适合「常驻挂载文件产物 Tab」等场景
|
|
153
|
+
- 默认选中跟随 Tab 栏首位:只要没调用过 `selectCustomTab` / `addCustomTab`,挂上更靠前(`order` 更小)的 Tab 就会成为选中项,因此常驻的「文件产物」(`order: -1`)是侧栏默认面板;一旦主动切换过便不再跟随。`resetCustomTab` 会重置该标记
|
|
154
|
+
- 折叠态支持受控:传入 `collapsed` 后 Provider 不再自持状态,内部展开动作直接写回该 ref,容器即可通过 `v-model` 把状态交给外部判断
|
|
139
155
|
|
|
140
156
|
## 关联组件
|
|
141
157
|
|
|
142
|
-
- [ChatContainer](../components/setup/chat-container) — 侧栏 Tab 与自定义面板
|
|
158
|
+
- [ChatContainer](../components/setup/chat-container) — 侧栏 Tab 与自定义面板
|
|
159
|
+
- [useArtifactPreview](./use-artifact-preview) — 文件产物 Tab:初始化 `ensureCustomTab` 常驻挂载,点击卡片时 `addCustomTab`
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
useGlobalConfig 接收 GlobalConfig(含 size?: ComputedRef<AiSizeMode>、supportUpload: ComputedRef<boolean>),以 GLOBAL_CONFIG_TOKEN provide 给后代; injectGlobalConfig 在子组件中取出配置,无 Provider 时返回 undefined。ChatContainer 在 setup 中调用 useGlobalConfig 注入 size 与
|
|
4
|
+
useGlobalConfig 接收 GlobalConfig(含 size?: ComputedRef<AiSizeMode>、supportUpload: ComputedRef<boolean>、timezone?: ComputedRef<string | undefined>),以 GLOBAL_CONFIG_TOKEN provide 给后代; injectGlobalConfig 在子组件中取出配置,无 Provider 时返回 undefined。ChatContainer 在 setup 中调用 useGlobalConfig 注入 size、supportUpload 与 timezone; 后代组件可通过 injectGlobalConfig 读取配置;字号主题主要通过根节点 data-ai-size 与 CSS 变量生效。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **chat-container** — 根容器调用 useGlobalConfig 注入 supportUpload
|
|
8
|
+
- **message-time** — 消息时间组件读取 timezone
|
|
8
9
|
|
|
9
10
|
---
|
|
10
11
|
<!-- FULL DOC -->
|
|
@@ -13,7 +14,7 @@ useGlobalConfig 接收 GlobalConfig(含 size?: ComputedRef<AiSizeMode>、suppo
|
|
|
13
14
|
|
|
14
15
|
> **分类**:composable
|
|
15
16
|
|
|
16
|
-
在聊天容器根组件与子组件之间通过 Vue `provide` / `inject` 共享**全局展示相关配置**(当前包括字号主题档位 `size`、是否支持上传 `supportUpload`)。与 Teleport 插槽 ID 无关。
|
|
17
|
+
在聊天容器根组件与子组件之间通过 Vue `provide` / `inject` 共享**全局展示相关配置**(当前包括字号主题档位 `size`、是否支持上传 `supportUpload`、消息时间时区 `timezone`)。与 Teleport 插槽 ID 无关。
|
|
17
18
|
|
|
18
19
|
> 字号主题主要通过 `ChatContainer` 根节点的 `data-ai-size` 与 CSS 变量(`--ai-font-size` 等)生效;`GlobalConfig.size` 供后代在逻辑层读取当前档位,样式层无需逐组件传参。
|
|
19
20
|
|
|
@@ -25,10 +26,11 @@ ChatContainer(根)
|
|
|
25
26
|
├── useGlobalConfig({
|
|
26
27
|
│ size: computed(() => props.size ?? 'small'),
|
|
27
28
|
│ supportUpload: computed(() => props.supportUpload ?? false),
|
|
29
|
+
│ timezone: computed(() => props.timezone),
|
|
28
30
|
│ })
|
|
29
|
-
│ └── provide(GLOBAL_CONFIG_TOKEN, { size, supportUpload })
|
|
31
|
+
│ └── provide(GLOBAL_CONFIG_TOKEN, { size, supportUpload, timezone })
|
|
30
32
|
│
|
|
31
|
-
└── MessageContainer → … → UserMessage 等
|
|
33
|
+
└── MessageContainer → … → UserMessage / MessageTime 等
|
|
32
34
|
|
|
33
35
|
UserMessage(后代)
|
|
34
36
|
├── injectGlobalConfig()
|
|
@@ -51,11 +53,14 @@ UserMessage(后代)
|
|
|
51
53
|
const props = defineProps<{
|
|
52
54
|
size?: 'normal' | 'small';
|
|
53
55
|
supportUpload?: boolean;
|
|
56
|
+
timezone?: string;
|
|
54
57
|
}>();
|
|
55
58
|
|
|
56
59
|
useGlobalConfig({
|
|
57
60
|
size: computed(() => props.size ?? 'small'),
|
|
58
61
|
supportUpload: computed(() => props.supportUpload ?? false),
|
|
62
|
+
// 无默认值:未配置时由 MessageTime 回退到浏览器时区
|
|
63
|
+
timezone: computed(() => props.timezone),
|
|
59
64
|
});
|
|
60
65
|
</script>
|
|
61
66
|
```
|
|
@@ -88,11 +93,13 @@ export type AiSizeMode = 'normal' | 'small';
|
|
|
88
93
|
export type GlobalConfig = {
|
|
89
94
|
size?: ComputedRef<AiSizeMode>;
|
|
90
95
|
supportUpload: ComputedRef<boolean>;
|
|
96
|
+
timezone?: ComputedRef<string | undefined>;
|
|
91
97
|
};
|
|
92
98
|
|
|
93
99
|
export function useGlobalConfig(options: GlobalConfig): {
|
|
94
100
|
size?: ComputedRef<AiSizeMode>;
|
|
95
101
|
supportUpload: ComputedRef<boolean>;
|
|
102
|
+
timezone?: ComputedRef<string | undefined>;
|
|
96
103
|
};
|
|
97
104
|
|
|
98
105
|
export function injectGlobalConfig(): GlobalConfig | undefined;
|
|
@@ -110,6 +117,7 @@ export function injectGlobalConfig(): GlobalConfig | undefined;
|
|
|
110
117
|
| --------------- | ------------------------------------------------------------------------ |
|
|
111
118
|
| `size` | 可选。字号主题档位 `normal`(14px)/ `small`(12px),与 `ChatContainer.size` 对齐 |
|
|
112
119
|
| `supportUpload` | 是否支持上传,与根容器 `ChatContainer` 的 `supportUpload` 等展示策略对齐 |
|
|
120
|
+
| `timezone` | 可选。消息时间展示所用的 IANA 时区名,与 `ChatContainer.timezone` 对齐;未配置时 `MessageTime` 按浏览器时区展示 |
|
|
113
121
|
|
|
114
122
|
### `useGlobalConfig(options)`
|
|
115
123
|
|
|
@@ -117,6 +125,7 @@ export function injectGlobalConfig(): GlobalConfig | undefined;
|
|
|
117
125
|
| ----------------------- | ------------------------------------------------------------------------------------- |
|
|
118
126
|
| `options.size` | 可选。字号主题档位,建议使用 `computed(() => props.size ?? 'small')` 与根 props 同步 |
|
|
119
127
|
| `options.supportUpload` | 是否支持上传,建议使用 `computed(() => props.supportUpload ?? false)` 与根 props 同步 |
|
|
128
|
+
| `options.timezone` | 可选。消息时间时区,建议使用 `computed(() => props.timezone)` 与根 props 同步;不设默认值,交由 `MessageTime` 回退浏览器时区 |
|
|
120
129
|
|
|
121
130
|
- 调用后立即 `provide(GLOBAL_CONFIG_TOKEN, options)`。
|
|
122
131
|
- 必须在具有组件实例上下文的 `setup` 中调用(与 Vue `provide` 要求一致)。
|
|
@@ -136,5 +145,6 @@ export function injectGlobalConfig(): GlobalConfig | undefined;
|
|
|
136
145
|
|
|
137
146
|
## 关联组件
|
|
138
147
|
|
|
139
|
-
- [ChatContainer](../components/setup/chat-container) — 调用 `useGlobalConfig` 注入 `size` 与 `
|
|
148
|
+
- [ChatContainer](../components/setup/chat-container) — 调用 `useGlobalConfig` 注入 `size`、`supportUpload` 与 `timezone`
|
|
149
|
+
- [MessageTime](../components/feedback/message-time) — 读取 `timezone` 展示消息时间
|
|
140
150
|
- [主题配置](../theme/theme) — `data-ai-size` 与 CSS 变量说明
|
|
@@ -71,15 +71,18 @@ role=user role=tool 其他 role
|
|
|
71
71
|
`role: 'tool'` 消息不会独立渲染,而是通过 `toolCallId` 注入到对应 AssistantMessage 的 `toolCall.toolMessage` 字段:
|
|
72
72
|
|
|
73
73
|
```typescript
|
|
74
|
-
const
|
|
74
|
+
const assistantToolMessage = messages.find(
|
|
75
75
|
m => m.role === 'assistant' && m.toolCalls?.some(t => t.id === message.toolCallId),
|
|
76
|
-
);
|
|
77
|
-
if (
|
|
78
|
-
const toolCall =
|
|
76
|
+
) as AssistantMessage | undefined;
|
|
77
|
+
if (assistantToolMessage) {
|
|
78
|
+
const toolCall = assistantToolMessage.toolCalls?.find(t => t.id === message.toolCallId);
|
|
79
79
|
if (toolCall) {
|
|
80
80
|
toolCall.toolMessage = message;
|
|
81
81
|
}
|
|
82
|
-
//
|
|
82
|
+
// error 时强制 assistant 为 Error;否则保留原 status,空值兜底 Complete
|
|
83
|
+
assistantToolMessage.status = message.error
|
|
84
|
+
? MessageStatus.Error
|
|
85
|
+
: assistantToolMessage.status || MessageStatus.Complete;
|
|
83
86
|
}
|
|
84
87
|
```
|
|
85
88
|
|
|
@@ -119,24 +122,29 @@ const isExecutionMessage = (m: Message): boolean => {
|
|
|
119
122
|
|
|
120
123
|
## sessionArtifacts 会话级文件产物
|
|
121
124
|
|
|
122
|
-
`sessionArtifacts` 拍平当前会话所有 `AssistantMessage.property.artifacts`,供 `ChatContainer` 侧栏「文件产物」Tab
|
|
125
|
+
`sessionArtifacts` 拍平当前会话所有 `AssistantMessage.property.artifacts`,供 `ChatContainer` 侧栏「文件产物」Tab 聚合预览。以 **`outputId`** 为会话内唯一键去重(同 `outputId` 视为同一文件),保留最后一次出现的文件信息,列表顺序与「最后一次出现」的相对顺序一致:
|
|
123
126
|
|
|
124
127
|
```typescript
|
|
125
128
|
const sessionArtifacts = computed(() => {
|
|
126
|
-
|
|
129
|
+
// delete + set:同 key 覆盖内容,并把该项挪到 Map 末尾,保证「最后出现」顺序
|
|
130
|
+
const byOutputId = new Map();
|
|
127
131
|
for (const message of messages.value) {
|
|
128
132
|
if (message.role !== MessageRole.Assistant) continue;
|
|
129
133
|
const artifacts = message.property?.artifacts;
|
|
130
134
|
if (!artifacts?.length) continue;
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
for (const file of artifacts) {
|
|
136
|
+
if (byOutputId.has(file.outputId)) {
|
|
137
|
+
byOutputId.delete(file.outputId);
|
|
138
|
+
}
|
|
139
|
+
byOutputId.set(file.outputId, file);
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
|
-
return
|
|
142
|
+
return Array.from(byOutputId.values());
|
|
137
143
|
});
|
|
138
144
|
```
|
|
139
145
|
|
|
146
|
+
> `SessionArtifact` 即为 `AIFileInfo` 别名;文件名可能重复,不可作唯一键。
|
|
147
|
+
|
|
140
148
|
预览命中与取链见 [useArtifactPreview](./use-artifact-preview);侧栏列表与分类型预览(`ArtifactPreviewHost`)见 [FileArtifactPanel](../components/message/file-artifact-panel)。
|
|
141
149
|
|
|
142
150
|
## 待审批统计
|
|
@@ -209,7 +217,7 @@ const {
|
|
|
209
217
|
| ---------------- | ----------------------------- | --------------------------------------------------------------------------- |
|
|
210
218
|
| messageGroups | `Ref<MessageGroup[]>` | 完整消息分组列表 |
|
|
211
219
|
| executionGroups | `ComputedRef<MessageGroup[]>` | 仅包含执行类消息的分组(工具调用 + FlowAgent),自动提取 `userMessageTitle` |
|
|
212
|
-
| sessionArtifacts | `ComputedRef<SessionArtifact[]>` | 拍平会话所有 AssistantMessage
|
|
220
|
+
| sessionArtifacts | `ComputedRef<SessionArtifact[]>` | 拍平会话所有 AssistantMessage 文件产物,按 `outputId` 去重(保留最后一次) |
|
|
213
221
|
| pendingApprovalCount | `ComputedRef<number>` | 当前消息中待审批 AI Dev 审批中断的数量 |
|
|
214
222
|
| pendingApprovalTipText | `ComputedRef<string>` | 待审批阻塞发送提示文案;无待审批时为空字符串 |
|
|
215
223
|
| isShareMode | `ShallowRef<boolean>` | 是否处于分享模式 |
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **message-render** — 由 MessageRender 在 role 为 user 时创建
|
|
8
8
|
- **message-tools** — 消息工具栏交互与状态由 MessageTools 体系承载
|
|
9
|
+
- **message-time** — createdAt 经工具栏 prepend 插槽展示
|
|
9
10
|
- **message-container** — 嵌入列表时由 MessageContainer 管理分组与多选
|
|
10
11
|
- **chat-input** — 编辑态普通消息使用 ChatInput
|
|
11
12
|
|
|
@@ -47,8 +48,11 @@
|
|
|
47
48
|
v-if: messageToolsStatus !== 'hidden'
|
|
48
49
|
visibility: hidden(默认)→ visible(:hover 时)
|
|
49
50
|
tools: [copy, cite, edit, delete],updateTools: []
|
|
51
|
+
#prepend slot → MessageTime(createdAt,工具图标左侧)
|
|
50
52
|
```
|
|
51
53
|
|
|
54
|
+
> **时间随工具栏显隐**:时间位于工具栏内,与工具按钮共用 `visibility` 控制,因此同样在悬停消息时才可见。
|
|
55
|
+
|
|
52
56
|
**编辑模式**(点击 `edit` 按钮后 `isEdit=true`)
|
|
53
57
|
|
|
54
58
|
```
|
|
@@ -356,6 +360,7 @@ binaryFiles 有值 → 进入编辑模式(editContent 可为空)
|
|
|
356
360
|
| 属性名 | 类型 | 说明 |
|
|
357
361
|
| ------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
|
|
358
362
|
| content | `string \| InputContent[]` | 消息内容,字符串或含 text/binary 的数组 |
|
|
363
|
+
| createdAt | `number \| string` | 消息创建时间,经 `MessageTools` 的 `#prepend` 插槽交给 `MessageTime` 渲染在工具图标左侧;无值时不展示 |
|
|
359
364
|
| property | `{ extra?: MessageExtra; artifacts?: AIFileInfo[] }` | 附加属性;本组件消费 `extra.cite` / `shortcut` / `context` |
|
|
360
365
|
| messageToolsStatus | `MessageToolsStatus` | 工具按钮状态,`disabled` 禁用、`hidden` 从 DOM 移除 |
|
|
361
366
|
| onAction | `MessageToolsProps['onAction']` | 工具回调;`copy`/`edit` 有内置行为,`cite`/`delete` 需外部处理 |
|
|
@@ -417,4 +422,5 @@ type MessageExtra = {
|
|
|
417
422
|
|
|
418
423
|
- [MessageRender](/components/message/message-render) — user 角色由其实例化
|
|
419
424
|
- [MessageTools](/components/feedback/message-tools) — 工具栏交互
|
|
425
|
+
- [MessageTime](/components/feedback/message-time) — 工具栏左侧的消息时间
|
|
420
426
|
- [MessageContainer](/components/setup/message-container) — 列表与多选容器
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- AI SUMMARY -->
|
|
2
2
|
## 快速了解
|
|
3
3
|
|
|
4
|
-
渲染 UserQuestion
|
|
4
|
+
渲染 UserQuestion 中断的待回答面板:一次只展示一题,标题栏提供题号切换, Footer 展示已完成进度;支持单选自动跳下一题、多选/Others、完成与跳过。 源码位置:src/components/chat-message/interrupt-message/user-question/user-question-card.vue。
|
|
5
5
|
|
|
6
6
|
### 关联组件
|
|
7
7
|
- **interrupt-message** — outcome.success 时挂载 UserQuestionAnsweredCard 回显回答
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
- **源码位置**:`src/components/chat-message/interrupt-message/user-question/user-question-card.vue`
|
|
18
18
|
- **能力域**:Agent 能力
|
|
19
|
-
- **能力说明**:渲染 UserQuestion
|
|
19
|
+
- **能力说明**:渲染 UserQuestion 中断的待回答面板;一次一题分页切换,支持单选/多选、Others、跳过与已完成进度。
|
|
20
20
|
|
|
21
21
|
> **能力域**:Agent 能力
|
|
22
22
|
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
## 交互能力
|
|
26
26
|
|
|
27
|
+
- **一次一题**:正文只展示当前题;标题栏右侧提供 `< 当前题 / 总题数 >` 切换定位(单题为 `1 / 1`),首末题对应箭头禁用。
|
|
28
|
+
- **自动跳转**:单选预设选项从未答变为有效答时,自动跳到下一题(最后一题停留);多选与 Others 不自动跳,靠箭头切换。
|
|
29
|
+
- **已完成进度**:Footer 左侧展示「已完成 N 题」;右侧为「跳过」+「完成」。
|
|
27
30
|
- **单选 / 多选**:每道题通过 `multiSelect` 控制选择行为;未传时不展示单选/多选标签,默认仍按单选处理。
|
|
28
31
|
- **Others 自由输入**:默认 [UserQuestionChoice](/components/agent/user-question-choice) 为每道题追加 `label: 'others'` 输入项,输入文本写入 `answer[].description`。
|
|
29
32
|
- **自定义作答形态**:通过 `#question` slot 可替换默认选择题,渲染任意表单;作答有效时调用 `setAnswer` 回传 `UserQuestionAnswerItem`,无效时传 `undefined`。
|
|
@@ -142,7 +145,7 @@ const payload = {
|
|
|
142
145
|
/>
|
|
143
146
|
```
|
|
144
147
|
|
|
145
|
-
-
|
|
148
|
+
- 卡片内「跳过 / 完成」→ `onInterruptResume(payload, interrupt)`(Footer 右置,跳过在前、完成在后)
|
|
146
149
|
- 输入框直接发送 → `onSendMessage(content, docSchema, { interrupt, payload })`,其中 `payload` 由 `buildSkipResumePayload(interrupt)` 生成(`status: 'cancelled'`)
|
|
147
150
|
|
|
148
151
|
## 工具函数 buildSkipResumePayload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "2.0.0",
|
|
3
|
-
"generatedAt": "2026-
|
|
3
|
+
"generatedAt": "2026-08-18T06:27:42.645Z",
|
|
4
4
|
"domains": {
|
|
5
5
|
"setup": {
|
|
6
6
|
"label": "对话搭建",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"label": "工具与反馈",
|
|
84
84
|
"components": [
|
|
85
85
|
"delete-tool",
|
|
86
|
+
"message-time",
|
|
86
87
|
"message-tools",
|
|
87
88
|
"scroll-btn",
|
|
88
89
|
"tool-btn",
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
"components": [
|
|
99
100
|
"activity-layout",
|
|
100
101
|
"ai-loading",
|
|
102
|
+
"file-icon",
|
|
101
103
|
"highlight-keyword",
|
|
102
104
|
"message-loading",
|
|
103
105
|
"questions-container",
|
|
@@ -362,8 +364,8 @@
|
|
|
362
364
|
"name": "UserQuestionCard 用户问题中断",
|
|
363
365
|
"slug": "user-question-card",
|
|
364
366
|
"kind": "component",
|
|
365
|
-
"description": "渲染 UserQuestion
|
|
366
|
-
"aiSummary": "渲染 UserQuestion
|
|
367
|
+
"description": "渲染 UserQuestion 中断的待回答面板;一次一题分页切换,支持单选/多选、Others、跳过与已完成进度。",
|
|
368
|
+
"aiSummary": "渲染 UserQuestion 中断的待回答面板:一次只展示一题,标题栏提供题号切换, Footer 展示已完成进度;支持单选自动跳下一题、多选/Others、完成与跳过。 源码位置:src/components/chat-message/interrupt-message/user-question/user-question-card.vue。",
|
|
367
369
|
"relatedComponents": [
|
|
368
370
|
{
|
|
369
371
|
"slug": "interrupt-message",
|
|
@@ -433,12 +435,35 @@
|
|
|
433
435
|
"docFile": "docs/delete-tool.md",
|
|
434
436
|
"domain": "feedback"
|
|
435
437
|
},
|
|
438
|
+
{
|
|
439
|
+
"name": "MessageTime 消息时间",
|
|
440
|
+
"slug": "message-time",
|
|
441
|
+
"kind": "component",
|
|
442
|
+
"description": "按「今天 / 昨天 / 今年内 / 跨年」四档格式展示消息创建时间。",
|
|
443
|
+
"aiSummary": "按 createdAt 展示消息时间,四档格式:今天 `12:00`、昨天 `昨天 12:00`、今年内更早 `3-12 12:00`、非今年 `2025-3-12 12:00`; 时区取 props.timezone,未传时回退 injectGlobalConfig().timezone(由 ChatContainer 的 timezone prop 注入),都没有则用浏览器时区; 无值或非法时间不渲染任何 DOM。通常通过 MessageTools 的 prepend / append 插槽使用。 源码位置:src/components/message-tools/message-time/message-time.vue。",
|
|
444
|
+
"relatedComponents": [
|
|
445
|
+
{
|
|
446
|
+
"slug": "message-tools",
|
|
447
|
+
"relation": "通过 prepend / append 插槽嵌入工具栏"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"slug": "user-message",
|
|
451
|
+
"relation": "用户消息在工具栏左侧展示时间"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"slug": "message-container",
|
|
455
|
+
"relation": "AI 消息组在工具栏右侧展示本轮回答时间"
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
"docFile": "docs/message-time.md",
|
|
459
|
+
"domain": "feedback"
|
|
460
|
+
},
|
|
436
461
|
{
|
|
437
462
|
"name": "MessageTools 消息工具栏",
|
|
438
463
|
"slug": "message-tools",
|
|
439
464
|
"kind": "component",
|
|
440
465
|
"description": "消息悬浮工具栏,组合复制、删除、反馈等工具按钮。",
|
|
441
|
-
"aiSummary": "
|
|
466
|
+
"aiSummary": "消息悬浮工具栏,组合复制、删除、反馈等工具按钮;提供 prepend / append 两端插槽承载消息时间等附加内容。 源码位置:src/components/message-tools/message-tools.vue。",
|
|
442
467
|
"relatedComponents": [
|
|
443
468
|
{
|
|
444
469
|
"slug": "tool-btn",
|
|
@@ -451,6 +476,10 @@
|
|
|
451
476
|
{
|
|
452
477
|
"slug": "delete-tool",
|
|
453
478
|
"relation": "id 为 delete 时替换为带确认的删除按钮"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"slug": "message-time",
|
|
482
|
+
"relation": "通过 prepend / append 插槽嵌入消息时间"
|
|
454
483
|
}
|
|
455
484
|
],
|
|
456
485
|
"docFile": "docs/message-tools.md",
|
|
@@ -555,6 +584,25 @@
|
|
|
555
584
|
"docFile": "docs/ai-loading.md",
|
|
556
585
|
"domain": "helper"
|
|
557
586
|
},
|
|
587
|
+
{
|
|
588
|
+
"name": "FileIcon 文件类型图标",
|
|
589
|
+
"slug": "file-icon",
|
|
590
|
+
"kind": "component",
|
|
591
|
+
"description": "按文件扩展名渲染对应类型图标,尺寸随外层 font-size 自适应。",
|
|
592
|
+
"aiSummary": "按扩展名渲染文件类型图标:内联 svg,尺寸用 1em 跟随外层 font-size; 扩展名解析走 normalizeFileExtension(优先 fileType,缺省回退 fileName,大小写不敏感, 支持 Dockerfile / .gitignore 这类无扩展名或点号开头的文件);未登记类型返回 unknown 兜底图标。 源码位置:src/components/file-icon/file-icon.vue,图标注册表在 src/icons/file-icons.ts。",
|
|
593
|
+
"relatedComponents": [
|
|
594
|
+
{
|
|
595
|
+
"slug": "file-artifact-panel",
|
|
596
|
+
"relation": "文件产物列表与预览头使用该组件展示类型图标"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"slug": "assistant-message",
|
|
600
|
+
"relation": "消息内的文件产物卡片使用该组件"
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
"docFile": "docs/file-icon.md",
|
|
604
|
+
"domain": "helper"
|
|
605
|
+
},
|
|
558
606
|
{
|
|
559
607
|
"name": "HighlightKeyword 关键词高亮",
|
|
560
608
|
"slug": "highlight-keyword",
|
|
@@ -1115,7 +1163,7 @@
|
|
|
1115
1163
|
"slug": "file-artifact-panel",
|
|
1116
1164
|
"kind": "component",
|
|
1117
1165
|
"description": "汇总当前会话全部文件产物,支持搜索、选中与分类型预览,挂载在 ChatContainer 侧栏「文件产物」Tab。",
|
|
1118
|
-
"aiSummary": "汇总当前会话所有 AssistantMessage 的 artifacts
|
|
1166
|
+
"aiSummary": "汇总当前会话所有 AssistantMessage 的 artifacts(按 outputId 去重),支持关键词搜索、列表选中与下载; 预览区委托 ArtifactPreviewHost:由 resolveFileKind 把扩展名归入 code / markdown / html / text / image / binary 六类, 前四类走 text_from_download 拉正文(code 交给 highlight.js 高亮),image / binary 走 preview_url; download_url / preview_url 经 onArtifactClick 每次异步获取(无 URL 缓存,并发去重); 预览重载键为 outputId:type;重试再次调用 load() 重新取链。 源码位置:src/components/chat-message/assistant-message/message-artifacts/file-artifact-panel.vue。",
|
|
1119
1167
|
"relatedComponents": [
|
|
1120
1168
|
{
|
|
1121
1169
|
"slug": "assistant-message",
|
|
@@ -1267,6 +1315,10 @@
|
|
|
1267
1315
|
"slug": "message-tools",
|
|
1268
1316
|
"relation": "消息工具栏交互与状态由 MessageTools 体系承载"
|
|
1269
1317
|
},
|
|
1318
|
+
{
|
|
1319
|
+
"slug": "message-time",
|
|
1320
|
+
"relation": "createdAt 经工具栏 prepend 插槽展示"
|
|
1321
|
+
},
|
|
1270
1322
|
{
|
|
1271
1323
|
"slug": "message-container",
|
|
1272
1324
|
"relation": "嵌入列表时由 MessageContainer 管理分组与多选"
|
|
@@ -1504,7 +1556,7 @@
|
|
|
1504
1556
|
"slug": "chat-container",
|
|
1505
1557
|
"kind": "component",
|
|
1506
1558
|
"description": "完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。",
|
|
1507
|
-
"aiSummary": "完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。 透传 models / selectedModel;支持 welcomeTitle 与 #welcome。 源码位置:src/components/chat-container/chat-container.vue。",
|
|
1559
|
+
"aiSummary": "完整对话容器,组合消息列表、输入区、模型选择、快捷指令、执行摘要、分享选择和自定义 Tab。 透传 models / selectedModel;支持 welcomeTitle 与 #welcome。 侧栏展开/折叠由外部 v-model:asideCollapsed 严格受控(传入后以外部值为准,内部展开动作仅发 update 事件),不再依赖执行数据或文件产物有无;无数据时侧栏照常展开并展示空态。 侧栏固定从右侧展开(无 placement prop),且不再内置折叠按钮。 「文件产物」Tab 常驻挂载。 源码位置:src/components/chat-container/chat-container.vue。",
|
|
1508
1560
|
"relatedComponents": [
|
|
1509
1561
|
{
|
|
1510
1562
|
"slug": "message-container",
|
|
@@ -1586,7 +1638,7 @@
|
|
|
1586
1638
|
"slug": "use-artifact-preview",
|
|
1587
1639
|
"kind": "composable",
|
|
1588
1640
|
"description": "Provider/Consumer 模式的文件产物预览状态管理,用于 ChatContainer 侧栏「文件产物」Tab 的命中与切换。 Provider 在 ChatContainer 中创建,Consumer 在深层文件卡片中注入使用。",
|
|
1589
|
-
"aiSummary": "useArtifactPreviewProvider 维护 activeArtifactId
|
|
1641
|
+
"aiSummary": "useArtifactPreviewProvider 维护 activeArtifactId(值为 outputId),openPreview 命中文件并触发 onOpen 打开侧栏 Tab; 并通过 getOnArtifactClick 封装 resolveArtifactUrls(每次重新取链,并发去重); useArtifactPreviewConsumer 在后代注入同一套 API。SessionArtifact 即 AIFileInfo,会话内以 outputId 为唯一键。 正文加载与分类型渲染不在本 composable,由 FileArtifactPanel 内 ArtifactPreviewHost 完成(重载键 outputId:type)。 FILE_ARTIFACT_TAB_NAME 标识固定「文件产物」Tab。",
|
|
1590
1642
|
"relatedComponents": [
|
|
1591
1643
|
{
|
|
1592
1644
|
"slug": "chat-container",
|
|
@@ -1644,7 +1696,7 @@
|
|
|
1644
1696
|
"slug": "use-container-scroll",
|
|
1645
1697
|
"kind": "composable",
|
|
1646
1698
|
"description": "为消息容器提供滚动控制的组合式函数对,通过 **Provider/Consumer** 模式在父子组件间共享滚动状态。",
|
|
1647
|
-
"aiSummary": "useContainerScrollProvider 在滚动容器与底部锚点上绑定 IntersectionObserver、scroll、wheel,提供 isScrollBottom、scrollBottomHeight、autoScrollEnabled、toScrollBottom/toScrollTop 及防抖「返回底部」按钮状态。 useContainerScrollConsumer 通过 inject 在子组件中获取同一套控制,无需 props 透传。 典型用于流式输出时仅在用户位于底部时自动滚底。MessageContainer 与 ScrollBtn 配合使用。",
|
|
1699
|
+
"aiSummary": "useContainerScrollProvider 在滚动容器与底部锚点上绑定 IntersectionObserver、scroll、wheel,提供 isScrollBottom、scrollBottomHeight、autoScrollEnabled、jumpToBottom、toScrollBottom/toScrollTop 及防抖「返回底部」按钮状态。 toScrollBottom 缺省按距底部距离自动选择行为:超过 INSTANT_SCROLL_DISTANCE(600px)时瞬时贴底,否则平滑滚动,避免切换会话时出现长距离平滑滚动动画。 useContainerScrollConsumer 通过 inject 在子组件中获取同一套控制,无需 props 透传。 典型用于流式输出时仅在用户位于底部时自动滚底。MessageContainer 与 ScrollBtn 配合使用。",
|
|
1648
1700
|
"relatedComponents": [
|
|
1649
1701
|
{
|
|
1650
1702
|
"slug": "message-container",
|
|
@@ -1666,7 +1718,7 @@
|
|
|
1666
1718
|
"slug": "use-custom-tab",
|
|
1667
1719
|
"kind": "composable",
|
|
1668
1720
|
"description": "Provider/Consumer 模式的自定义 Tab 管理,用于 `ChatContainer` 侧边栏的 Tab 动态管理。Provider 在 `ChatContainer` 中创建,Consumer 在任意后代组件中注入使用。",
|
|
1669
|
-
"aiSummary": "useCustomTabProvider 返回 tabs、selectedTab、isCollapse 及 add/remove/selectCustomTab,并通过 provide 共享;可选 onTabChange
|
|
1721
|
+
"aiSummary": "useCustomTabProvider 返回 tabs、selectedTab、isCollapse 及 add/ensure/remove/selectCustomTab,并通过 provide 共享;可选 onTabChange 在切换时拉取数据、可选 collapsed 注入受控折叠态 ref。 ensureCustomTab 只挂载/合并元信息,不展开侧栏、不主动切换选中;addCustomTab 会展开并选中。 未被主动切换过时,选中态默认跟随 Tab 栏首位(order 最小),如常驻的「文件产物」。 useCustomTabConsumer 在后代注入同一套 API,常用于侧栏动态节点详情等。EXECUTION_TAB_NAME 标识默认「执行情况」Tab。 ChatContainer 侧栏集成 Provider 与 Tab UI。",
|
|
1670
1722
|
"relatedComponents": [
|
|
1671
1723
|
{
|
|
1672
1724
|
"slug": "chat-container",
|
|
@@ -1711,12 +1763,16 @@
|
|
|
1711
1763
|
"name": "useGlobalConfig",
|
|
1712
1764
|
"slug": "use-global-config",
|
|
1713
1765
|
"kind": "composable",
|
|
1714
|
-
"description": "在聊天根容器与子组件之间通过 provide/inject
|
|
1715
|
-
"aiSummary": "useGlobalConfig 接收 GlobalConfig(含 size?: ComputedRef<AiSizeMode>、supportUpload: ComputedRef<boolean>),以 GLOBAL_CONFIG_TOKEN provide 给后代; injectGlobalConfig 在子组件中取出配置,无 Provider 时返回 undefined。ChatContainer 在 setup 中调用 useGlobalConfig 注入 size 与
|
|
1766
|
+
"description": "在聊天根容器与子组件之间通过 provide/inject 共享全局展示配置(字号主题档位、是否支持上传、消息时间时区等)。",
|
|
1767
|
+
"aiSummary": "useGlobalConfig 接收 GlobalConfig(含 size?: ComputedRef<AiSizeMode>、supportUpload: ComputedRef<boolean>、timezone?: ComputedRef<string | undefined>),以 GLOBAL_CONFIG_TOKEN provide 给后代; injectGlobalConfig 在子组件中取出配置,无 Provider 时返回 undefined。ChatContainer 在 setup 中调用 useGlobalConfig 注入 size、supportUpload 与 timezone; 后代组件可通过 injectGlobalConfig 读取配置;字号主题主要通过根节点 data-ai-size 与 CSS 变量生效。",
|
|
1716
1768
|
"relatedComponents": [
|
|
1717
1769
|
{
|
|
1718
1770
|
"slug": "chat-container",
|
|
1719
1771
|
"relation": "根容器调用 useGlobalConfig 注入 supportUpload"
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
"slug": "message-time",
|
|
1775
|
+
"relation": "消息时间组件读取 timezone"
|
|
1720
1776
|
}
|
|
1721
1777
|
],
|
|
1722
1778
|
"docFile": "docs/use-global-config.md"
|
|
@@ -1787,7 +1843,7 @@
|
|
|
1787
1843
|
"slug": "constants",
|
|
1788
1844
|
"kind": "type",
|
|
1789
1845
|
"description": "`@blueking/chat-x` 导出的常量和枚举类型。",
|
|
1790
|
-
"aiSummary": "汇总 MessageRole、MessageStatus(含 Fetching
|
|
1846
|
+
"aiSummary": "汇总 MessageRole、MessageStatus(含 Fetching 请求中、Complete/Completed 完成态兼容)、MessageContentType、MessageToolsStatus、MessageState、Z-Index 与 CONST_MESSAGE_TOOLS 等导出常量。 用于构造消息、配置 MessageContainer 工具栏与输入态,以及层级与默认快捷指令。与类型 messages 配套使用。",
|
|
1791
1847
|
"relatedComponents": [
|
|
1792
1848
|
{
|
|
1793
1849
|
"slug": "message-tools",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件分类:图标兜底与预览渲染策略的共同依据。
|
|
3
|
+
* - code:可交给 highlight.js 渲染的源码 / 配置文件
|
|
4
|
+
* - text:纯文本,直接按原文展示
|
|
5
|
+
* - binary:无法在前端直接解析,统一交由后端 preview_url 预览
|
|
6
|
+
*/
|
|
7
|
+
export type AIFileKind = 'binary' | 'code' | 'html' | 'image' | 'markdown' | 'text';
|
|
8
|
+
/**
|
|
9
|
+
* 归一化文件类型标识:优先取后台下发的 type,缺省时回退文件名。
|
|
10
|
+
* 统一转小写并截取最后一段扩展名;无扩展名的文件(Dockerfile / Makefile)直接返回文件名本身。
|
|
11
|
+
*/
|
|
12
|
+
export declare const normalizeFileExtension: (type?: string, name?: string) => string;
|
|
13
|
+
/** 解析文件分类;未登记的扩展名按 binary 兜底 */
|
|
14
|
+
export declare const resolveFileKind: (type?: string, name?: string) => AIFileKind;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/chat-x",
|
|
3
|
-
"version": "0.0.49-beta.
|
|
3
|
+
"version": "0.0.49-beta.10",
|
|
4
4
|
"description": "蓝鲸智云 AI Chat 组件库 —— 遵循 AG-UI,为 AI Agent 和人类开发者共同设计的对话 UI 组件库。",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"vitepress": "2.0.0-alpha.16",
|
|
80
80
|
"vitest": "^4.0.18",
|
|
81
81
|
"vue-tsc": "^3.1.4",
|
|
82
|
-
"@blueking/chat-helper": "0.0.12-beta.
|
|
82
|
+
"@blueking/chat-helper": "0.0.12-beta.21"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
85
85
|
"dev": "vite --config vite.config.ts",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AIFileType } from '../../../../ag-ui/types/file';
|
|
2
|
-
/** 文件类型 → 图标映射;未命中类型兜底用文本图标 */
|
|
3
|
-
export declare const FILE_ICON_MAP: {
|
|
4
|
-
readonly html: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}>;
|
|
7
|
-
readonly jpg: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}>;
|
|
10
|
-
readonly json: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}>;
|
|
13
|
-
readonly md: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}>;
|
|
16
|
-
readonly markdown: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
}>;
|
|
19
|
-
readonly pdf: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}>;
|
|
22
|
-
readonly txt: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
/** 图标为共享 VNode,克隆后再渲染,避免同类型多处复用同一实例 */
|
|
27
|
-
export declare const getFileIcon: (type: AIFileType) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}>;
|