mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
2cbd55b8bd
- Agent: pass the open email reader (uid/folder/account/from/subject/body
preview) on every chat submit so 'reply to this' / 'write email saying
hi' route to ui_control open_email_reply with the right UID instead of
inventing a new .md draft. Code-level enforcement (chat_routes strips
create_document + send_email when active_email is set); cross-session
active_doc_id is now trusted instead of being silently dropped.
set_active_email/clear_active_email tool-layer helpers in
tool_implementations.
- ui_control open_email_reply: optional body argument so the agent can
open-and-write in one call; envelope now forwards uid/folder/account/
body/panel through tool_output. Tool description sharpened and the
parser rejects empty bodies on reply/reply-all (forces the agent to
write rather than open an empty draft).
- Email library: search now runs against [Gmail]/All Mail when the
current folder is INBOX (archived emails surface). Whirlpool spinner
+ 'Searching…' placeholder while in flight. Each search result is
stamped with its source folder so clicks open the right email instead
of whatever shares its UID in INBOX. Search no longer re-applies the
same text pill locally (which only checks subject/from/snippet, never
body) so body-only matches don't get dropped after IMAP returns them.
Initial inbox load bumped 100→500.
- Email favorites: 'Favorite (pin to top)' / 'Unfavorite' in both the
card menu and the open-reader more menu, backed by a new
/api/email/flag/{uid}?on=true|false endpoint. Flagged emails always
bubble to the top of the grid regardless of active sort.
- AI reply in doc editor: never overwrites existing draft text or the
quoted history. AI suggestion is prepended; AI-generated 'On …
wrote:' re-quotes are stripped so the original quote isn't visually
edited.
- Cookbook serve: pre-launch GPU driver / has_gpu / install / version-
floor checks (vllm minimax_m2 needs 0.10.0+, deepseek_r1 needs 0.7.0
etc.) before the launch chain starts. Detect 'another model already
running on this host' and offer Stop & launch (with graceful then
force tmux kill helpers, port release wait). Per-vendor deep-link
buttons (vLLM recipe / SGLang cookbook) with hardware hash. Backend
picker is now a custom dropdown with accent-coloured logos for vLLM,
SGLang, llama.cpp, Ollama, Diffusers; same glyphs added next to
package names in Dependencies. Runtime-readiness note moved inside
the panel (green when ready, red when missing) with an × dismiss.
Esc collapses the expanded card; expanded card scrolls when it
overflows; Trust Remote / Auto Tool / Reasoning Parser / Enforce
Eager / Prefix Caching / Expert Parallel / Speculative / MoE Env on
one row (Reasoning Parser auto-detected per model family).
Dtype→Row 1, GPUs→Row 2 (rightmost). Removed redundant GPU 'auto'
input — command builders read from the GPU button strip. Default
cookbook open is Download tab.
- Cookbook hwfit: 'Model (latest)' / 'Model (oldest)' header sorts by
release_date; release dates can be backfilled with the new
scripts/backfill_model_release_dates.py and recipe metadata pulled
with scripts/import_from_vllm_recipes.py against the upstream
vllm-project/recipes catalog (vllm_recipe + min_vllm_version stamped
on entries).
- Calendar: Quick add hint cycles a random Odysseus-themed example per
open (wooden horse Friday, crew muster 10am daily, council on
Ithaca, …). Typing a time like '11pm' in the event title updates
the hero clock live.
- Doc editor: email-mode Reply button (sparkle icon, accent) opens the
same Fast/Full + context popover the email reader uses; Ctrl+Alt+M
toggles markdown preview.
- Memories panel: custom sort picker with per-option icons, default
'Latest', visible Enabled/Disabled toggle text matching the section
description style.
134 lines
4.7 KiB
Python
Executable File
134 lines
4.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Backfill release_date on entries in services/hwfit/data/hf_models.json.
|
|
|
|
Why: the `newest` sort in the cookbook ranks rows by release_date. Anything
|
|
missing a date sorts to the bottom. This script pulls `created_at` from the
|
|
HuggingFace API for each catalog entry without one (or all entries when
|
|
--refresh is passed) and writes the catalog back.
|
|
|
|
Usage:
|
|
python scripts/backfill_model_release_dates.py # missing only
|
|
python scripts/backfill_model_release_dates.py --refresh # all entries
|
|
python scripts/backfill_model_release_dates.py --limit 50 # cap requests
|
|
python scripts/backfill_model_release_dates.py --dry-run # show, don't write
|
|
|
|
Auth: set HF_TOKEN env var (or huggingface-cli login) to access gated repos.
|
|
"""
|
|
import argparse
|
|
import json
|
|
import os
|
|
import sys
|
|
import time
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
|
|
try:
|
|
from huggingface_hub import HfApi
|
|
from huggingface_hub.utils import HfHubHTTPError
|
|
except ImportError:
|
|
print("Install huggingface_hub: pip install huggingface_hub", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
|
|
CATALOG_PATH = Path(__file__).resolve().parent.parent / "services" / "hwfit" / "data" / "hf_models.json"
|
|
|
|
|
|
def fetch_release_date(api: HfApi, repo_id: str) -> str | None:
|
|
"""Return YYYY-MM-DD release date, or None on miss / error."""
|
|
try:
|
|
info = api.model_info(repo_id, files_metadata=False)
|
|
except HfHubHTTPError as e:
|
|
# 401 = gated/private, 404 = renamed/deleted. Either way, no date.
|
|
status = getattr(getattr(e, "response", None), "status_code", None)
|
|
print(f" {repo_id}: HTTP {status or '?'}", file=sys.stderr)
|
|
return None
|
|
except Exception as e:
|
|
print(f" {repo_id}: {type(e).__name__}: {e}", file=sys.stderr)
|
|
return None
|
|
created = getattr(info, "created_at", None)
|
|
if not created:
|
|
return None
|
|
return created.strftime("%Y-%m-%d")
|
|
|
|
|
|
def main():
|
|
p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
p.add_argument("--refresh", action="store_true", help="Overwrite existing release_date too (default: only fill missing).")
|
|
p.add_argument("--limit", type=int, default=0, help="Stop after N API calls (0 = no limit).")
|
|
p.add_argument("--dry-run", action="store_true", help="Don't write back; just report.")
|
|
p.add_argument("--sleep", type=float, default=0.05, help="Seconds to sleep between requests (default 0.05).")
|
|
args = p.parse_args()
|
|
|
|
if not CATALOG_PATH.exists():
|
|
print(f"Catalog not found: {CATALOG_PATH}", file=sys.stderr)
|
|
sys.exit(2)
|
|
|
|
with CATALOG_PATH.open(encoding="utf-8") as f:
|
|
catalog = json.load(f)
|
|
|
|
candidates = []
|
|
for i, m in enumerate(catalog):
|
|
name = m.get("name")
|
|
if not name:
|
|
continue
|
|
existing = (m.get("release_date") or "").strip()
|
|
if existing and not args.refresh:
|
|
continue
|
|
candidates.append(i)
|
|
|
|
if args.limit:
|
|
candidates = candidates[: args.limit]
|
|
|
|
print(f"Catalog: {CATALOG_PATH}")
|
|
print(f"Total entries: {len(catalog)}")
|
|
print(f"Targets ({'refresh all' if args.refresh else 'missing only'}{'' if not args.limit else f', capped at {args.limit}'}): {len(candidates)}")
|
|
if not candidates:
|
|
print("Nothing to do.")
|
|
return
|
|
|
|
api = HfApi(token=os.environ.get("HF_TOKEN") or None)
|
|
updated = 0
|
|
skipped = 0
|
|
started = time.time()
|
|
for n, idx in enumerate(candidates, start=1):
|
|
entry = catalog[idx]
|
|
name = entry["name"]
|
|
old = (entry.get("release_date") or "").strip()
|
|
new = fetch_release_date(api, name)
|
|
if new is None:
|
|
skipped += 1
|
|
tag = "skip"
|
|
elif new == old:
|
|
tag = "unchanged"
|
|
else:
|
|
entry["release_date"] = new
|
|
updated += 1
|
|
tag = f"set {new}" + (f" (was {old})" if old else "")
|
|
print(f"[{n}/{len(candidates)}] {name} — {tag}")
|
|
if args.sleep:
|
|
time.sleep(args.sleep)
|
|
|
|
elapsed = time.time() - started
|
|
print()
|
|
print(f"Done in {elapsed:.1f}s — {updated} updated, {skipped} skipped (HF unavailable / gated / missing date).")
|
|
|
|
if args.dry_run:
|
|
print("Dry run — no write.")
|
|
return
|
|
|
|
if updated:
|
|
# Atomic write: tmp file in the same dir, then rename. Keeps the
|
|
# catalog usable even if the process dies mid-write.
|
|
tmp = CATALOG_PATH.with_suffix(".json.tmp")
|
|
with tmp.open("w", encoding="utf-8") as f:
|
|
json.dump(catalog, f, indent=1, ensure_ascii=False)
|
|
f.write("\n")
|
|
tmp.replace(CATALOG_PATH)
|
|
print(f"Wrote {CATALOG_PATH}")
|
|
else:
|
|
print("No changes to write.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|