mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
feat: Add percentage column to model token usage summary
This commit is contained in:
parent
2d5f613984
commit
66e5e9c1ce
1 changed files with 10 additions and 6 deletions
|
@ -30,14 +30,18 @@ with open(analytics_path) as f:
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Calculate total for percentages
|
||||||
|
total_tokens = sum(model_stats.values())
|
||||||
|
|
||||||
# Print results
|
# Print results
|
||||||
print("\nModel Token Usage Summary:")
|
print("\nModel Token Usage Summary:")
|
||||||
print("-" * 60)
|
print("-" * 80)
|
||||||
print(f"{'Model Name':<40} {'Total Tokens':>15}")
|
print(f"{'Model Name':<40} {'Total Tokens':>15} {'Percent':>10}")
|
||||||
print("-" * 60)
|
print("-" * 80)
|
||||||
|
|
||||||
for model, tokens in sorted(model_stats.items(), key=lambda x: x[1], reverse=True):
|
for model, tokens in sorted(model_stats.items(), key=lambda x: x[1], reverse=True):
|
||||||
print(f"{model:<40} {tokens:>15,}")
|
percentage = (tokens / total_tokens) * 100 if total_tokens > 0 else 0
|
||||||
|
print(f"{model:<40} {tokens:>15,} {percentage:>9.1f}%")
|
||||||
|
|
||||||
print("-" * 60)
|
print("-" * 80)
|
||||||
print(f"{'TOTAL':<40} {sum(model_stats.values()):>15,}")
|
print(f"{'TOTAL':<40} {total_tokens:>15,} {100:>9.1f}%")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue