refactor: Use 1024 instead of 1000 for token budget formatting

This commit is contained in:
Paul Gauthier (aider) 2025-03-11 11:38:11 -07:00
parent 67ebb2566d
commit 935227f7e7

View file

@ -220,14 +220,14 @@ class Coder:
):
budget = main_model.extra_params["thinking"]["budget_tokens"]
# Format as xx.yK for thousands, xx.yM for millions
if budget >= 1000000:
value = budget / 1000000
if budget >= 1024 * 1024:
value = budget / (1024 * 1024)
if value == int(value):
formatted_budget = f"{int(value)}M"
else:
formatted_budget = f"{value:.1f}M"
else:
value = budget / 1000
value = budget / 1024
if value == int(value):
formatted_budget = f"{int(value)}k"
else: