mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-10 21:23:39 +00:00
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.
This commit is contained in:
parent
61dd5ac13a
commit
66409784f4
@ -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)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user