(chatKey: string, tag?: string)
| 319 | } |
| 320 | |
| 321 | async clearContext(chatKey: string, tag?: string): Promise<void> { |
| 322 | this.ensureReady(); |
| 323 | const ctx = await this.ensureCtxChat(chatKey); |
| 324 | ctx.contextTurns ||= {}; |
| 325 | if (tag) { |
| 326 | delete ctx.contextTurns[tag]; |
| 327 | } else { |
| 328 | ctx.contextTurns = {}; |
| 329 | } |
| 330 | |
| 331 | const key = this.gk(chatKey); |
| 332 | this.dbCtx.data!.chats[key] = ctx; |
| 333 | await this.dbCtx.write(); |
| 334 | } |
| 335 | |
| 336 | async appendTurn(chatKey: string, tag: string, q: string, a: string): Promise<void> { |
| 337 | this.ensureReady(); |
no test coverage detected