* 加载对话上下文
(sessionId: string)
| 76 | * 加载对话上下文 |
| 77 | */ |
| 78 | async loadConversation(sessionId: string): Promise<ConversationContext | null> { |
| 79 | try { |
| 80 | const conversationPath = path.join(this.storagePath, 'conversations', `${sessionId}.json`); |
| 81 | const data = await fs.readFile(conversationPath, 'utf-8'); |
| 82 | return JSON.parse(data) as ConversationContext; |
| 83 | } catch (error) { |
| 84 | return null; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * 保存完整上下文数据 |
no outgoing calls
no test coverage detected