rt-chat-messages 1.0.4 → 1.0.6
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/README.md +79 -22
- package/dist/chat-messages.es.js +1126 -693
- package/dist/chat-messages.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/ChatMessageList.vue.d.ts +24 -1
- package/dist/types/components/MultimodalMessage.vue.d.ts +10 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +9 -0
- package/package.json +4 -2
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { Catalog } from 'a2ui-vue';
|
|
1
2
|
interface ChatMessage {
|
|
2
3
|
id?: string;
|
|
3
4
|
role: string;
|
|
4
5
|
content: string;
|
|
6
|
+
a2ui?: unknown;
|
|
7
|
+
a2uiMessages?: unknown;
|
|
8
|
+
a2ui_messages?: unknown;
|
|
9
|
+
agui?: unknown;
|
|
10
|
+
aguiEvents?: unknown;
|
|
11
|
+
agui_events?: unknown;
|
|
5
12
|
metadata?: string | any;
|
|
6
13
|
attachments?: any[];
|
|
7
14
|
create_time?: string;
|
|
@@ -26,6 +33,13 @@ interface Props {
|
|
|
26
33
|
contentPaddingTop?: string;
|
|
27
34
|
contentPaddingBottom?: string;
|
|
28
35
|
showBackground?: boolean;
|
|
36
|
+
apiBaseUrl?: string;
|
|
37
|
+
enableA2UI?: boolean;
|
|
38
|
+
autoProvideA2UI?: boolean;
|
|
39
|
+
a2uiCatalog?: Catalog;
|
|
40
|
+
hideA2UIRawContent?: boolean;
|
|
41
|
+
showA2UISkeleton?: boolean;
|
|
42
|
+
a2uiActionHandler?: (event: unknown) => unknown[] | Promise<unknown[]>;
|
|
29
43
|
}
|
|
30
44
|
declare function __VLS_template(): {
|
|
31
45
|
attrs: Partial<{}>;
|
|
@@ -39,18 +53,23 @@ declare function __VLS_template(): {
|
|
|
39
53
|
};
|
|
40
54
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
41
55
|
declare const __VLS_component: import('vue').DefineComponent<Props, {
|
|
42
|
-
scrollToBottom: (behavior?: ScrollBehavior) => Promise<void>;
|
|
56
|
+
scrollToBottom: (behavior?: ScrollBehavior, force?: boolean) => Promise<void>;
|
|
43
57
|
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
44
58
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
45
59
|
copy: (...args: any[]) => void;
|
|
46
60
|
scroll: (...args: any[]) => void;
|
|
47
61
|
"scroll-bottom": (...args: any[]) => void;
|
|
62
|
+
"a2ui-action": (...args: any[]) => void;
|
|
63
|
+
"a2ui-error": (...args: any[]) => void;
|
|
48
64
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
49
65
|
onCopy?: ((...args: any[]) => any) | undefined;
|
|
50
66
|
onScroll?: ((...args: any[]) => any) | undefined;
|
|
51
67
|
"onScroll-bottom"?: ((...args: any[]) => any) | undefined;
|
|
68
|
+
"onA2ui-action"?: ((...args: any[]) => any) | undefined;
|
|
69
|
+
"onA2ui-error"?: ((...args: any[]) => any) | undefined;
|
|
52
70
|
}>, {
|
|
53
71
|
isStreaming: boolean;
|
|
72
|
+
apiBaseUrl: string;
|
|
54
73
|
messages: ChatMessage[];
|
|
55
74
|
isTyping: boolean;
|
|
56
75
|
showWelcome: boolean;
|
|
@@ -60,6 +79,10 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
|
|
|
60
79
|
contentPaddingTop: string;
|
|
61
80
|
contentPaddingBottom: string;
|
|
62
81
|
showBackground: boolean;
|
|
82
|
+
enableA2UI: boolean;
|
|
83
|
+
autoProvideA2UI: boolean;
|
|
84
|
+
hideA2UIRawContent: boolean;
|
|
85
|
+
showA2UISkeleton: boolean;
|
|
63
86
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
64
87
|
containerRef: HTMLDivElement;
|
|
65
88
|
}, HTMLDivElement>;
|
|
@@ -17,9 +17,19 @@ interface Props {
|
|
|
17
17
|
message: MultimodalMessageData;
|
|
18
18
|
isUser?: boolean;
|
|
19
19
|
isStreaming?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 后端服务的 base URL,用于将相对路径(如 /api/files/download/xxx)
|
|
22
|
+
* 解析为完整的绝对 URL,例如 http://127.0.0.1:6622/rxb
|
|
23
|
+
*/
|
|
24
|
+
apiBaseUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 自定义下载处理逻辑,返回 true 或 Promise<true> 表示已处理,内部不再执行默认的 blob 下载
|
|
27
|
+
*/
|
|
28
|
+
onDownload?: (url: string, name?: string) => boolean | Promise<boolean> | void | Promise<void>;
|
|
20
29
|
}
|
|
21
30
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
22
31
|
isStreaming: boolean;
|
|
23
32
|
isUser: boolean;
|
|
33
|
+
apiBaseUrl: string;
|
|
24
34
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
25
35
|
export default _default;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { default as MarkdownMessage } from './components/MarkdownMessage.vue';
|
|
|
4
4
|
import { default as AgentSteps } from './components/AgentSteps.vue';
|
|
5
5
|
import { App } from 'vue';
|
|
6
6
|
export { ChatMessageList, MultimodalMessage, MarkdownMessage, AgentSteps };
|
|
7
|
-
export type { ChatMessage, AgentStep, FileAttachment } from './types';
|
|
7
|
+
export type { ChatMessage, AgentStep, FileAttachment, A2UIActionHandler, } from './types';
|
|
8
8
|
declare const _default: {
|
|
9
9
|
install(app: App): void;
|
|
10
10
|
};
|
|
@@ -8,6 +8,14 @@ export interface ChatMessage {
|
|
|
8
8
|
id?: string;
|
|
9
9
|
role: "user" | "assistant" | "system" | string;
|
|
10
10
|
content: string;
|
|
11
|
+
a2ui?: unknown;
|
|
12
|
+
a2uiMessage?: unknown;
|
|
13
|
+
a2uiMessages?: unknown;
|
|
14
|
+
a2ui_message?: unknown;
|
|
15
|
+
a2ui_messages?: unknown;
|
|
16
|
+
agui?: unknown;
|
|
17
|
+
aguiEvents?: unknown;
|
|
18
|
+
agui_events?: unknown;
|
|
11
19
|
metadata?: string | any;
|
|
12
20
|
attachments?: FileAttachment[];
|
|
13
21
|
create_time?: string;
|
|
@@ -19,3 +27,4 @@ export interface AgentStep {
|
|
|
19
27
|
status: "running" | "completed" | "error";
|
|
20
28
|
startTime?: number;
|
|
21
29
|
}
|
|
30
|
+
export type A2UIActionHandler = (event: unknown) => unknown[] | Promise<unknown[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rt-chat-messages",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "AI对话消息展示组件,开箱即用,支持Markdown、Mermaid、多模态内容",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/chat-messages.umd.js",
|
|
@@ -30,10 +30,12 @@
|
|
|
30
30
|
"katex": "^0.16.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"vue": "^
|
|
33
|
+
"a2ui-vue": "^0.9.2",
|
|
34
|
+
"vue": "^3.4.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
38
|
+
"a2ui-vue": "^0.9.2",
|
|
37
39
|
"typescript": "~5.6.2",
|
|
38
40
|
"vite": "^6.0.5",
|
|
39
41
|
"vite-plugin-dts": "^4.4.0",
|