From 66409784f4bf70b0ca8aaefb63a8e50f3c24e8c2 Mon Sep 17 00:00:00 2001 From: Leo fu Date: Wed, 8 Apr 2026 12:54:17 -0400 Subject: [PATCH] fix(status): use consistent divisor (1000) for token count display The /status command divided context_used by 1000 but context_total by 1024, producing inconsistent values. For example a 128000-token window displayed as 125k instead of 128k. Tokens are not a binary unit, so both should use 1000. --- nanobot/utils/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.py index 7267bac2a..9c2f48960 100644 --- a/nanobot/utils/helpers.py +++ b/nanobot/utils/helpers.py @@ -417,7 +417,7 @@ def build_status_content( ctx_total = max(context_window_tokens, 0) ctx_pct = int((context_tokens_estimate / ctx_total) * 100) if ctx_total > 0 else 0 ctx_used_str = f"{context_tokens_estimate // 1000}k" if context_tokens_estimate >= 1000 else str(context_tokens_estimate) - ctx_total_str = f"{ctx_total // 1024}k" if ctx_total > 0 else "n/a" + ctx_total_str = f"{ctx_total // 1000}k" if ctx_total > 0 else "n/a" token_line = f"\U0001f4ca Tokens: {last_in} in / {last_out} out" if cached and last_in: token_line += f" ({cached * 100 // last_in}% cached)"