import { ChatMessage, ChatHistoryItem, MessageGroup, NewChatProps, ModelInfo, AvailableModel } from '../types'; import { ChatService } from '../services'; import { ESTool, MCPToolParams } from '../MCPClients/type'; import { Ref, ComputedRef } from 'vue'; /** 下拉选项列表(扁平结构,每项格式:"厂商-模型") */ interface FlatModelOption { provider: string; modelId: string; baseUrl: string; apiKey: string; isLocal?: boolean; } /** * 初始化聊天服务 */ declare function initializeChatService(newConfig: NewChatProps): Promise; /** * 从存储加载原始数据(不依赖当前模式与 chatService,须在 initializeChatService 之前调用)。 * 仅恢复 chatHistoryList / localModels / currentModelConfig;当前对话的恢复见 restoreCurrentChat。 */ declare function loadFromStorage(): void; /** * 恢复当前对话(依赖当前模式与 chatService,须在 initializeChatService 之后调用)。 * 按当前模式过滤后选取上次对话或第一项;earthServer 项复聊时经 loadChat 注入 sessionId。 */ declare function restoreCurrentChat(): void; /** * 保存当前对话(防抖) */ declare function saveCurrentChat(): void; /** 创建新对话 */ declare function createNewChat(): void; /** 加载指定对话 */ declare function loadChat(chatId: string): void; /** 删除对话 */ declare function deleteChat(chatId: string): void; /** 清除当前聊天 */ declare function clearChat(): void; /** 发送消息 */ declare function sendMessage(content: string): Promise; /** 停止生成 */ declare function stopMessage(): void; /** 重新生成回答 */ declare function regenerateAnswer(groupIndex: number): Promise; declare function toggleHistoryPanel(): void; declare function toggleMcpPanel(): void; declare function toggleModelPanel(): void; declare function closeAllPanels(): void; declare function setLocalModels(models: AvailableModel[]): void; declare function updateLocalModel(model: AvailableModel): void; declare function removeLocalModel(provider: string): void; declare function updateModelConfig(config: ModelInfo): void; /** 切换模型 */ declare function switchModel(option: FlatModelOption): void; declare function getChatService(): ChatService | null; declare function getGroupedTools(): { group: string; tools: { inputSchema: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; }; name: string; description?: string | undefined | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; } | undefined; annotations?: { title?: string | undefined | undefined; readOnlyHint?: boolean | undefined | undefined; destructiveHint?: boolean | undefined | undefined; idempotentHint?: boolean | undefined | undefined; openWorldHint?: boolean | undefined | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined | undefined; } | undefined; _meta?: Record | undefined; icons?: { src: string; mimeType?: string | undefined | undefined; sizes?: string[] | undefined | undefined; theme?: "light" | "dark" | undefined | undefined; }[] | undefined; title?: string | undefined | undefined; }[]; }[]; declare function initializeMCP(): Promise; declare function registerTools(tools: ESTool[]): Promise; declare function setSystemPrompt(systemPrompt: string): void; /** * 聊天状态 Composable * 所有组件调用此函数获取同一个状态的访问接口 */ export declare function useChatStore(): { messages: Ref<{ role: "system" | "user" | "assistant" | "tool"; content: string; timestamp?: number | undefined; isComplete?: boolean | undefined; toolCalls?: { name: string; params: any; result?: any; error?: string | undefined; success: boolean; timestamp: number; }[] | undefined; tool_calls?: { id: string; type: "function"; function: { name: string; arguments: any; }; }[] | undefined; tool_call_id?: string | undefined; }[], ChatMessage[] | { role: "system" | "user" | "assistant" | "tool"; content: string; timestamp?: number | undefined; isComplete?: boolean | undefined; toolCalls?: { name: string; params: any; result?: any; error?: string | undefined; success: boolean; timestamp: number; }[] | undefined; tool_calls?: { id: string; type: "function"; function: { name: string; arguments: any; }; }[] | undefined; tool_call_id?: string | undefined; }[]>; chatHistoryList: Ref<{ id: string; title: string; date: string; messages: { role: "system" | "user" | "assistant" | "tool"; content: string; timestamp?: number | undefined; isComplete?: boolean | undefined; toolCalls?: { name: string; params: any; result?: any; error?: string | undefined; success: boolean; timestamp: number; }[] | undefined; tool_calls?: { id: string; type: "function"; function: { name: string; arguments: any; }; }[] | undefined; tool_call_id?: string | undefined; }[]; type?: "earthServer" | "default" | undefined; }[], ChatHistoryItem[] | { id: string; title: string; date: string; messages: { role: "system" | "user" | "assistant" | "tool"; content: string; timestamp?: number | undefined; isComplete?: boolean | undefined; toolCalls?: { name: string; params: any; result?: any; error?: string | undefined; success: boolean; timestamp: number; }[] | undefined; tool_calls?: { id: string; type: "function"; function: { name: string; arguments: any; }; }[] | undefined; tool_call_id?: string | undefined; }[]; type?: "earthServer" | "default" | undefined; }[]>; filteredChatHistoryList: ComputedRef; currentChatId: Ref; isLoading: Ref; currentChat: ComputedRef<{ id: string; title: string; date: string; messages: { role: "system" | "user" | "assistant" | "tool"; content: string; timestamp?: number | undefined; isComplete?: boolean | undefined; toolCalls?: { name: string; params: any; result?: any; error?: string | undefined; success: boolean; timestamp: number; }[] | undefined; tool_calls?: { id: string; type: "function"; function: { name: string; arguments: any; }; }[] | undefined; tool_call_id?: string | undefined; }[]; type?: "earthServer" | "default" | undefined; } | undefined>; messageGroups: ComputedRef; showHistoryPanel: Ref; showMcpPanel: Ref; showModelPanel: Ref; localModels: Ref<{ provider: string; baseUrl: string; apiKey: string; models: string[]; }[], AvailableModel[] | { provider: string; baseUrl: string; apiKey: string; models: string[]; }[]>; currentModelConfig: Ref<{ id: string; baseUrl: string; apiKey: string; modelId: string; }, ModelInfo | { id: string; baseUrl: string; apiKey: string; modelId: string; }>; availableModels: Ref<{ provider: string; baseUrl: string; apiKey: string; models: string[]; }[], AvailableModel[] | { provider: string; baseUrl: string; apiKey: string; models: string[]; }[]>; modelOptions: ComputedRef; isEarthServerMode: Ref; chatService: ChatService | null; initializeChatService: typeof initializeChatService; loadFromStorage: typeof loadFromStorage; restoreCurrentChat: typeof restoreCurrentChat; createNewChat: typeof createNewChat; loadChat: typeof loadChat; deleteChat: typeof deleteChat; clearChat: typeof clearChat; sendMessage: typeof sendMessage; stopMessage: typeof stopMessage; regenerateAnswer: typeof regenerateAnswer; toggleHistoryPanel: typeof toggleHistoryPanel; toggleMcpPanel: typeof toggleMcpPanel; toggleModelPanel: typeof toggleModelPanel; closeAllPanels: typeof closeAllPanels; setLocalModels: typeof setLocalModels; updateLocalModel: typeof updateLocalModel; removeLocalModel: typeof removeLocalModel; updateModelConfig: typeof updateModelConfig; switchModel: typeof switchModel; getChatService: typeof getChatService; getGroupedTools: typeof getGroupedTools; groupedTools: Ref<{ group: string; tools: { inputSchema: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; }; name: string; description?: string | undefined | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; } | undefined; annotations?: { title?: string | undefined | undefined; readOnlyHint?: boolean | undefined | undefined; destructiveHint?: boolean | undefined | undefined; idempotentHint?: boolean | undefined | undefined; openWorldHint?: boolean | undefined | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined | undefined; } | undefined; _meta?: Record | undefined; icons?: { src: string; mimeType?: string | undefined | undefined; sizes?: string[] | undefined | undefined; theme?: "light" | "dark" | undefined | undefined; }[] | undefined; title?: string | undefined | undefined; }[]; }[], { group: string; tools: MCPToolParams[]; }[] | { group: string; tools: { inputSchema: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; }; name: string; description?: string | undefined | undefined; outputSchema?: { [x: string]: unknown; type: "object"; properties?: Record | undefined; required?: string[] | undefined | undefined; } | undefined; annotations?: { title?: string | undefined | undefined; readOnlyHint?: boolean | undefined | undefined; destructiveHint?: boolean | undefined | undefined; idempotentHint?: boolean | undefined | undefined; openWorldHint?: boolean | undefined | undefined; } | undefined; execution?: { taskSupport?: "optional" | "required" | "forbidden" | undefined | undefined; } | undefined; _meta?: Record | undefined; icons?: { src: string; mimeType?: string | undefined | undefined; sizes?: string[] | undefined | undefined; theme?: "light" | "dark" | undefined | undefined; }[] | undefined; title?: string | undefined | undefined; }[]; }[]>; initializeMCP: typeof initializeMCP; registerTools: typeof registerTools; setSystemPrompt: typeof setSystemPrompt; saveCurrentChat: typeof saveCurrentChat; }; export {};