Refresh the look and layout of the model-usage plugin
This commit is contained in:
@@ -71,6 +71,7 @@ today_tokens_by_model = {}
|
||||
model_usage = {}
|
||||
sessions_by_day = {day: set() for day in recent_dates}
|
||||
today_sessions = set()
|
||||
active_days = set()
|
||||
|
||||
today_prompts = 0
|
||||
today_total_tokens = 0
|
||||
@@ -86,6 +87,7 @@ def add_usage(day, session_key, model, input_tokens, output_tokens, cache_read,
|
||||
total = input_tokens + output_tokens + cache_read + cache_write
|
||||
total_prompts += 1
|
||||
total_sessions.add(session_key)
|
||||
active_days.add(day)
|
||||
|
||||
bucket = model_usage.setdefault(model, {
|
||||
"inputTokens": 0,
|
||||
@@ -336,6 +338,11 @@ out = {
|
||||
"recentDays": [recent[day] for day in recent_dates],
|
||||
"totalPrompts": total_prompts,
|
||||
"totalSessions": len(total_sessions),
|
||||
# Days with any recorded usage, for the all-time "N days" summary.
|
||||
# The dates travel too: merging snapshots from several machines needs
|
||||
# their union, which a count alone cannot give.
|
||||
"activeDays": len(active_days),
|
||||
"activeDates": sorted(active_days),
|
||||
"modelUsage": model_usage,
|
||||
"usageStatusText": usage_status,
|
||||
"authHelpText": usage_help,
|
||||
|
||||
Reference in New Issue
Block a user