* 初始化存储目录
()
| 18 | * 初始化存储目录 |
| 19 | */ |
| 20 | async initialize(): Promise<void> { |
| 21 | try { |
| 22 | await fs.mkdir(this.storagePath, { recursive: true }); |
| 23 | await fs.mkdir(path.join(this.storagePath, 'sessions'), { recursive: true }); |
| 24 | await fs.mkdir(path.join(this.storagePath, 'conversations'), { recursive: true }); |
| 25 | } catch (error) { |
| 26 | console.warn('警告:无法创建持久化存储目录:', error); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * 保存会话上下文 |