feat: improve token counter display (#439)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-31 16:17:07 -08:00
committed by GitHub
parent f1fb38227d
commit 48089ef71f
2 changed files with 4 additions and 2 deletions

View File

@@ -395,6 +395,8 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) {
argsText: (line.argsText || "") + argsText,
};
b.byId.set(id, updatedLine);
// Count tool call arguments as LLM output tokens
b.tokenCount += argsText.length;
}
break;
}

View File

@@ -20,7 +20,7 @@ export const INTERRUPTED_BY_USER = "Interrupted by user";
/**
* Status bar thresholds - only show indicators when values exceed these
*/
// Show token count after 1000 estimated tokens
export const TOKEN_DISPLAY_THRESHOLD = 1000;
// Show token count after 100 estimated tokens (shows exact count until 1k, then compact)
export const TOKEN_DISPLAY_THRESHOLD = 100;
// Show elapsed time after 2 minutes (in ms)
export const ELAPSED_DISPLAY_THRESHOLD_MS = 2 * 60 * 1000;