MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / appendTurn

Method appendTurn

deepwiki/deepwiki.ts:336–347  ·  view source on GitHub ↗
(chatKey: string, tag: string, q: string, a: string)

Source from the content-addressed store, hash-verified

334 }
335
336 async appendTurn(chatKey: string, tag: string, q: string, a: string): Promise<void> {
337 this.ensureReady();
338 const ctx = await this.ensureCtxChat(chatKey);
339 ctx.contextTurns ||= {};
340 const turns = ctx.contextTurns[tag] || [];
341 turns.push({ q, a, at: new Date().toISOString() });
342 ctx.contextTurns[tag] = turns.slice(-MAX_TURNS_PER_TAG);
343
344 const key = this.gk(chatKey);
345 this.dbCtx.data!.chats[key] = ctx;
346 await this.dbCtx.write();
347 }
348
349 async getTurns(chatKey: string, tag: string): Promise<ContextTurn[]> {
350 this.ensureReady();

Callers 1

DeepWikiPluginClass · 0.80

Calls 4

ensureReadyMethod · 0.95
ensureCtxChatMethod · 0.95
gkMethod · 0.95
writeMethod · 0.80

Tested by

no test coverage detected