nanobot: 2026-09-14 21:12:30 — usage: skill + script fully English

This commit is contained in:
lachtan
2026-09-14 21:08:14 +02:00
parent a45e5434f4
commit 35e1e4efdc
2 changed files with 40 additions and 29 deletions

View File

@@ -25,7 +25,7 @@ def load_api_key() -> str:
line = line.strip()
if line.startswith("OLLAMA_API_KEY="):
return line.split("=", 1)[1].strip().strip('"').strip("'")
sys.exit("OLLAMA_API_KEY nenalezen (ani env, ani workspace/.env)")
sys.exit("OLLAMA_API_KEY not found (neither env nor workspace/.env)")
def fmt_models(models: list[dict]) -> str:
@@ -54,8 +54,8 @@ def fmt_delta_short(td: timedelta) -> str:
if total >= 86400:
return f"{int(total // 86400)} days"
if total >= 3600:
return f"{round(total / 3600)} hours"
return f"{max(1, round(total / 60))} minutes"
return f"{round(td.total_seconds() / 3600)} hours"
return f"{max(1, round(td.total_seconds() / 60))} minutes"
def main() -> None:
@@ -67,16 +67,16 @@ def main() -> None:
with urllib.request.urlopen(req, timeout=15) as resp:
data = json.load(resp)
except urllib.error.HTTPError as e:
sys.exit(f"ollama.com API chyba: HTTP {e.code}")
sys.exit(f"ollama.com API error: HTTP {e.code}")
except urllib.error.URLError as e:
sys.exit(f"ollama.com nedostupné: {e.reason}")
sys.exit(f"ollama.com unreachable: {e.reason}")
limits = data.get("limits", {})
session = limits.get("session", {})
weekly = limits.get("weekly", {})
now = datetime.now(timezone.utc)
print("Ollama Cloud — spotřeba")
print("Ollama Cloud usage")
s_models = fmt_models(session.get("models", []))
print(
f'Session: {session.get("usage", 0) * 100:.1f} %, '
@@ -92,7 +92,7 @@ def main() -> None:
models = weekly.get("models", [])
if models:
print("Modely (počet požadavků, weekly okno):")
print("Models (request count, weekly window):")
for m in models:
print(f' {m["name"]}: {m["request_count"]}')