/** * 统一的错误类型定义 * 替代分散在各处的 try-catch 和错误处理 */ export type ErrorCode = 'NETWORK_ERROR' | 'TOOL_CALL_ERROR' | 'MODEL_ERROR' | 'RAG_ERROR' | 'STORAGE_ERROR' | 'AUDIO_ERROR' | 'AUTH_ERROR' | 'UNKNOWN_ERROR'; export declare class ChatError extends Error { readonly code: ErrorCode; readonly details?: any | undefined; constructor(message: string, code: ErrorCode, details?: any | undefined); toJSON(): { name: string; message: string; code: ErrorCode; details: any; }; } export declare function isChatError(error: unknown): error is ChatError; export declare function createChatError(message: string, code: ErrorCode, details?: any): ChatError;