@blueking/chat-x 0.0.48-beta.1 → 0.0.49-beta.2
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 +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/assistant-message.vue.d.ts +12 -1
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +12 -0
- package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +7 -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 +23 -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 +9 -0
- 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 +14 -2
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +56 -0
- package/dist/composables/use-custom-tab.d.ts +2 -0
- package/dist/composables/use-message-group.d.ts +433 -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 +2217 -1689
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +8 -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 +97 -18
- 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/file-artifact-panel.md +275 -0
- package/dist/mcp/generated/docs/info-message.md +29 -12
- package/dist/mcp/generated/docs/interrupt.md +1 -0
- package/dist/mcp/generated/docs/loading-message.md +36 -17
- package/dist/mcp/generated/docs/message-container.md +4 -21
- package/dist/mcp/generated/docs/message-render.md +47 -59
- package/dist/mcp/generated/docs/messages.md +5 -0
- package/dist/mcp/generated/docs/reasoning-message.md +17 -20
- package/dist/mcp/generated/docs/tool-message.md +61 -45
- package/dist/mcp/generated/docs/toolcall-render.md +8 -8
- package/dist/mcp/generated/docs/use-artifact-preview.md +232 -0
- package/dist/mcp/generated/docs/use-custom-tab.md +18 -5
- package/dist/mcp/generated/docs/use-message-group.md +29 -0
- package/dist/mcp/generated/docs/user-message.md +185 -121
- package/dist/mcp/generated/docs/user-question-card.md +6 -3
- package/dist/mcp/generated/index.json +83 -13
- 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 = "markdown",
|
|
6
|
+
/** 后台扩展名别名,与 Markdown 等价 */
|
|
7
|
+
Md = "md",
|
|
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,11 +1,22 @@
|
|
|
1
1
|
import type { AssistantMessage } from '../../../ag-ui/types/messages';
|
|
2
|
+
interface AssistantMessageProps {
|
|
3
|
+
content?: string;
|
|
4
|
+
id?: AssistantMessage['id'];
|
|
5
|
+
messageId?: AssistantMessage['messageId'];
|
|
6
|
+
name?: AssistantMessage['name'];
|
|
7
|
+
property?: AssistantMessage['property'];
|
|
8
|
+
role?: AssistantMessage['role'];
|
|
9
|
+
status?: AssistantMessage['status'];
|
|
10
|
+
toolCalls?: AssistantMessage['toolCalls'];
|
|
11
|
+
uid?: AssistantMessage['uid'];
|
|
12
|
+
}
|
|
2
13
|
declare var __VLS_1: {
|
|
3
14
|
content: string;
|
|
4
15
|
};
|
|
5
16
|
type __VLS_Slots = {} & {
|
|
6
17
|
default?: (props: typeof __VLS_1) => any;
|
|
7
18
|
};
|
|
8
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<AssistantMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AssistantMessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
21
|
declare const _default: typeof __VLS_export;
|
|
11
22
|
export default _default;
|
package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
onDownload?: (file: AIFileInfo) => void;
|
|
7
|
+
onPreview?: (file: AIFileInfo) => void;
|
|
8
|
+
variant?: 'card' | 'list';
|
|
9
|
+
};
|
|
10
|
+
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>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AIFileInfo } from '../../../../../ag-ui/types/file';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
file?: AIFileInfo;
|
|
4
|
+
};
|
|
5
|
+
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>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
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,23 @@
|
|
|
1
|
+
import type { AIFileInfo, ArtifactUrlResult } from '../../../../../ag-ui/types/file';
|
|
2
|
+
import type { ResolveArtifactUrlsOptions } from '../../../../../composables/use-artifact-preview';
|
|
3
|
+
import type { ArtifactPreviewRendererKind } from './preview-strategy';
|
|
4
|
+
export type ArtifactPreviewPayload = {
|
|
5
|
+
content: string;
|
|
6
|
+
previewUrl: string;
|
|
7
|
+
renderer: ArtifactPreviewRendererKind;
|
|
8
|
+
status: ArtifactPreviewStatus;
|
|
9
|
+
};
|
|
10
|
+
export type ArtifactPreviewStatus = 'empty' | 'error' | 'idle' | 'loading' | 'ready';
|
|
11
|
+
export type ArtifactPreviewLoadOptions = ResolveArtifactUrlsOptions;
|
|
12
|
+
export declare const useArtifactPreviewLoader: (options: {
|
|
13
|
+
canResolve: () => boolean;
|
|
14
|
+
getFile: () => AIFileInfo | undefined;
|
|
15
|
+
resolveUrls: (file: AIFileInfo, options?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
|
|
16
|
+
}) => {
|
|
17
|
+
content: import("vue").ShallowRef<string, string>;
|
|
18
|
+
dispose: () => void;
|
|
19
|
+
load: (loadOptions?: ArtifactPreviewLoadOptions) => Promise<void>;
|
|
20
|
+
previewUrl: import("vue").ShallowRef<string, string>;
|
|
21
|
+
renderer: import("vue").ShallowRef<ArtifactPreviewRendererKind, ArtifactPreviewRendererKind>;
|
|
22
|
+
status: import("vue").ShallowRef<ArtifactPreviewStatus, ArtifactPreviewStatus>;
|
|
23
|
+
};
|
|
@@ -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,9 @@
|
|
|
1
|
+
import type { AIFileInfo } from '../../../../ag-ui/types/file';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
artifacts: AIFileInfo[];
|
|
4
|
+
onDownload?: (file: AIFileInfo) => void;
|
|
5
|
+
onPreview?: (file: AIFileInfo) => void;
|
|
6
|
+
};
|
|
7
|
+
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>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -9,9 +9,9 @@ export type NormalizedUserQuestionOption = UserQuestionOptionItem & {
|
|
|
9
9
|
letter: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* 用户回答问题(human-in-the-loop
|
|
12
|
+
* 用户回答问题(human-in-the-loop)的答案聚合、题目分页与 resume payload 构建。
|
|
13
13
|
*
|
|
14
|
-
* 设计目标:composable 只负责「收集每题答案 + 完成态计算 + payload 组装」,
|
|
14
|
+
* 设计目标:composable 只负责「收集每题答案 + 完成态计算 + 分页定位 + payload 组装」,
|
|
15
15
|
* 对「回答形态」(单选/多选/表单/任意自定义)零感知;
|
|
16
16
|
* 各题如何作答与如何校验,全部下沉到对应的渲染组件(默认为选择题),
|
|
17
17
|
* 渲染组件作答有效时回传已组装的 {@link UserQuestionAnswerItem},无效时回传 undefined。
|
|
@@ -23,6 +23,11 @@ export declare const useUserQuestion: (getInterrupt: () => undefined | UserQuest
|
|
|
23
23
|
answeredCount: import("vue").ComputedRef<number>;
|
|
24
24
|
totalCount: import("vue").ComputedRef<number>;
|
|
25
25
|
completed: import("vue").ComputedRef<boolean>;
|
|
26
|
+
currentIndex: import("vue").ShallowRef<number, number>;
|
|
27
|
+
canGoPrev: import("vue").ComputedRef<boolean>;
|
|
28
|
+
canGoNext: import("vue").ComputedRef<boolean>;
|
|
29
|
+
goPrev: () => void;
|
|
30
|
+
goNext: () => void;
|
|
26
31
|
getAnswer: (questionIndex: number) => undefined | UserQuestionAnswerItem;
|
|
27
32
|
setAnswer: (questionIndex: number, answer: undefined | UserQuestionAnswerItem) => void;
|
|
28
33
|
buildResolvePayload: () => UserQuestionResume;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type InputContent } from '../../../ag-ui/types';
|
|
1
2
|
import { type TagSchema, MessageToolsStatus } from '../../../types';
|
|
2
3
|
import { type MessageToolsProps } from '../../message-tools/message-tools.vue';
|
|
3
4
|
import type { UserMessage } from '../../../ag-ui/types/messages';
|
|
@@ -6,7 +7,18 @@ export type UserMessageActionsProps = {
|
|
|
6
7
|
onInputConfirm?: (content: UserMessage['content'], docSchema: TagSchema) => Promise<void>;
|
|
7
8
|
onShortcutConfirm?: (formModel: Record<string, unknown>) => Promise<void>;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
interface UserMessageProps extends UserMessageActionsProps {
|
|
11
|
+
content?: InputContent[] | string;
|
|
12
|
+
id?: UserMessage['id'];
|
|
13
|
+
messageId?: UserMessage['messageId'];
|
|
14
|
+
name?: UserMessage['name'];
|
|
15
|
+
onAction?: MessageToolsProps['onAction'];
|
|
16
|
+
property?: UserMessage['property'];
|
|
17
|
+
role?: UserMessage['role'];
|
|
18
|
+
status?: UserMessage['status'];
|
|
19
|
+
tippyOptions?: MessageToolsProps['tippyOptions'];
|
|
20
|
+
uid?: UserMessage['uid'];
|
|
21
|
+
}
|
|
22
|
+
declare const __VLS_export: import("vue").DefineComponent<UserMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UserMessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
23
|
declare const _default: typeof __VLS_export;
|
|
12
24
|
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
/** 临时链接缓存有效期(短于后端 token 常见 10 分钟时效) */
|
|
8
|
+
export declare const ARTIFACT_URL_CACHE_TTL_MS: number;
|
|
9
|
+
export type OpenArtifactPreviewPayload = {
|
|
10
|
+
/** 被点击的文件 */
|
|
11
|
+
file: AIFileInfo;
|
|
12
|
+
};
|
|
13
|
+
/** resolveArtifactUrls 可选参数 */
|
|
14
|
+
export type ResolveArtifactUrlsOptions = {
|
|
15
|
+
/** 为 true 时跳过 TTL 缓存,强制重新取链(如预览重试) */
|
|
16
|
+
force?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 会话级文件产物:以 outputId 为会话内唯一键(同 outputId 视为同一文件)。
|
|
20
|
+
* 拍平去重后即为 AIFileInfo,此处用别名标明语义。
|
|
21
|
+
*/
|
|
22
|
+
export type SessionArtifact = AIFileInfo;
|
|
23
|
+
type ArtifactPreviewContext = {
|
|
24
|
+
/** 当前命中的文件 outputId */
|
|
25
|
+
activeArtifactId: Ref<string>;
|
|
26
|
+
/** 是否具备异步取链能力(有 onArtifactClick 时下载按钮可见) */
|
|
27
|
+
canResolveArtifactUrl: ComputedRef<boolean>;
|
|
28
|
+
/** 由文件卡片触发:命中文件并弹出/切换到文件产物侧栏 */
|
|
29
|
+
openPreview: (payload: OpenArtifactPreviewPayload) => void;
|
|
30
|
+
/** 解析 download_url / preview_url:TTL 内复用缓存;force 时强制刷新;并发去重 */
|
|
31
|
+
resolveArtifactUrls: (file: AIFileInfo, options?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
|
|
32
|
+
/** 直接设置命中文件 outputId(侧栏列表内切换用) */
|
|
33
|
+
setActiveArtifactId: (id: string) => void;
|
|
34
|
+
};
|
|
35
|
+
/** 通过临时 <a> 触发浏览器下载 */
|
|
36
|
+
export declare const triggerArtifactDownload: (url: string, fileName: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 文件产物预览 Provider(在 ChatContainer 内使用)。
|
|
39
|
+
* 维护「命中文件」状态,并封装 onArtifactClick 取链(TTL 缓存 + 并发去重);
|
|
40
|
+
* 打开侧栏 Tab 的副作用由外部 onOpen 注入。
|
|
41
|
+
*/
|
|
42
|
+
export declare const useArtifactPreviewProvider: (options: {
|
|
43
|
+
/** 读取业务侧异步取链回调(用 getter 保持对 props 变更敏感) */
|
|
44
|
+
getOnArtifactClick?: () => OnArtifactClick | undefined;
|
|
45
|
+
/** 命中文件后触发:由容器负责 addCustomTab + 展开侧栏 + 选中 Tab */
|
|
46
|
+
onOpen: (outputId: string) => void;
|
|
47
|
+
}) => {
|
|
48
|
+
activeArtifactId: import("vue").ShallowRef<string, string>;
|
|
49
|
+
canResolveArtifactUrl: ComputedRef<boolean>;
|
|
50
|
+
openPreview: (payload: OpenArtifactPreviewPayload) => void;
|
|
51
|
+
resolveArtifactUrls: (file: AIFileInfo, resolveOptions?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
|
|
52
|
+
setActiveArtifactId: (id: string) => void;
|
|
53
|
+
};
|
|
54
|
+
/** 文件产物预览 Consumer(在深层文件卡片中使用),无 Provider 时返回 undefined 兜底 */
|
|
55
|
+
export declare const useArtifactPreviewConsumer: () => ArtifactPreviewContext | undefined;
|
|
56
|
+
export {};
|
|
@@ -34,6 +34,7 @@ export declare function useCustomTabProvider<T extends Record<string, unknown>>(
|
|
|
34
34
|
}>;
|
|
35
35
|
isCollapse: ShallowRef<boolean, boolean>;
|
|
36
36
|
addCustomTab: (tab: CustomTab<T>) => void;
|
|
37
|
+
ensureCustomTab: (tab: CustomTab<T>) => void;
|
|
37
38
|
removeCustomTab: (tabName: CustomTab<T>["name"]) => void;
|
|
38
39
|
selectCustomTab: (tab: CustomTab<T>) => void;
|
|
39
40
|
resetCustomTab: () => void;
|
|
@@ -41,6 +42,7 @@ export declare function useCustomTabProvider<T extends Record<string, unknown>>(
|
|
|
41
42
|
export declare const useCustomTabConsumer: <T extends Record<string, unknown>>() => {
|
|
42
43
|
addCustomTab: (tab: CustomTab<T>) => void;
|
|
43
44
|
displayTabs: ComputedRef<CustomTab<T>[]>;
|
|
45
|
+
ensureCustomTab: (tab: CustomTab<T>) => void;
|
|
44
46
|
removeCustomTab: (tabName: CustomTab<T>["name"]) => void;
|
|
45
47
|
selectCustomTab: (tab: CustomTab<T>) => void;
|
|
46
48
|
selectedTab: ShallowRef<CustomTab<T> | null>;
|