feat(model-manager): flag Early Access models in CivitAI browse

CivitAI Early Access versions require purchased access and otherwise fail
with 401. Surface version `availability` from the API as an `early_access`
flag (per card and per version), show an amber "EARLY ACCESS" tag on the
card, label such entries in the version dropdown, and warn before
attempting to download one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 16:27:33 -04:00
parent 6871a6d460
commit 505f212c4d
4 changed files with 45 additions and 6 deletions
+13 -1
View File
@@ -176,6 +176,12 @@ def _pick_thumbnail(version: dict) -> Optional[dict]:
return None
def _is_early_access(version: dict) -> bool:
"""A version is early-access (download requires purchase/login) when its
availability is anything other than Public."""
return (version.get("availability") or "Public") != "Public"
def _to_card(item: dict) -> dict:
versions = item.get("modelVersions") or []
v0 = versions[0] if versions else {}
@@ -192,8 +198,14 @@ def _to_card(item: dict) -> dict:
"thumbnail": thumb.get("url") if thumb else None,
"thumbnail_type": thumb.get("type") if thumb else None,
"primary_version_id": v0.get("id"),
"early_access": _is_early_access(v0),
"versions": [
{"id": v.get("id"), "name": v.get("name")} for v in versions
{
"id": v.get("id"),
"name": v.get("name"),
"early_access": _is_early_access(v),
}
for v in versions
],
}