fixed token count reading

This commit is contained in:
Storme-bit
2026-04-19 07:59:31 -07:00
parent 0619c4c7f3
commit 7824404319
3 changed files with 7 additions and 0 deletions

View File

@@ -317,6 +317,7 @@ async function chatStream(externalId, userMessage, onChunk, options = {}) {
console.log("[orchestration] final streamed text length:", fullText.length);
if (fullText.trim()) {
console.log('[chat] tokenCount before save:', tokenCount);
await memory.createEpisode(session.id, userMessage, fullText, tokenCount, session.project_id ?? null);
const allEpisodes = await memory.getRecentEpisodes(session.id, 9999);
triggerSummary(session, allEpisodes);