@blueking/chat-x 0.0.48-beta.1 → 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-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/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/index.css +1 -1
- package/dist/index.js +2083 -1600
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +6 -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 +94 -16
- 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/loading-message.md +36 -17
- package/dist/mcp/generated/docs/message-render.md +44 -33
- package/dist/mcp/generated/docs/reasoning-message.md +15 -11
- 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 +79 -9
- package/dist/mcp/index.js +0 -0
- package/package.json +20 -21
|
@@ -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: {
|
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;
|
|
@@ -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 {};
|