@legendzd/ai-agent-vue 1.0.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/README.md +679 -0
- package/dist/ai-agent-vue.css +2 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.cjs +239 -0
- package/dist/index.mjs +68891 -0
- package/dist/src/api/agent.d.ts +21 -0
- package/dist/src/components/AIIcon.vue.d.ts +3 -0
- package/dist/src/components/AgentButton.vue.d.ts +13 -0
- package/dist/src/components/AgentHistoryList.vue.d.ts +18 -0
- package/dist/src/components/AgentWindow.vue.d.ts +8 -0
- package/dist/src/components/ChatMessage.vue.d.ts +7 -0
- package/dist/src/components/HistoryPopover.vue.d.ts +15 -0
- package/dist/src/components/OrbCircle.vue.d.ts +14 -0
- package/dist/src/composables/useAgentSetup.d.ts +24 -0
- package/dist/src/composables/useClickOutside.d.ts +7 -0
- package/dist/src/composables/useSpeechRecognition.d.ts +22 -0
- package/dist/src/plugin/index.d.ts +1 -0
- package/dist/src/stores/chat.d.ts +406 -0
- package/dist/src/stores/pinia.d.ts +7 -0
- package/dist/src/types/agent.d.ts +136 -0
- package/dist/src/utils/echart.d.ts +84 -0
- package/dist/src/utils/echarts-zh-cn-locale.d.ts +1 -0
- package/dist/src/views/AgentChat.vue.d.ts +59 -0
- package/dist/src/views/AgentChatFull.vue.d.ts +56 -0
- package/dist/src/views/AgentChatMobile.vue.d.ts +62 -0
- package/package.json +80 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AgentPluginOptions, SessionInfo, StreamCallbacks, StreamRequestData } from '../../types/agent';
|
|
2
|
+
/** 注入插件配置 */
|
|
3
|
+
export declare function setAgentOptions(options: AgentPluginOptions): void;
|
|
4
|
+
/** 获取插件配置 */
|
|
5
|
+
export declare function getAgentOptions(): AgentPluginOptions;
|
|
6
|
+
/**
|
|
7
|
+
* 创建会话
|
|
8
|
+
* POST ${apiUrl}/agent/chat/session
|
|
9
|
+
*/
|
|
10
|
+
export declare function createChatSession(options?: AgentPluginOptions): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* 获取历史会话列表
|
|
13
|
+
* GET ${apiUrl}/agent/chat/sessions?userId=xxx
|
|
14
|
+
*/
|
|
15
|
+
export declare function getChatSessions(options?: AgentPluginOptions): Promise<SessionInfo[]>;
|
|
16
|
+
/**
|
|
17
|
+
* 流式文本生成接口
|
|
18
|
+
* 使用 fetch + ReadableStream 实现 SSE 流式读取
|
|
19
|
+
* 支持新事件类型:status/sql/data/chart_config/sources/analysis_chunk/error
|
|
20
|
+
*/
|
|
21
|
+
export declare function streamChat(data: StreamRequestData, callbacks: StreamCallbacks, options?: AgentPluginOptions): AbortController;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** 是否激活(窗口打开状态) */
|
|
3
|
+
active: boolean;
|
|
4
|
+
/** 实例 ID(透传,按钮本身不需要 store) */
|
|
5
|
+
instanceId?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
|
+
click: () => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onClick?: (() => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AgentPluginOptions } from '../../types/agent';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 实例 ID,默认 'default' */
|
|
4
|
+
instanceId?: string;
|
|
5
|
+
/** 插件配置(首次使用时传入,用于创建实例) */
|
|
6
|
+
config?: AgentPluginOptions;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
9
|
+
select: (id: string) => any;
|
|
10
|
+
"new-chat": () => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onSelect?: ((id: string) => any) | undefined;
|
|
13
|
+
"onNew-chat"?: (() => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
instanceId: string;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
instanceId?: 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<{}>, {
|
|
5
|
+
instanceId: string;
|
|
6
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChatMessage } from '../../types/agent';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
message: ChatMessage;
|
|
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,15 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
instanceId?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
6
|
+
select: (id: string) => any;
|
|
7
|
+
"new-chat": () => any;
|
|
8
|
+
"update:visible": (val: boolean) => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onSelect?: ((id: string) => any) | undefined;
|
|
11
|
+
"onNew-chat"?: (() => any) | undefined;
|
|
12
|
+
"onUpdate:visible"?: ((val: boolean) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface OrbProps {
|
|
2
|
+
hue?: number;
|
|
3
|
+
hoverIntensity?: number;
|
|
4
|
+
rotateOnHover?: boolean;
|
|
5
|
+
forceHoverState?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const __VLS_export: import('vue').DefineComponent<OrbProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<OrbProps> & Readonly<{}>, {
|
|
8
|
+
hue: number;
|
|
9
|
+
hoverIntensity: number;
|
|
10
|
+
rotateOnHover: boolean;
|
|
11
|
+
forceHoverState: boolean;
|
|
12
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ChatStoreInstance } from '../../stores/chat';
|
|
2
|
+
import { AgentPluginOptions, AgentThemeMode } from '../../types/agent';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
/** useAgentSetup 返回值 */
|
|
5
|
+
export interface UseAgentSetupReturn {
|
|
6
|
+
/** 合并后的配置 */
|
|
7
|
+
mergedConfig: ComputedRef<AgentPluginOptions>;
|
|
8
|
+
/** 解析后的实例 ID */
|
|
9
|
+
resolvedInstanceId: ComputedRef<string>;
|
|
10
|
+
/** 对应实例的 store */
|
|
11
|
+
chat: ChatStoreInstance;
|
|
12
|
+
/** 主题变量内联样式 */
|
|
13
|
+
themeStyle: ComputedRef<string | undefined>;
|
|
14
|
+
/** 当前主题模式 */
|
|
15
|
+
currentMode: ComputedRef<AgentThemeMode>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 布局模板共享的初始化逻辑
|
|
19
|
+
*
|
|
20
|
+
* 处理:配置合并 → 实例创建 → provide/inject → 暗色模式同步 → 主题样式计算
|
|
21
|
+
*/
|
|
22
|
+
export declare function useAgentSetup(props: AgentPluginOptions & {
|
|
23
|
+
config?: AgentPluginOptions;
|
|
24
|
+
}): UseAgentSetupReturn;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 语音识别选项 */
|
|
2
|
+
export interface UseSpeechRecognitionOptions {
|
|
3
|
+
/** 识别语言,默认 zh-CN */
|
|
4
|
+
lang?: string;
|
|
5
|
+
/** 是否持续识别,默认 true */
|
|
6
|
+
continuous?: boolean;
|
|
7
|
+
/** 是否返回临时结果,默认 true */
|
|
8
|
+
interimResults?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 轻量语音识别组合式函数
|
|
12
|
+
* 基于浏览器原生 Web Speech API,Chrome/Edge 下使用 Google/微软云端引擎,准确率高
|
|
13
|
+
*/
|
|
14
|
+
export declare function useSpeechRecognition(options?: UseSpeechRecognitionOptions): {
|
|
15
|
+
isListening: import('vue').Ref<boolean, boolean>;
|
|
16
|
+
isSupported: import('vue').Ref<boolean, boolean>;
|
|
17
|
+
result: import('vue').Ref<string, string>;
|
|
18
|
+
error: import('vue').Ref<string | null, string | null>;
|
|
19
|
+
start: () => void;
|
|
20
|
+
stop: () => void;
|
|
21
|
+
toggle: () => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { AgentPluginOptions, ChatMessage, SessionInfo, SourceInfo } from '../../types/agent';
|
|
2
|
+
/** 聊天 store 实例类型 */
|
|
3
|
+
export type ChatStoreInstance = ReturnType<ReturnType<typeof createChatStoreDefinition>>;
|
|
4
|
+
/** 获取或创建聊天实例 */
|
|
5
|
+
export declare function getOrCreateChatInstance(instanceId?: string, options?: AgentPluginOptions): ChatStoreInstance;
|
|
6
|
+
/** 获取聊天实例(不创建) */
|
|
7
|
+
export declare function getChatInstance(instanceId?: string): ChatStoreInstance | undefined;
|
|
8
|
+
/** 获取实例配置 */
|
|
9
|
+
export declare function getInstanceConfig(instanceId?: string): AgentPluginOptions;
|
|
10
|
+
/** 销毁聊天实例 */
|
|
11
|
+
export declare function destroyChatInstance(instanceId: string): void;
|
|
12
|
+
/** 创建指定 instanceId 的聊天 store 定义 */
|
|
13
|
+
declare function createChatStoreDefinition(instanceId: string): import('pinia').StoreDefinition<`agent-chat-${string}`, Pick<{
|
|
14
|
+
sessionId: import('vue').Ref<string, string>;
|
|
15
|
+
sessions: import('vue').Ref<{
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
created_at: string;
|
|
19
|
+
}[], SessionInfo[] | {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
created_at: string;
|
|
23
|
+
}[]>;
|
|
24
|
+
messages: import('vue').Ref<{
|
|
25
|
+
id: string;
|
|
26
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
27
|
+
content: string;
|
|
28
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
29
|
+
createdAt: number;
|
|
30
|
+
reportId?: number | undefined;
|
|
31
|
+
title?: string | undefined;
|
|
32
|
+
errorMessage?: string | undefined;
|
|
33
|
+
statusText?: string | undefined;
|
|
34
|
+
sql?: string | undefined;
|
|
35
|
+
data?: any[] | undefined;
|
|
36
|
+
dataExpanded?: boolean | undefined;
|
|
37
|
+
chartConfig?: any;
|
|
38
|
+
sources?: {
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
}[], ChatMessage[] | {
|
|
43
|
+
id: string;
|
|
44
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
45
|
+
content: string;
|
|
46
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
47
|
+
createdAt: number;
|
|
48
|
+
reportId?: number | undefined;
|
|
49
|
+
title?: string | undefined;
|
|
50
|
+
errorMessage?: string | undefined;
|
|
51
|
+
statusText?: string | undefined;
|
|
52
|
+
sql?: string | undefined;
|
|
53
|
+
data?: any[] | undefined;
|
|
54
|
+
dataExpanded?: boolean | undefined;
|
|
55
|
+
chartConfig?: any;
|
|
56
|
+
sources?: {
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
}[] | undefined;
|
|
60
|
+
}[]>;
|
|
61
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
62
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
63
|
+
initSession: () => Promise<void>;
|
|
64
|
+
loadSessions: () => Promise<void>;
|
|
65
|
+
switchSession: (id: string) => void;
|
|
66
|
+
newChat: () => Promise<void>;
|
|
67
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
68
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
69
|
+
appendStreamContent: (content: string) => void;
|
|
70
|
+
updateStatusText: (text: string) => void;
|
|
71
|
+
updateSql: (sql: string) => void;
|
|
72
|
+
updateData: (data: any[]) => void;
|
|
73
|
+
updateChartConfig: (config: any) => void;
|
|
74
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
75
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
76
|
+
markStreamError: (errorMessage: string) => void;
|
|
77
|
+
clearMessages: () => void;
|
|
78
|
+
}, "sessionId" | "sessions" | "messages" | "isStreaming" | "isSessionLoading">, Pick<{
|
|
79
|
+
sessionId: import('vue').Ref<string, string>;
|
|
80
|
+
sessions: import('vue').Ref<{
|
|
81
|
+
id: string;
|
|
82
|
+
title: string;
|
|
83
|
+
created_at: string;
|
|
84
|
+
}[], SessionInfo[] | {
|
|
85
|
+
id: string;
|
|
86
|
+
title: string;
|
|
87
|
+
created_at: string;
|
|
88
|
+
}[]>;
|
|
89
|
+
messages: import('vue').Ref<{
|
|
90
|
+
id: string;
|
|
91
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
92
|
+
content: string;
|
|
93
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
94
|
+
createdAt: number;
|
|
95
|
+
reportId?: number | undefined;
|
|
96
|
+
title?: string | undefined;
|
|
97
|
+
errorMessage?: string | undefined;
|
|
98
|
+
statusText?: string | undefined;
|
|
99
|
+
sql?: string | undefined;
|
|
100
|
+
data?: any[] | undefined;
|
|
101
|
+
dataExpanded?: boolean | undefined;
|
|
102
|
+
chartConfig?: any;
|
|
103
|
+
sources?: {
|
|
104
|
+
id: string;
|
|
105
|
+
title: string;
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
}[], ChatMessage[] | {
|
|
108
|
+
id: string;
|
|
109
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
110
|
+
content: string;
|
|
111
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
112
|
+
createdAt: number;
|
|
113
|
+
reportId?: number | undefined;
|
|
114
|
+
title?: string | undefined;
|
|
115
|
+
errorMessage?: string | undefined;
|
|
116
|
+
statusText?: string | undefined;
|
|
117
|
+
sql?: string | undefined;
|
|
118
|
+
data?: any[] | undefined;
|
|
119
|
+
dataExpanded?: boolean | undefined;
|
|
120
|
+
chartConfig?: any;
|
|
121
|
+
sources?: {
|
|
122
|
+
id: string;
|
|
123
|
+
title: string;
|
|
124
|
+
}[] | undefined;
|
|
125
|
+
}[]>;
|
|
126
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
127
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
128
|
+
initSession: () => Promise<void>;
|
|
129
|
+
loadSessions: () => Promise<void>;
|
|
130
|
+
switchSession: (id: string) => void;
|
|
131
|
+
newChat: () => Promise<void>;
|
|
132
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
133
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
134
|
+
appendStreamContent: (content: string) => void;
|
|
135
|
+
updateStatusText: (text: string) => void;
|
|
136
|
+
updateSql: (sql: string) => void;
|
|
137
|
+
updateData: (data: any[]) => void;
|
|
138
|
+
updateChartConfig: (config: any) => void;
|
|
139
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
140
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
141
|
+
markStreamError: (errorMessage: string) => void;
|
|
142
|
+
clearMessages: () => void;
|
|
143
|
+
}, never>, Pick<{
|
|
144
|
+
sessionId: import('vue').Ref<string, string>;
|
|
145
|
+
sessions: import('vue').Ref<{
|
|
146
|
+
id: string;
|
|
147
|
+
title: string;
|
|
148
|
+
created_at: string;
|
|
149
|
+
}[], SessionInfo[] | {
|
|
150
|
+
id: string;
|
|
151
|
+
title: string;
|
|
152
|
+
created_at: string;
|
|
153
|
+
}[]>;
|
|
154
|
+
messages: import('vue').Ref<{
|
|
155
|
+
id: string;
|
|
156
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
157
|
+
content: string;
|
|
158
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
159
|
+
createdAt: number;
|
|
160
|
+
reportId?: number | undefined;
|
|
161
|
+
title?: string | undefined;
|
|
162
|
+
errorMessage?: string | undefined;
|
|
163
|
+
statusText?: string | undefined;
|
|
164
|
+
sql?: string | undefined;
|
|
165
|
+
data?: any[] | undefined;
|
|
166
|
+
dataExpanded?: boolean | undefined;
|
|
167
|
+
chartConfig?: any;
|
|
168
|
+
sources?: {
|
|
169
|
+
id: string;
|
|
170
|
+
title: string;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
}[], ChatMessage[] | {
|
|
173
|
+
id: string;
|
|
174
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
175
|
+
content: string;
|
|
176
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
177
|
+
createdAt: number;
|
|
178
|
+
reportId?: number | undefined;
|
|
179
|
+
title?: string | undefined;
|
|
180
|
+
errorMessage?: string | undefined;
|
|
181
|
+
statusText?: string | undefined;
|
|
182
|
+
sql?: string | undefined;
|
|
183
|
+
data?: any[] | undefined;
|
|
184
|
+
dataExpanded?: boolean | undefined;
|
|
185
|
+
chartConfig?: any;
|
|
186
|
+
sources?: {
|
|
187
|
+
id: string;
|
|
188
|
+
title: string;
|
|
189
|
+
}[] | undefined;
|
|
190
|
+
}[]>;
|
|
191
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
192
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
193
|
+
initSession: () => Promise<void>;
|
|
194
|
+
loadSessions: () => Promise<void>;
|
|
195
|
+
switchSession: (id: string) => void;
|
|
196
|
+
newChat: () => Promise<void>;
|
|
197
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
198
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
199
|
+
appendStreamContent: (content: string) => void;
|
|
200
|
+
updateStatusText: (text: string) => void;
|
|
201
|
+
updateSql: (sql: string) => void;
|
|
202
|
+
updateData: (data: any[]) => void;
|
|
203
|
+
updateChartConfig: (config: any) => void;
|
|
204
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
205
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
206
|
+
markStreamError: (errorMessage: string) => void;
|
|
207
|
+
clearMessages: () => void;
|
|
208
|
+
}, "initSession" | "loadSessions" | "switchSession" | "newChat" | "addUserMessage" | "addAssistantPlaceholder" | "appendStreamContent" | "updateStatusText" | "updateSql" | "updateData" | "updateChartConfig" | "updateSources" | "markStreamDone" | "markStreamError" | "clearMessages">>;
|
|
209
|
+
/** 默认聊天 store 实例(instanceId = 'default') */
|
|
210
|
+
export declare const chatStore: import('pinia').Store<`agent-chat-${string}`, Pick<{
|
|
211
|
+
sessionId: import('vue').Ref<string, string>;
|
|
212
|
+
sessions: import('vue').Ref<{
|
|
213
|
+
id: string;
|
|
214
|
+
title: string;
|
|
215
|
+
created_at: string;
|
|
216
|
+
}[], SessionInfo[] | {
|
|
217
|
+
id: string;
|
|
218
|
+
title: string;
|
|
219
|
+
created_at: string;
|
|
220
|
+
}[]>;
|
|
221
|
+
messages: import('vue').Ref<{
|
|
222
|
+
id: string;
|
|
223
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
224
|
+
content: string;
|
|
225
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
226
|
+
createdAt: number;
|
|
227
|
+
reportId?: number | undefined;
|
|
228
|
+
title?: string | undefined;
|
|
229
|
+
errorMessage?: string | undefined;
|
|
230
|
+
statusText?: string | undefined;
|
|
231
|
+
sql?: string | undefined;
|
|
232
|
+
data?: any[] | undefined;
|
|
233
|
+
dataExpanded?: boolean | undefined;
|
|
234
|
+
chartConfig?: any;
|
|
235
|
+
sources?: {
|
|
236
|
+
id: string;
|
|
237
|
+
title: string;
|
|
238
|
+
}[] | undefined;
|
|
239
|
+
}[], ChatMessage[] | {
|
|
240
|
+
id: string;
|
|
241
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
242
|
+
content: string;
|
|
243
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
244
|
+
createdAt: number;
|
|
245
|
+
reportId?: number | undefined;
|
|
246
|
+
title?: string | undefined;
|
|
247
|
+
errorMessage?: string | undefined;
|
|
248
|
+
statusText?: string | undefined;
|
|
249
|
+
sql?: string | undefined;
|
|
250
|
+
data?: any[] | undefined;
|
|
251
|
+
dataExpanded?: boolean | undefined;
|
|
252
|
+
chartConfig?: any;
|
|
253
|
+
sources?: {
|
|
254
|
+
id: string;
|
|
255
|
+
title: string;
|
|
256
|
+
}[] | undefined;
|
|
257
|
+
}[]>;
|
|
258
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
259
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
260
|
+
initSession: () => Promise<void>;
|
|
261
|
+
loadSessions: () => Promise<void>;
|
|
262
|
+
switchSession: (id: string) => void;
|
|
263
|
+
newChat: () => Promise<void>;
|
|
264
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
265
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
266
|
+
appendStreamContent: (content: string) => void;
|
|
267
|
+
updateStatusText: (text: string) => void;
|
|
268
|
+
updateSql: (sql: string) => void;
|
|
269
|
+
updateData: (data: any[]) => void;
|
|
270
|
+
updateChartConfig: (config: any) => void;
|
|
271
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
272
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
273
|
+
markStreamError: (errorMessage: string) => void;
|
|
274
|
+
clearMessages: () => void;
|
|
275
|
+
}, "sessionId" | "sessions" | "messages" | "isStreaming" | "isSessionLoading">, Pick<{
|
|
276
|
+
sessionId: import('vue').Ref<string, string>;
|
|
277
|
+
sessions: import('vue').Ref<{
|
|
278
|
+
id: string;
|
|
279
|
+
title: string;
|
|
280
|
+
created_at: string;
|
|
281
|
+
}[], SessionInfo[] | {
|
|
282
|
+
id: string;
|
|
283
|
+
title: string;
|
|
284
|
+
created_at: string;
|
|
285
|
+
}[]>;
|
|
286
|
+
messages: import('vue').Ref<{
|
|
287
|
+
id: string;
|
|
288
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
289
|
+
content: string;
|
|
290
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
291
|
+
createdAt: number;
|
|
292
|
+
reportId?: number | undefined;
|
|
293
|
+
title?: string | undefined;
|
|
294
|
+
errorMessage?: string | undefined;
|
|
295
|
+
statusText?: string | undefined;
|
|
296
|
+
sql?: string | undefined;
|
|
297
|
+
data?: any[] | undefined;
|
|
298
|
+
dataExpanded?: boolean | undefined;
|
|
299
|
+
chartConfig?: any;
|
|
300
|
+
sources?: {
|
|
301
|
+
id: string;
|
|
302
|
+
title: string;
|
|
303
|
+
}[] | undefined;
|
|
304
|
+
}[], ChatMessage[] | {
|
|
305
|
+
id: string;
|
|
306
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
307
|
+
content: string;
|
|
308
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
309
|
+
createdAt: number;
|
|
310
|
+
reportId?: number | undefined;
|
|
311
|
+
title?: string | undefined;
|
|
312
|
+
errorMessage?: string | undefined;
|
|
313
|
+
statusText?: string | undefined;
|
|
314
|
+
sql?: string | undefined;
|
|
315
|
+
data?: any[] | undefined;
|
|
316
|
+
dataExpanded?: boolean | undefined;
|
|
317
|
+
chartConfig?: any;
|
|
318
|
+
sources?: {
|
|
319
|
+
id: string;
|
|
320
|
+
title: string;
|
|
321
|
+
}[] | undefined;
|
|
322
|
+
}[]>;
|
|
323
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
324
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
325
|
+
initSession: () => Promise<void>;
|
|
326
|
+
loadSessions: () => Promise<void>;
|
|
327
|
+
switchSession: (id: string) => void;
|
|
328
|
+
newChat: () => Promise<void>;
|
|
329
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
330
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
331
|
+
appendStreamContent: (content: string) => void;
|
|
332
|
+
updateStatusText: (text: string) => void;
|
|
333
|
+
updateSql: (sql: string) => void;
|
|
334
|
+
updateData: (data: any[]) => void;
|
|
335
|
+
updateChartConfig: (config: any) => void;
|
|
336
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
337
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
338
|
+
markStreamError: (errorMessage: string) => void;
|
|
339
|
+
clearMessages: () => void;
|
|
340
|
+
}, never>, Pick<{
|
|
341
|
+
sessionId: import('vue').Ref<string, string>;
|
|
342
|
+
sessions: import('vue').Ref<{
|
|
343
|
+
id: string;
|
|
344
|
+
title: string;
|
|
345
|
+
created_at: string;
|
|
346
|
+
}[], SessionInfo[] | {
|
|
347
|
+
id: string;
|
|
348
|
+
title: string;
|
|
349
|
+
created_at: string;
|
|
350
|
+
}[]>;
|
|
351
|
+
messages: import('vue').Ref<{
|
|
352
|
+
id: string;
|
|
353
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
354
|
+
content: string;
|
|
355
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
356
|
+
createdAt: number;
|
|
357
|
+
reportId?: number | undefined;
|
|
358
|
+
title?: string | undefined;
|
|
359
|
+
errorMessage?: string | undefined;
|
|
360
|
+
statusText?: string | undefined;
|
|
361
|
+
sql?: string | undefined;
|
|
362
|
+
data?: any[] | undefined;
|
|
363
|
+
dataExpanded?: boolean | undefined;
|
|
364
|
+
chartConfig?: any;
|
|
365
|
+
sources?: {
|
|
366
|
+
id: string;
|
|
367
|
+
title: string;
|
|
368
|
+
}[] | undefined;
|
|
369
|
+
}[], ChatMessage[] | {
|
|
370
|
+
id: string;
|
|
371
|
+
role: import('../../types/agent').ChatMessageRole;
|
|
372
|
+
content: string;
|
|
373
|
+
status: import('../../types/agent').ChatMessageStatus;
|
|
374
|
+
createdAt: number;
|
|
375
|
+
reportId?: number | undefined;
|
|
376
|
+
title?: string | undefined;
|
|
377
|
+
errorMessage?: string | undefined;
|
|
378
|
+
statusText?: string | undefined;
|
|
379
|
+
sql?: string | undefined;
|
|
380
|
+
data?: any[] | undefined;
|
|
381
|
+
dataExpanded?: boolean | undefined;
|
|
382
|
+
chartConfig?: any;
|
|
383
|
+
sources?: {
|
|
384
|
+
id: string;
|
|
385
|
+
title: string;
|
|
386
|
+
}[] | undefined;
|
|
387
|
+
}[]>;
|
|
388
|
+
isStreaming: import('vue').Ref<boolean, boolean>;
|
|
389
|
+
isSessionLoading: import('vue').Ref<boolean, boolean>;
|
|
390
|
+
initSession: () => Promise<void>;
|
|
391
|
+
loadSessions: () => Promise<void>;
|
|
392
|
+
switchSession: (id: string) => void;
|
|
393
|
+
newChat: () => Promise<void>;
|
|
394
|
+
addUserMessage: (content: string) => ChatMessage;
|
|
395
|
+
addAssistantPlaceholder: () => ChatMessage;
|
|
396
|
+
appendStreamContent: (content: string) => void;
|
|
397
|
+
updateStatusText: (text: string) => void;
|
|
398
|
+
updateSql: (sql: string) => void;
|
|
399
|
+
updateData: (data: any[]) => void;
|
|
400
|
+
updateChartConfig: (config: any) => void;
|
|
401
|
+
updateSources: (sources: SourceInfo[]) => void;
|
|
402
|
+
markStreamDone: (reportId?: number, title?: string) => void;
|
|
403
|
+
markStreamError: (errorMessage: string) => void;
|
|
404
|
+
clearMessages: () => void;
|
|
405
|
+
}, "initSession" | "loadSessions" | "switchSession" | "newChat" | "addUserMessage" | "addAssistantPlaceholder" | "appendStreamContent" | "updateStatusText" | "updateSql" | "updateData" | "updateChartConfig" | "updateSources" | "markStreamDone" | "markStreamError" | "clearMessages">>;
|
|
406
|
+
export {};
|