/** * ConversationManager — 对话管理器 * * 完整的对话生命周期管理: * 1. 创建/切换/删除对话 * 2. 消息持久化(JSON) * 3. 对话搜索(按内容/时间/标签) * 4. 导出(JSON/Markdown/TXT) * 5. 消息编辑/删除/重新生成标记 * 6. 对话摘要自动生成 */ export interface ConversationMessage { id: string; role: "user" | "assistant" | "system"; content: string; timestamp: string; edited?: boolean; metadata?: { model?: string; tokensUsed?: number; toolsCalled?: string[]; ragContext?: boolean; }; } export interface Conversation { id: string; title: string; messages: ConversationMessage[]; createdAt: string; updatedAt: string; tags: string[]; pinned: boolean; archived: boolean; summary?: string; metadata?: { messageCount: number; totalTokens?: number; }; } export interface ConversationManagerConfig { dataPath: string; maxConversations: number; maxMessagesPerConversation: number; autoSummary: boolean; } export interface ConversationSearchOptions { keyword?: string; tags?: string[]; dateFrom?: string; dateTo?: string; pinned?: boolean; archived?: boolean; } export declare class ConversationManager { private config; private conversations; constructor(config?: Partial); /** 创建新对话 */ createConversation(title?: string, tags?: string[]): Conversation; /** 获取对话 */ getConversation(id: string): Conversation | undefined; /** 删除对话 */ deleteConversation(id: string): boolean; /** 列出对话(最近的在前) */ listConversations(options?: ConversationSearchOptions): Array<{ id: string; title: string; messageCount: number; lastMessage?: string; updatedAt: string; tags: string[]; pinned: boolean; archived: boolean; summary?: string; }>; /** 添加消息 */ addMessage(conversationId: string, role: "user" | "assistant" | "system", content: string, metadata?: ConversationMessage["metadata"]): ConversationMessage | null; /** 编辑消息 */ editMessage(conversationId: string, messageId: string, newContent: string): boolean; /** 删除消息 */ deleteMessage(conversationId: string, messageId: string): boolean; /** 置顶/取消置顶 */ togglePin(id: string): boolean; /** 归档/取消归档 */ toggleArchive(id: string): boolean; /** 添加标签 */ addTag(id: string, tag: string): boolean; /** 设置摘要 */ setSummary(id: string, summary: string): boolean; /** 重命名 */ rename(id: string, title: string): boolean; /** 导出对话 */ exportConversation(id: string, format?: string): string; /** 全局搜索消息 */ searchMessages(keyword: string, limit?: number): Array<{ conversationId: string; conversationTitle: string; message: ConversationMessage; }>; getStatus(): { totalConversations: number; totalMessages: number; pinnedCount: number; archivedCount: number; tagDistribution: Record; }; private load; private save; } //# sourceMappingURL=manager.d.ts.map