@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum AIFileType {
|
|
2
|
+
Html = "html",
|
|
3
|
+
Jpg = "jpg",
|
|
4
|
+
Json = "json",
|
|
5
|
+
/** 后台扩展名别名,与 Markdown 等价 */
|
|
6
|
+
Md = "md",
|
|
7
|
+
Markdown = "markdown",
|
|
8
|
+
Pdf = "pdf",
|
|
9
|
+
Txt = "txt"
|
|
10
|
+
}
|
|
11
|
+
export type AIFileInfo = {
|
|
12
|
+
name: string;
|
|
13
|
+
outputId: string;
|
|
14
|
+
size: number;
|
|
15
|
+
type: AIFileType;
|
|
16
|
+
};
|
|
17
|
+
/** 点击文件产物后异步获取的下载 / 预览地址(snake_case) */
|
|
18
|
+
export type ArtifactUrlResult = {
|
|
19
|
+
download_url?: string;
|
|
20
|
+
preview_url?: string;
|
|
21
|
+
};
|
|
22
|
+
/** 异步获取文件产物下载 / 预览链接 */
|
|
23
|
+
export type OnArtifactClick = (file: AIFileInfo) => Promise<ArtifactUrlResult>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OldShortcut, Shortcut } from '../../types';
|
|
2
2
|
import type { MessageContentType, MessageRole, MessageStatus } from './constants';
|
|
3
3
|
import type { ContentMap, InputContent } from './contents';
|
|
4
|
+
import type { AIFileInfo } from './file';
|
|
4
5
|
import type { InterruptMessage } from './interrupt';
|
|
5
6
|
export interface ActivityMessage extends BaseMessage<MessageRole.Activity, ContentMap[MessageContentType.FlowAgent] | ContentMap[MessageContentType.KnowledgeRag] | ContentMap[MessageContentType.ReferenceDocument]> {
|
|
6
7
|
activityType: MessageContentType.FlowAgent | MessageContentType.KnowledgeRag | MessageContentType.ReferenceDocument | string;
|
|
@@ -21,6 +22,7 @@ export interface BaseMessage<T extends MessageType, C = string> {
|
|
|
21
22
|
status: MessageStatus;
|
|
22
23
|
uid?: string;
|
|
23
24
|
property?: {
|
|
25
|
+
artifacts?: AIFileInfo[];
|
|
24
26
|
extra?: {
|
|
25
27
|
cite: {
|
|
26
28
|
data: {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type Interrupt, type InterruptResume, type UserMessage, MessageContentType, MessageStatus } from '../../ag-ui/types';
|
|
2
2
|
import { type AITippyProps, type IAiSlashMenuItem, type ISkillListItem, type Shortcut, type TagSchema, type UploadFile, UploadStatus } from '../../types';
|
|
3
|
+
import type { IModelOption } from './model-selector';
|
|
3
4
|
export type ChatInputEmits = {
|
|
4
5
|
(e: 'selectShortcut', shortcut: Shortcut): void;
|
|
5
6
|
(e: 'deleteShortcut'): void;
|
|
6
7
|
(e: 'update:modelValue', value: string | TagSchema, selectedResourceList: IAiSlashMenuItem[]): void;
|
|
8
|
+
(e: 'modelChange', model: IModelOption): void;
|
|
7
9
|
};
|
|
8
10
|
export type ChatInputProps = {
|
|
9
11
|
defaultUploadFiles?: UploadFile[];
|
|
10
12
|
inputMaxHeight?: number;
|
|
11
13
|
messageStatus?: MessageStatus;
|
|
14
|
+
models?: IModelOption[];
|
|
12
15
|
modelValue: string | TagSchema;
|
|
13
16
|
onSendMessage?: (message: UserMessage['content'], docSchema: TagSchema, options?: {
|
|
14
17
|
interrupt?: Interrupt;
|
|
@@ -31,6 +34,7 @@ export type ChatInputProps = {
|
|
|
31
34
|
type __VLS_Props = ChatInputProps;
|
|
32
35
|
type __VLS_ModelProps = {
|
|
33
36
|
'cite'?: string;
|
|
37
|
+
'selectedModel'?: string;
|
|
34
38
|
};
|
|
35
39
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
36
40
|
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_14: {
|
|
@@ -55,7 +59,10 @@ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_14: {
|
|
|
55
59
|
} | undefined;
|
|
56
60
|
status?: UploadStatus | undefined;
|
|
57
61
|
}[];
|
|
58
|
-
}, __VLS_51: {}, __VLS_75: {
|
|
62
|
+
}, __VLS_51: {}, __VLS_75: {
|
|
63
|
+
models: IModelOption[] | undefined;
|
|
64
|
+
selectedModel: string | undefined;
|
|
65
|
+
}, __VLS_85: {};
|
|
59
66
|
type __VLS_Slots = {} & {
|
|
60
67
|
top?: (props: typeof __VLS_1) => any;
|
|
61
68
|
} & {
|
|
@@ -67,13 +74,16 @@ type __VLS_Slots = {} & {
|
|
|
67
74
|
} & {
|
|
68
75
|
attachment?: (props: typeof __VLS_51) => any;
|
|
69
76
|
} & {
|
|
70
|
-
'
|
|
77
|
+
'model-selector'?: (props: typeof __VLS_75) => any;
|
|
78
|
+
} & {
|
|
79
|
+
'send-icon'?: (props: typeof __VLS_85) => any;
|
|
71
80
|
};
|
|
72
81
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
73
82
|
focus: () => void;
|
|
74
83
|
triggerSendMessage: () => Promise<void>;
|
|
75
84
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
76
85
|
"update:cite": (value: string) => any;
|
|
86
|
+
"update:selectedModel": (value: string | undefined) => any;
|
|
77
87
|
} & {
|
|
78
88
|
"update:modelValue": (value: string | ({
|
|
79
89
|
text: string;
|
|
@@ -88,6 +98,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
88
98
|
})[][], selectedResourceList: IAiSlashMenuItem[]) => any;
|
|
89
99
|
selectShortcut: (shortcut: Shortcut) => any;
|
|
90
100
|
deleteShortcut: () => any;
|
|
101
|
+
modelChange: (model: IModelOption) => any;
|
|
91
102
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
92
103
|
"onUpdate:modelValue"?: ((value: string | ({
|
|
93
104
|
text: string;
|
|
@@ -102,7 +113,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
102
113
|
})[][], selectedResourceList: IAiSlashMenuItem[]) => any) | undefined;
|
|
103
114
|
onSelectShortcut?: ((shortcut: Shortcut) => any) | undefined;
|
|
104
115
|
onDeleteShortcut?: (() => any) | undefined;
|
|
116
|
+
onModelChange?: ((model: IModelOption) => any) | undefined;
|
|
105
117
|
"onUpdate:cite"?: ((value: string) => any) | undefined;
|
|
118
|
+
"onUpdate:selectedModel"?: ((value: string | undefined) => any) | undefined;
|
|
106
119
|
}>, {
|
|
107
120
|
placeholder: string;
|
|
108
121
|
prompts: string[];
|
|
@@ -6,11 +6,13 @@ type __VLS_Props = {
|
|
|
6
6
|
sendDisabledTip?: string;
|
|
7
7
|
tippyOptions?: AITippyProps;
|
|
8
8
|
};
|
|
9
|
-
declare var __VLS_1: {}, __VLS_3: {};
|
|
9
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_1) => any;
|
|
12
12
|
} & {
|
|
13
|
-
'send
|
|
13
|
+
'before-send'?: (props: typeof __VLS_3) => any;
|
|
14
|
+
} & {
|
|
15
|
+
'send-icon'?: (props: typeof __VLS_5) => any;
|
|
14
16
|
};
|
|
15
17
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
16
18
|
sendMessage: () => any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IModelOption } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 待展示的模型列表(已按关键字过滤) */
|
|
4
|
+
models: IModelOption[];
|
|
5
|
+
/** 搜索框占位文案 */
|
|
6
|
+
searchPlaceholder?: string;
|
|
7
|
+
/** 当前选中模型的 llm_name */
|
|
8
|
+
selectedName?: string;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
/** 搜索关键字(受控,回传给容器交由 composable 过滤) */
|
|
12
|
+
'keyword'?: string;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
16
|
+
focusSearch: () => void;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:keyword": (value: string) => any;
|
|
19
|
+
} & {
|
|
20
|
+
select: (model: IModelOption) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
+
onSelect?: ((model: IModelOption) => any) | undefined;
|
|
23
|
+
"onUpdate:keyword"?: ((value: string) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IModelOption } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 是否禁用 */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** 是否展开(下拉打开),用于箭头翻转与背景态 */
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
/** 当前选中的模型 */
|
|
8
|
+
model?: IModelOption;
|
|
9
|
+
/** 无选中时的占位文案 */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type TippyOptions } from 'vue-tippy';
|
|
2
|
+
import type { IModelOption } from './types';
|
|
3
|
+
import 'tippy.js/dist/tippy.css';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 是否禁用整个选择器 */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** 模型列表 */
|
|
8
|
+
models?: IModelOption[];
|
|
9
|
+
/** trigger 无选中时的占位文案 */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** 搜索框占位文案 */
|
|
12
|
+
searchPlaceholder?: string;
|
|
13
|
+
/** 透传给 tippy 的额外配置 */
|
|
14
|
+
tippyOptions?: Partial<Omit<TippyOptions, 'getReferenceClientRect' | 'triggerTarget'>>;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_ModelProps = {
|
|
17
|
+
/** 当前选中的模型(值为 llm_name,v-model) */
|
|
18
|
+
modelValue?: string;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
21
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
22
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
23
|
+
} & {
|
|
24
|
+
change: (model: IModelOption) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
26
|
+
onChange?: ((model: IModelOption) => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
placeholder: string;
|
|
30
|
+
searchPlaceholder: string;
|
|
31
|
+
tippyOptions: Partial<Omit<Partial<Omit<import("tippy.js").Props, "content" | "triggerTarget" | "getReferenceClientRect"> & {
|
|
32
|
+
content: import("vue-tippy").TippyContent;
|
|
33
|
+
triggerTarget: import("vue-tippy").TippyTarget;
|
|
34
|
+
getReferenceClientRect: null | (() => DOMRect & any);
|
|
35
|
+
}>, "triggerTarget" | "getReferenceClientRect">>;
|
|
36
|
+
models: IModelOption[];
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** 模型能力标签,如「图生文」「深度思考」「快速思考」(由组件依据 property 派生,走内置 i18n) */
|
|
2
|
+
export interface IModelCapability {
|
|
3
|
+
/** 标签文案 */
|
|
4
|
+
text: string;
|
|
5
|
+
/** 语义主题,决定标签配色,缺省为 default */
|
|
6
|
+
theme?: ModelCapabilityTheme;
|
|
7
|
+
}
|
|
8
|
+
/** 模型选项(贴合后端模型接口结构) */
|
|
9
|
+
export interface IModelOption {
|
|
10
|
+
/** 基础模型标识,如 deepseek */
|
|
11
|
+
base_model?: string;
|
|
12
|
+
/** 模型描述,作为选项 hover 的 title 提示 */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** 是否禁用(前端扩展字段,后端无此字段时默认不禁用) */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** 模型图标地址 */
|
|
17
|
+
icon?: string;
|
|
18
|
+
/** 模型主键 id */
|
|
19
|
+
id: number;
|
|
20
|
+
/** 模型编码 */
|
|
21
|
+
llm_code: string;
|
|
22
|
+
/** 模型展示名,同时作为选中值(v-model:selectedModel) */
|
|
23
|
+
llm_name: string;
|
|
24
|
+
/** 模型类型,如 chat.completion */
|
|
25
|
+
llm_type: string;
|
|
26
|
+
/** 最大 token 数 */
|
|
27
|
+
max_token_size: number;
|
|
28
|
+
/** 模型能力属性,用于派生能力标签 */
|
|
29
|
+
property: IModelProperty;
|
|
30
|
+
/** 空间维度鉴权模式,如 APPLY */
|
|
31
|
+
space_auth_mode: string;
|
|
32
|
+
/** 标签名列表 */
|
|
33
|
+
tag_names?: string[];
|
|
34
|
+
/** 用户维度鉴权模式,如 PUBLIC */
|
|
35
|
+
user_auth_mode: string;
|
|
36
|
+
}
|
|
37
|
+
/** 模型属性(后端 property 字段),描述模型支持的能力开关与运行参数 */
|
|
38
|
+
export interface IModelProperty {
|
|
39
|
+
/** 智能体类型,如 openai */
|
|
40
|
+
agent_type?: string;
|
|
41
|
+
/** 是否为默认模型 */
|
|
42
|
+
default?: boolean;
|
|
43
|
+
/** 是否自建部署 */
|
|
44
|
+
is_self_host?: boolean;
|
|
45
|
+
/** 模型最大上下文长度 */
|
|
46
|
+
max_model_len?: number;
|
|
47
|
+
/** 是否支持摘要 */
|
|
48
|
+
support_summary?: boolean;
|
|
49
|
+
/** 是否支持深度思考 */
|
|
50
|
+
support_thinking?: boolean;
|
|
51
|
+
/** 是否支持快速思考 */
|
|
52
|
+
support_thinking_quick?: boolean;
|
|
53
|
+
/** 是否支持工具调用 */
|
|
54
|
+
support_tools?: boolean;
|
|
55
|
+
/** 是否支持图生文(视觉) */
|
|
56
|
+
support_vision?: boolean;
|
|
57
|
+
/** 是否支持上下文窗口 */
|
|
58
|
+
support_window?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** 模型能力标签的语义主题,决定标签配色(与设计稿语义色一一对应) */
|
|
61
|
+
export type ModelCapabilityTheme = 'default' | 'primary' | 'success' | 'warning';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import type { IModelOption } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 模型选择的纯数据逻辑(与 UI 解耦,可独立单测):
|
|
5
|
+
* 仅负责「按关键字过滤」与「解析当前选中模型」,不持有任何展示/交互态。
|
|
6
|
+
*/
|
|
7
|
+
export declare const useModelSelector: (params: {
|
|
8
|
+
/** 模型列表 */
|
|
9
|
+
models: ComputedRef<IModelOption[]> | Ref<IModelOption[]>;
|
|
10
|
+
/** 当前选中模型(值为 llm_name) */
|
|
11
|
+
selectedModel: Ref<string | undefined>;
|
|
12
|
+
}) => {
|
|
13
|
+
keyword: import("vue").ShallowRef<string, string>;
|
|
14
|
+
filteredModels: ComputedRef<IModelOption[]>;
|
|
15
|
+
currentModel: ComputedRef<IModelOption | undefined>;
|
|
16
|
+
resetKeyword: () => void;
|
|
17
|
+
};
|
package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AIFileInfo } from '../../../../ag-ui/types/file';
|
|
2
|
+
import 'tippy.js/dist/tippy.css';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
file: AIFileInfo;
|
|
6
|
+
index?: number;
|
|
7
|
+
messageUid?: string;
|
|
8
|
+
onDownload?: (file: AIFileInfo) => void;
|
|
9
|
+
onPreview?: (file: AIFileInfo) => void;
|
|
10
|
+
variant?: 'card' | 'list';
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AIFileInfo } from '../../../../../ag-ui/types/file';
|
|
2
|
+
import type { SessionArtifact } from '../../../../../composables/use-artifact-preview';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
file?: AIFileInfo | SessionArtifact;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AIFileType } from '../../../../../ag-ui/types/file';
|
|
2
|
+
export type ArtifactPreviewLoadStrategy = 'preview_url_iframe' | 'text_from_download';
|
|
3
|
+
export type ArtifactPreviewRendererKind = 'html' | 'markdown' | 'txt' | 'urlIframe';
|
|
4
|
+
export type ArtifactPreviewStrategy = {
|
|
5
|
+
load: ArtifactPreviewLoadStrategy;
|
|
6
|
+
renderer: ArtifactPreviewRendererKind;
|
|
7
|
+
};
|
|
8
|
+
/** 按文件类型解析预览加载策略与渲染器;未单独注册的类型默认 preview_url iframe */
|
|
9
|
+
export declare const getArtifactPreviewStrategy: (type: AIFileType) => ArtifactPreviewStrategy;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
url: string;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AIFileInfo, ArtifactUrlResult } from '../../../../../ag-ui/types/file';
|
|
2
|
+
import type { ArtifactPreviewRendererKind } from './preview-strategy';
|
|
3
|
+
export type ArtifactPreviewPayload = {
|
|
4
|
+
content: string;
|
|
5
|
+
previewUrl: string;
|
|
6
|
+
renderer: ArtifactPreviewRendererKind;
|
|
7
|
+
status: ArtifactPreviewStatus;
|
|
8
|
+
};
|
|
9
|
+
export type ArtifactPreviewStatus = 'empty' | 'error' | 'idle' | 'loading' | 'ready';
|
|
10
|
+
export declare const useArtifactPreviewLoader: (options: {
|
|
11
|
+
canResolve: () => boolean;
|
|
12
|
+
getFile: () => AIFileInfo | undefined;
|
|
13
|
+
resolveUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
|
|
14
|
+
}) => {
|
|
15
|
+
content: import("vue").ShallowRef<string, string>;
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
load: () => Promise<void>;
|
|
18
|
+
previewUrl: import("vue").ShallowRef<string, string>;
|
|
19
|
+
renderer: import("vue").ShallowRef<ArtifactPreviewRendererKind, ArtifactPreviewRendererKind>;
|
|
20
|
+
status: import("vue").ShallowRef<ArtifactPreviewStatus, ArtifactPreviewStatus>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SessionArtifact } from '../../../../composables/use-artifact-preview';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
activeId: string;
|
|
4
|
+
artifacts: SessionArtifact[];
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
+
select: (id: string) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onSelect?: ((id: string) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}>;
|
package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AIFileInfo } from '../../../../ag-ui/types/file';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
artifacts: AIFileInfo[];
|
|
4
|
+
messageUid?: string;
|
|
5
|
+
onDownload?: (file: AIFileInfo) => void;
|
|
6
|
+
onPreview?: (file: AIFileInfo) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -14,6 +14,7 @@ export type MessageContainerProps = {
|
|
|
14
14
|
messageGroups: MessageGroup[];
|
|
15
15
|
messages: Message[];
|
|
16
16
|
messageStatus?: MessageStatus;
|
|
17
|
+
messageTools?: IToolBtn[];
|
|
17
18
|
messageToolsStatus?: MessageToolsStatus;
|
|
18
19
|
messageToolsTippyOptions?: MessageToolsProps['tippyOptions'];
|
|
19
20
|
onAgentAction?: AgentActionCallback;
|
|
@@ -21,6 +22,7 @@ export type MessageContainerProps = {
|
|
|
21
22
|
onInterruptResume?: OnInterruptResume;
|
|
22
23
|
onUserAction?: UserActionCallback;
|
|
23
24
|
renderMode?: RenderMode;
|
|
25
|
+
updateTools?: IToolBtn[];
|
|
24
26
|
} & {
|
|
25
27
|
onUserInputConfirm?: (message: Message, content: UserMessage['content'], docSchema: TagSchema) => Promise<void>;
|
|
26
28
|
onUserShortcutConfirm?: (message: Message, formModel: Record<string, unknown>) => Promise<void>;
|
|
@@ -8,7 +8,9 @@ import ChatContainer from './chat-container/chat-container.vue';
|
|
|
8
8
|
import commonErrorContent from './chat-content/common-error-content/common-error-content.vue';
|
|
9
9
|
import ContentRender from './chat-content/content-render/content-render.vue';
|
|
10
10
|
import ChatInput from './chat-input/chat-input.vue';
|
|
11
|
+
import { ModelSelector } from './chat-input/model-selector';
|
|
11
12
|
export * from './chat-content';
|
|
13
|
+
export type { IModelCapability, IModelOption, IModelProperty, ModelCapabilityTheme } from './chat-input/model-selector';
|
|
12
14
|
import MessageContainer from './chat-message/message-container/message-container.vue';
|
|
13
15
|
import MessageRender from './chat-message/message-render/message-render.vue';
|
|
14
16
|
import ExecutionSummary from './execution-summary/execution-summary.vue';
|
|
@@ -23,4 +25,4 @@ import SelectionFooter from './selection-footer/selection-footer.vue';
|
|
|
23
25
|
import ToolCallRender from './tool-call/toolcall-render/toolcall-render.vue';
|
|
24
26
|
export * from './chat-message/interrupt-message';
|
|
25
27
|
export * from './markdown-token';
|
|
26
|
-
export { AiImage, AiLoading, AiSelection, ChatContainer, ChatInput, commonErrorContent, ContentRender, ExecutionSummary, HighlightKeyword, ImagePreview, ImagePreviewGroup, MessageContainer, MessageLoading, MessageRender, MessageTools, MessageUserFeedback, ScrollBtn, SelectionFooter, ShortcutBtn, ShortcutBtns, ShortcutRender, ToolCallRender, };
|
|
28
|
+
export { AiImage, AiLoading, AiSelection, ChatContainer, ChatInput, commonErrorContent, ContentRender, ExecutionSummary, HighlightKeyword, ImagePreview, ImagePreviewGroup, MessageContainer, MessageLoading, MessageRender, MessageTools, MessageUserFeedback, ModelSelector, ScrollBtn, SelectionFooter, ShortcutBtn, ShortcutBtns, ShortcutRender, ToolCallRender, };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import type { AIFileInfo, ArtifactUrlResult, OnArtifactClick } from '../ag-ui/types/file';
|
|
3
|
+
/** 文件产物预览 Provider/Consumer 通信 token */
|
|
4
|
+
export declare const ARTIFACT_PREVIEW_TOKEN: unique symbol;
|
|
5
|
+
/** 文件产物侧栏 Tab 的保留唯一标识(固定 Tab,不可关闭) */
|
|
6
|
+
export declare const FILE_ARTIFACT_TAB_NAME = "file-artifact";
|
|
7
|
+
export type OpenArtifactPreviewPayload = {
|
|
8
|
+
/** 被点击的文件 */
|
|
9
|
+
file: AIFileInfo;
|
|
10
|
+
/** 文件在所属消息 artifacts 中的下标 */
|
|
11
|
+
index: number;
|
|
12
|
+
/** 所属 AssistantMessage 的 uid */
|
|
13
|
+
messageUid: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 会话级文件产物:在 AIFileInfo 基础上补充命中所需的唯一 id 与所属消息。
|
|
17
|
+
* 由于同一会话可能出现「多个 AssistantMessage + 同名文件」,文件名不可作为唯一键,
|
|
18
|
+
* 统一用 messageUid + 消息内下标 + outputId 组合出全局唯一 id。
|
|
19
|
+
*/
|
|
20
|
+
export type SessionArtifact = AIFileInfo & {
|
|
21
|
+
artifactId: string;
|
|
22
|
+
messageUid: string;
|
|
23
|
+
};
|
|
24
|
+
type ArtifactPreviewContext = {
|
|
25
|
+
/** 当前命中的文件 id */
|
|
26
|
+
activeArtifactId: Ref<string>;
|
|
27
|
+
/** 是否具备异步取链能力(有 onArtifactClick 时下载按钮可见) */
|
|
28
|
+
canResolveArtifactUrl: ComputedRef<boolean>;
|
|
29
|
+
/** 由文件卡片触发:命中文件并弹出/切换到文件产物侧栏 */
|
|
30
|
+
openPreview: (payload: OpenArtifactPreviewPayload) => void;
|
|
31
|
+
/** 按 outputId 缓存并解析 download_url / preview_url */
|
|
32
|
+
resolveArtifactUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
|
|
33
|
+
/** 直接设置命中文件 id(侧栏列表内切换用) */
|
|
34
|
+
setActiveArtifactId: (id: string) => void;
|
|
35
|
+
};
|
|
36
|
+
/** 统一的文件产物唯一 id 生成规则,Provider 与文件卡片两侧必须一致 */
|
|
37
|
+
export declare const buildArtifactId: (messageUid: string, index: number, outputId: string) => string;
|
|
38
|
+
/** 通过临时 <a> 触发浏览器下载 */
|
|
39
|
+
export declare const triggerArtifactDownload: (url: string, fileName: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* 文件产物预览 Provider(在 ChatContainer 内使用)。
|
|
42
|
+
* 维护「命中文件」状态,并封装 onArtifactClick 的 URL 解析与按 outputId 缓存;
|
|
43
|
+
* 打开侧栏 Tab 的副作用由外部 onOpen 注入。
|
|
44
|
+
*/
|
|
45
|
+
export declare const useArtifactPreviewProvider: (options: {
|
|
46
|
+
/** 读取业务侧异步取链回调(用 getter 保持对 props 变更敏感) */
|
|
47
|
+
getOnArtifactClick?: () => OnArtifactClick | undefined;
|
|
48
|
+
/** 命中文件后触发:由容器负责 addCustomTab + 展开侧栏 + 选中 Tab */
|
|
49
|
+
onOpen: (artifactId: string) => void;
|
|
50
|
+
}) => {
|
|
51
|
+
activeArtifactId: import("vue").ShallowRef<string, string>;
|
|
52
|
+
canResolveArtifactUrl: ComputedRef<boolean>;
|
|
53
|
+
openPreview: (payload: OpenArtifactPreviewPayload) => void;
|
|
54
|
+
resolveArtifactUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
|
|
55
|
+
setActiveArtifactId: (id: string) => void;
|
|
56
|
+
};
|
|
57
|
+
/** 文件产物预览 Consumer(在深层文件卡片中使用),无 Provider 时返回 undefined 兜底 */
|
|
58
|
+
export declare const useArtifactPreviewConsumer: () => ArtifactPreviewContext | undefined;
|
|
59
|
+
export {};
|