nanobot: 2026-09-14 21:16:00 — usage: models only in Models section, not inline

This commit is contained in:
lachtan
2026-09-14 21:11:06 +02:00
parent ea60e0684e
commit 30d27e4b02
2 changed files with 7 additions and 15 deletions

View File

@@ -22,18 +22,20 @@ never scrape the website.
## Output ## Output
Format (script prints it, present it to the user as-is): Format (script prints it, present it to the user as-is — same lines, same
order; translate the labels to Czech, keep the numbers exact; no extra
model info on the Session/Weekly lines):
``` ```
Ollama Cloud usage Ollama Cloud usage
Session: <pct> %, resets in X hours — <model> (<req count>), … Session: <pct> %, resets in X hours
Weekly: <pct> %, resets in Y days — <model> (<req count>), … Weekly: <pct> %, resets in Y days
Models (request count, weekly window): Models (request count, weekly window):
<model>: <count> <model>: <count>
``` ```
Present the script output to the user in Czech (translate the labels, keep The per-model breakdown lives only in the "Models" section — never inline
the numbers exact). on the Session/Weekly lines.
## Reset times — derived, not from the API ## Reset times — derived, not from the API

View File

@@ -28,12 +28,6 @@ def load_api_key() -> str:
sys.exit("OLLAMA_API_KEY not found (neither env nor workspace/.env)") sys.exit("OLLAMA_API_KEY not found (neither env nor workspace/.env)")
def fmt_models(models: list[dict]) -> str:
if not models:
return ""
return ", ".join(f'{m["name"]} ({m["request_count"]})' for m in models)
def until_next_full_hour(now: datetime) -> timedelta: def until_next_full_hour(now: datetime) -> timedelta:
nxt = (now.replace(minute=0, second=0, microsecond=0) nxt = (now.replace(minute=0, second=0, microsecond=0)
+ timedelta(hours=1)) + timedelta(hours=1))
@@ -77,17 +71,13 @@ def main() -> None:
now = datetime.now(timezone.utc) now = datetime.now(timezone.utc)
print("Ollama Cloud usage") print("Ollama Cloud usage")
s_models = fmt_models(session.get("models", []))
print( print(
f'Session: {session.get("usage", 0) * 100:.1f} %, ' f'Session: {session.get("usage", 0) * 100:.1f} %, '
f'resets in {fmt_delta_short(until_next_full_hour(now))}' f'resets in {fmt_delta_short(until_next_full_hour(now))}'
+ (f"{s_models}" if s_models else "")
) )
w_models = fmt_models(weekly.get("models", []))
print( print(
f'Weekly: {weekly.get("usage", 0) * 100:.1f} %, ' f'Weekly: {weekly.get("usage", 0) * 100:.1f} %, '
f'resets in {fmt_delta_short(until_next_monday(now))}' f'resets in {fmt_delta_short(until_next_monday(now))}'
+ (f"{w_models}" if w_models else "")
) )
models = weekly.get("models", []) models = weekly.get("models", [])