(chatKey: string, tag: string)
| 276 | } |
| 277 | |
| 278 | async deleteRepo(chatKey: string, tag: string): Promise<boolean> { |
| 279 | this.ensureReady(); |
| 280 | const main = await this.ensureMainChat(chatKey); |
| 281 | if (!main.repos?.[tag]) return false; |
| 282 | |
| 283 | delete main.repos[tag]; |
| 284 | if (main.currentTag === tag) main.currentTag = ""; |
| 285 | |
| 286 | const key = this.gk(chatKey); |
| 287 | this.dbMain.data!.chats[key] = main; |
| 288 | await this.dbMain.write(); |
| 289 | |
| 290 | const ctx = await this.ensureCtxChat(chatKey); |
| 291 | if (ctx.contextTurns?.[tag]) { |
| 292 | delete ctx.contextTurns[tag]; |
| 293 | this.dbCtx.data!.chats[key] = ctx; |
| 294 | await this.dbCtx.write(); |
| 295 | } |
| 296 | |
| 297 | return true; |
| 298 | } |
| 299 | |
| 300 | async setCurrent(chatKey: string, tag: string): Promise<void> { |
| 301 | this.ensureReady(); |
no test coverage detected