Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
release(v4.10.2): Playtime-AI on Hugging Face as a second LoRA source — the H3 character LoRAs, with their example clips
mrbizarro66c5a99a5253
diff --git a/docs/API.md b/docs/API.mdindex b85ae5f..f8d47e9 100644--- a/docs/API.md+++ b/docs/API.md@@ -249,6 +249,20 @@ Callers should surface `weak` **before** a render is spent finding out, and shou`GET /train/list` carries the same verdict plus **`adapter_advice`** — one sentence naming what to do about it, empty when the verdict is `ok` or `unknown`. It is hardware-aware: on a sub-64 GB Mac it does **not** say "train again on High", because that machine cannot reach the graded recipe (see the profile section below). The panel's Train tab renders it as a banner above the trained-character chips and in the finished job's history row; a verdict a user cannot act on is a measurement, not an answer (#62).+### `GET /hf/loras`++A Hugging Face org's LoRAs as a browsable source beside CivitAI. `?source=playtime&lane=h3|ltx&q=<name filter>&refresh=1`.+The org's repos are listed through the public HF API, kept by lane from the repo name (`Minimax_H3-…` → h3, `LTX-2.3-…` → ltx),+and each repo's largest `.safetensors` plus its example clip become one item in the same shape the CivitAI grid renders+(`name`, `creator`, `likes`, `size_kb`, `preview_url` / `preview_type`, `download_url`, `filename`, `base_model`, `hf_url`, `source: "huggingface"`).+Cached ten minutes. Sources: `playtime` (Playtime-AI).++### `POST /hf/loras/download`++Form `repo`, `filename`, `meta` (the item JSON). Downloads through `huggingface_hub` (the saved HF token when present)+into the lane's LoRA directory, runs the H3 layout probe, and writes the same sidecar a CivitAI install writes plus+`source`, `hf_repo`, `hf_url`. Returns `{ ok, skipped, name, path, sidecar_path, lane, layout, converted }`.+### `GET /loras/updates`Asks CivitAI whether any installed LoRA with a `civitai_id` in its sidecar has adiff --git a/docs/STATE.md b/docs/STATE.mdindex 69c4f80..7a99800 100644--- a/docs/STATE.md+++ b/docs/STATE.md@@ -44,6 +44,15 @@> per part and the runner retakes a drifting part once (lock doubled, seed> +101), keeping the steadier clip and hiding the other; the planner brief> states the light once and forbids a beat that implies another hour.+> **Same day, a second LoRA source.** The LoRA browser has a source row:+> CivitAI, or **Playtime-AI · Hugging Face** — the org that carries the H3+> character LoRAs CivitAI no longer does, one repo each with the weights and+> an example clip. `hf_lora_catalog` lists the org through the public API,+> keeps a lane by repo name, and each card plays the author's own clip;+> Install goes through `_hf_lora_download` into the lane's directory with+> the same sidecar and layout probe as a CivitAI install. 22 H3 characters+> at the time of writing. `test_hf_loras` pins lane detection, names, the+> catalog shape and the install.> **🎬 2026-09-05 — Editor v2 on dev/beta, UNRELEASED: speed, titles, transitions, the Director, sliding windows.**> From the long-form editing brief (the measured gaps only, built our way).diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex 9cf4e0c..65391c7 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -6572,6 +6572,155 @@ def _civitai_search(query: str = "", nsfw: bool = False,}+# ---------------------------------------------------------------------------+# HUGGING FACE LoRA SOURCES — an org's repos as a browsable catalog+# ---------------------------------------------------------------------------+# CivitAI no longer carries the character LoRAs people want for H3; the+# Playtime-AI org on Hugging Face does, one repo per LoRA with the weights, an+# example clip and a two-line card. This lists an org's repos through the+# public HF API, keeps the ones for a lane by name, and installs one the way+# a CivitAI download does — same directory, same sidecar, same layout probe —+# so the picker cannot tell where it came from.+HF_LORA_SOURCES: dict[str, dict] = {+ "playtime": {"author": "Playtime-AI", "label": "Playtime-AI · Hugging Face",+ "url": "https://huggingface.co/Playtime-AI"},+}+HF_LORA_CATALOG_TTL = 600+_hf_lora_catalog_cache: dict[str, tuple[float, list]] = {}+_HF_H3_RE = re.compile(r"minima[xc][_ -]?h3", re.I)+_HF_LTX_RE = re.compile(r"ltx[_ -]?2\.?[35]", re.I)+++def hf_lora_lane_of_repo(repo_id: str) -> str | None:+ """Which lane a repo's LoRA is for, from its name: 'h3', 'ltx', or None+ (an image LoRA, a showcase repo — not ours to list)."""+ tail = (repo_id or "").split("/")[-1]+ if _HF_H3_RE.search(tail):+ return "h3"+ if _HF_LTX_RE.search(tail):+ return "ltx"+ return None+++def hf_lora_pretty_name(repo_id: str) -> str:+ tail = (repo_id or "").split("/")[-1]+ tail = re.sub(r"^(minima[xc][_ -]?h3|ltx[_ -]?2\.?[35])([_ -]?(dev(_and_sulphur)?|sulphur))?[_ -]*", "", tail, flags=re.I)+ return tail.replace("_", " ").replace("-", " — ").strip() or repo_id+++def _hf_api_get(path: str, timeout: float = 20.0) -> object:+ import urllib.request as _ur+ req = _ur.Request("https://huggingface.co" + path, headers={"Accept": "application/json",+ "User-Agent": "Phosphene"})+ tok = _active_hf_token()+ if tok:+ req.add_header("Authorization", f"Bearer {tok}")+ with _ur.urlopen(req, timeout=timeout) as resp:+ return json.loads(resp.read().decode("utf-8", "replace"))+++def hf_lora_catalog(source: str = "playtime", lane: str = "h3", force: bool = False) -> list[dict]:+ """Every LoRA the org publishes for `lane`, in the shape the CivitAI grid+ already renders. Cached ten minutes; the per-repo file listings are+ fetched in parallel."""+ src = HF_LORA_SOURCES.get(source) or HF_LORA_SOURCES["playtime"]+ key = f"{source}:{lane}"+ now = time.time()+ hit = _hf_lora_catalog_cache.get(key)+ if hit and not force and now - hit[0] < HF_LORA_CATALOG_TTL:+ return hit[1]+ repos = _hf_api_get(f"/api/models?author={urllib.parse.quote(src['author'])}&limit=200&sort=lastModified&direction=-1")+ wanted = [m for m in (repos or []) if isinstance(m, dict) and hf_lora_lane_of_repo(m.get("id", "")) == lane]+ import concurrent.futures as _cf+ def one(m):+ rid = m["id"]+ try:+ info = _hf_api_get(f"/api/models/{rid}?blobs=true")+ except Exception: # noqa: BLE001+ return None+ sib = info.get("siblings") or []+ weights = [s for s in sib if str(s.get("rfilename", "")).lower().endswith(".safetensors")]+ if not weights:+ return None+ w = max(weights, key=lambda s: int(s.get("size") or 0))+ prev = next((s for s in sib if str(s.get("rfilename", "")).lower().endswith((".mp4", ".webm", ".mov"))), None)+ if prev is None:+ prev = next((s for s in sib if str(s.get("rfilename", "")).lower().endswith((".png", ".jpg", ".jpeg", ".webp", ".gif"))), None)+ base = "https://huggingface.co/" + rid + "/resolve/main/"+ return {+ "id": rid, "source": "huggingface", "name": hf_lora_pretty_name(rid),+ "creator": src["author"], "likes": int(m.get("likes") or 0),+ "downloads": int(m.get("downloads") or 0),+ "updated": str(m.get("lastModified") or "")[:10],+ "size_kb": int(int(w.get("size") or 0) / 1024),+ "filename": w["rfilename"],+ "download_url": base + urllib.parse.quote(w["rfilename"]),+ "preview_url": (base + urllib.parse.quote(prev["rfilename"])) if prev else None,+ "preview_type": ("video" if prev and str(prev["rfilename"]).lower().endswith((".mp4", ".webm", ".mov")) else ("image" if prev else None)),+ "base_model": "MiniMax H3" if lane == "h3" else "LTXV 2.3",+ "lane": lane, "hf_url": "https://huggingface.co/" + rid, "civitai_url": None,+ "trigger_words": [], "description": "", "nsfw": False,+ }+ items: list[dict] = []+ with _cf.ThreadPoolExecutor(max_workers=8) as ex:+ for it in ex.map(one, wanted):+ if it:+ items.append(it)+ items.sort(key=lambda x: (-x["likes"], x["updated"]), reverse=False)+ items.sort(key=lambda x: x["likes"], reverse=True)+ _hf_lora_catalog_cache[key] = (now, items)+ return items+++def _hf_lora_download(repo_id: str, filename: str, meta: dict) -> dict:+ """Install one LoRA from a Hugging Face repo into its lane's directory,+ with the same sidecar and layout probe a CivitAI install gets."""+ from huggingface_hub import hf_hub_download # noqa: PLC0415+ lane = (meta.get("lane") or hf_lora_lane_of_repo(repo_id) or "ltx")+ loras_dir = _safe_h3_loras_dir() if lane == "h3" else _safe_loras_dir()+ safe_fname = re.sub(r"[^A-Za-z0-9._-]+", "_", Path(filename).name).strip("_")+ if not safe_fname.lower().endswith(".safetensors"):+ safe_fname += ".safetensors"+ target = loras_dir / safe_fname+ if target.is_file() and target.stat().st_size > 1024:+ return {"ok": True, "skipped": True, "name": meta.get("name") or target.stem,+ "path": str(target), "lane": lane, "converted": False}+ push(f"[huggingface] downloading {meta.get('name') or safe_fname} from {repo_id}")+ stage = STATE_DIR / "hf_lora_stage"+ stage.mkdir(parents=True, exist_ok=True)+ got = hf_hub_download(repo_id=repo_id, filename=filename, token=_active_hf_token() or None,+ local_dir=str(stage / re.sub(r"[^A-Za-z0-9._-]+", "_", repo_id)))+ loras_dir.mkdir(parents=True, exist_ok=True)+ shutil.move(got, target)+ layout_info = {"layout": None, "converted": False, "prefix": ""}+ if lane == "h3":+ try:+ layout_info = _h3_lora_prepare(target)+ except Exception as exc: # noqa: BLE001+ push(f"[huggingface] layout probe failed: {exc}")+ sidecar = target.with_suffix(".json")+ data = {+ "name": meta.get("name") or target.stem, "description": meta.get("description") or "",+ "trigger_words": list(meta.get("trigger_words") or []),+ "recommended_strength": float(meta.get("recommended_strength") or 1.0),+ "preview_url": meta.get("preview_url"), "preview_type": meta.get("preview_type"),+ "base_model": meta.get("base_model") or ("MiniMax H3" if lane == "h3" else "LTXV 2.3"),+ "source": "huggingface", "hf_repo": repo_id,+ "hf_url": meta.get("hf_url") or ("https://huggingface.co/" + repo_id),+ "downloaded_at": iso_now(),+ "lora_layout": layout_info.get("layout"),+ "lora_converted_prefix": (layout_info.get("prefix") or None) if layout_info.get("converted") else None,+ }+ try:+ atomic_write_text(sidecar, json.dumps(data, indent=2))+ except Exception as exc: # noqa: BLE001+ push(f"[huggingface] WARN: could not write sidecar ({exc})")+ push(f"[huggingface] installed → {target.name}")+ return {"ok": True, "skipped": False, "name": data["name"], "path": str(target),+ "sidecar_path": str(sidecar), "size_bytes": target.stat().st_size, "lane": lane,+ "layout": layout_info.get("layout"), "converted": bool(layout_info.get("converted"))}++def _civitai_download(download_url: str, meta: dict) -> dict:"""Download a CivitAI .safetensors into the right LoRA dir for its basemodel and write a sidecar JSON. Returnsdiff --git a/panel/routes_loras.py b/panel/routes_loras.pyindex 91c27da..ca2f006 100644--- a/panel/routes_loras.py+++ b/panel/routes_loras.py@@ -507,6 +507,52 @@ def post_loras_rename(h, path, qs, ctype) -> None:h._json({"ok": False, "error": str(exc)}, 400)+@get("/hf/loras")+def get_hf_loras(h, parsed) -> None:+ """A Hugging Face org's LoRAs for one lane, in the CivitAI grid's shape.+ `?source=playtime&lane=h3|ltx&q=<name filter>&refresh=1`."""+ qs = P.parse_qs(parsed.query)+ source = (qs.get("source", ["playtime"])[0] or "playtime").strip().lower()+ lane = (qs.get("lane", ["h3"])[0] or "h3").strip().lower()+ q = (qs.get("q", [""])[0] or "").strip().lower()+ if source not in P.HF_LORA_SOURCES or lane not in ("h3", "ltx"):+ h._json({"ok": False, "error": "unknown source or lane", "items": []}, 400)+ return+ try:+ items = P.hf_lora_catalog(source, lane, force=qs.get("refresh", ["0"])[0] == "1")+ except Exception as exc: # noqa: BLE001+ h._json({"ok": False, "error": f"Hugging Face could not be reached: {exc}", "items": []}, 502)+ return+ if q:+ items = [i for i in items if q in i["name"].lower() or q in i["id"].lower()]+ src = P.HF_LORA_SOURCES[source]+ h._json({"ok": True, "source": source, "label": src["label"], "url": src["url"],+ "lane": lane, "items": items, "has_more": False})+++@post("/hf/loras/download")+def post_hf_loras_download(h, path, qs, ctype) -> None:+ _rb = h._read_form_body()+ if _rb is None:+ return+ body, form = _rb+ def f(k):+ v = form.get(k, "")+ return (v[0] if isinstance(v, list) and v else (v if isinstance(v, str) else "")) or ""+ repo, filename = f("repo").strip(), f("filename").strip()+ try:+ meta = P.json.loads(f("meta") or "{}")+ except P.json.JSONDecodeError:+ meta = {}+ if not repo or "/" not in repo or not filename:+ h._json({"ok": False, "error": "repo and filename are required"}, 400)+ return+ try:+ h._json(P._hf_lora_download(repo, filename, meta if isinstance(meta, dict) else {}))+ except Exception as exc: # noqa: BLE001+ h._json({"ok": False, "error": str(exc)}, 400)++@post("/civitai/download")def post_civitai_download(h, path, qs, ctype) -> None:P._analytics_feature("civitai_download")diff --git a/test_hf_loras.py b/test_hf_loras.pynew file mode 100644index 0000000..18a86fa--- /dev/null+++ b/test_hf_loras.py@@ -0,0 +1,73 @@+"""A Hugging Face org as a LoRA source: lane from the repo name, the pretty+name, the catalog from the API (mocked), and the install with its sidecar."""+import json+from pathlib import Path++import mlx_ltx_panel as p+++def test_lane_from_repo_name():+ assert p.hf_lora_lane_of_repo("Playtime-AI/Minimax_H3-Sydney_Sweeney") == "h3"+ assert p.hf_lora_lane_of_repo("Playtime-AI/Minimac_H3-Ana_de_Armas") == "h3" # the org's typo+ assert p.hf_lora_lane_of_repo("Playtime-AI/LTX-2.3-Ted") == "ltx"+ assert p.hf_lora_lane_of_repo("Playtime-AI/Krea_2-Emma_Watson") is None+++def test_pretty_names():+ assert p.hf_lora_pretty_name("Playtime-AI/Minimax_H3-The_Dude-Jeff_Bridges") == "The Dude — Jeff Bridges"+ assert p.hf_lora_pretty_name("Playtime-AI/LTX-2.3-DEV_AND_SULPHUR-Sofia_Vergara") == "Sofia Vergara"+ assert p.hf_lora_pretty_name("Playtime-AI/Minimax_H3-Megan_Fox") == "Megan Fox"+++def test_catalog_lists_the_lane_with_previews(monkeypatch):+ def fake_get(path, timeout=20.0):+ if path.startswith("/api/models?author="):+ return [{"id": "Playtime-AI/Minimax_H3-Megan_Fox", "likes": 37, "downloads": 0, "lastModified": "2026-08-29T00:00:00"},+ {"id": "Playtime-AI/LTX-2.3-Ted", "likes": 7},+ {"id": "Playtime-AI/Krea_2-Emma_Watson", "likes": 6},+ {"id": "Playtime-AI/Minimax-H3_Showcase", "likes": 5}]+ if "Megan_Fox" in path:+ return {"siblings": [{"rfilename": "MM-H3 - Megan Fox.safetensors", "size": 155000000},+ {"rfilename": "example.mp4", "size": 20000000}, {"rfilename": "README.md", "size": 200}]}+ if "Showcase" in path:+ return {"siblings": [{"rfilename": "a.mp4", "size": 1}]}+ return {"siblings": []}+ monkeypatch.setattr(p, "_hf_api_get", fake_get)+ p._hf_lora_catalog_cache.clear()+ items = p.hf_lora_catalog("playtime", "h3", force=True)+ assert [i["name"] for i in items] == ["Megan Fox"] # showcase has no weights; LTX/Krea are other lanes+ it = items[0]+ assert it["source"] == "huggingface" and it["lane"] == "h3" and it["base_model"] == "MiniMax H3"+ assert it["download_url"].endswith("/resolve/main/MM-H3%20-%20Megan%20Fox.safetensors")+ assert it["preview_url"].endswith("/resolve/main/example.mp4") and it["preview_type"] == "video"+ assert it["size_kb"] == 155000000 // 1024 and it["hf_url"] == "https://huggingface.co/Playtime-AI/Minimax_H3-Megan_Fox"+++def test_download_lands_in_the_lane_with_a_sidecar(tmp_path, monkeypatch):+ h3dir = tmp_path / "h3loras"; h3dir.mkdir()+ monkeypatch.setattr(p, "_safe_h3_loras_dir", lambda: h3dir)+ monkeypatch.setattr(p, "STATE_DIR", tmp_path / "state")+ monkeypatch.setattr(p, "_h3_lora_prepare", lambda t: {"layout": "bare", "converted": False, "prefix": ""})+ import huggingface_hub+ def fake_dl(repo_id, filename, token=None, local_dir=None):+ d = Path(local_dir); d.mkdir(parents=True, exist_ok=True)+ f = d / filename; f.write_bytes(b"0" * 4096); return str(f)+ monkeypatch.setattr(huggingface_hub, "hf_hub_download", fake_dl)+ meta = {"name": "Megan Fox", "lane": "h3", "preview_url": "https://huggingface.co/x/resolve/main/example.mp4",+ "preview_type": "video", "base_model": "MiniMax H3", "hf_url": "https://huggingface.co/Playtime-AI/Minimax_H3-Megan_Fox"}+ r = p._hf_lora_download("Playtime-AI/Minimax_H3-Megan_Fox", "MM-H3 - Megan Fox.safetensors", meta)+ assert r["ok"] and r["lane"] == "h3" and Path(r["path"]).parent == h3dir+ assert Path(r["path"]).name == "MM-H3_-_Megan_Fox.safetensors"+ side = json.loads(Path(r["sidecar_path"]).read_text())+ assert side["name"] == "Megan Fox" and side["source"] == "huggingface"+ assert side["hf_repo"] == "Playtime-AI/Minimax_H3-Megan_Fox" and side["preview_type"] == "video"+ assert side["base_model"] == "MiniMax H3" and side["lora_layout"] == "bare"+ # a second install of the same file is a skip, not a re-download+ r2 = p._hf_lora_download("Playtime-AI/Minimax_H3-Megan_Fox", "MM-H3 - Megan Fox.safetensors", meta)+ assert r2["skipped"] is True+++def test_routes_registered():+ from panel import routes_loras # noqa: F401+ from panel.routes import GET_ROUTES, POST_ROUTES+ assert "/hf/loras" in GET_ROUTES and "/hf/loras/download" in POST_ROUTESdiff --git a/webapp/index.html b/webapp/index.htmlindex 1a1660b..db15420 100644--- a/webapp/index.html+++ b/webapp/index.html@@ -4185,6 +4185,13 @@<div class="civitai-family-row" id="civitaiFamilyRow" style="display:none;margin: 4px 0 8px; display:flex; gap:6px; flex-wrap:wrap;"></div>+ <!-- WHERE THE LoRAs COME FROM. CivitAI, or an org on Hugging Face that+ publishes character LoRAs with example clips (Playtime-AI carries the+ H3 characters CivitAI no longer does). Video context only. -->+ <div class="civitai-family-row" id="civitaiSourceRow" style="display:none; margin: 4px 0 8px; gap:6px; flex-wrap:wrap;">+ <button type="button" class="pill-btn active" data-civitai-source="civitai" onclick="civitaiSetSource('civitai')">CivitAI</button>+ <button type="button" class="pill-btn" data-civitai-source="playtime" onclick="civitaiSetSource('playtime')" title="Character LoRAs with example clips, from the Playtime-AI org on Hugging Face">Playtime-AI · Hugging Face</button>+ </div><div class="civitai-search-bar"><input type="text" id="civitaiQuery" placeholder="Search by name, style, creator…"oninput="if(this._t) clearTimeout(this._t); this._t = setTimeout(civitaiSearch, 350)"diff --git a/webapp/js/preview.js b/webapp/js/preview.jsindex 36aa7f7..7530747 100644--- a/webapp/js/preview.js+++ b/webapp/js/preview.js@@ -1181,7 +1181,8 @@ async function openCivitaiModal(context) {// Resolve the gate before searching so a stale checked box can never add// nsfw=true while Settings is still loading.await refreshCivitaiAccessUI();- await civitaiSearch();+ await civitaiSourceRowSync();+ civitaiSearch();}// Render the family-filter pill row when the response carries@@ -1371,6 +1372,62 @@ function closeCivitaiModal() {document.getElementById('civitaiModal').style.display = 'none';}+// ---- the source: CivitAI, or a Hugging Face org --------------------------------+let _civitaiSource = 'civitai';+let _civitaiRerun = false; // a source or family change landed mid-search+function civitaiSetSource(src) {+ _civitaiSource = (src === 'playtime') ? 'playtime' : 'civitai';+ document.querySelectorAll('#civitaiSourceRow [data-civitai-source]').forEach(b =>+ b.classList.toggle('active', b.dataset.civitaiSource === _civitaiSource));+ const q = document.getElementById('civitaiQuery');+ if (q) q.placeholder = _civitaiSource === 'playtime' ? 'Filter by name…' : 'Search by name, style, creator…';+ // The heading and the CivitAI key banner belong to CivitAI; Hugging Face+ // needs neither.+ const title = document.getElementById('civitaiModalTitle');+ const banner = document.getElementById('civitaiAuthBanner');+ if (_civitaiSource === 'playtime') {+ if (title) title.textContent = `Playtime-AI on Hugging Face — ${_civitaiFamily === 'h3' ? 'Hailuo H3' : 'LTX'} character LoRAs`;+ if (banner) banner.style.display = 'none';+ } else {+ if (title) title.textContent = `Browse CivitAI for ${_civitaiFamily === 'h3' ? 'Hailuo H3' : 'LTX 2.3'} LoRAs`;+ try { refreshCivitaiAccessUI(); } catch (_) {}+ }+ if (_civitaiSearching) { _civitaiRerun = true; return; }+ civitaiSearch();+}+function civitaiSourceRowSync() {+ const row = document.getElementById('civitaiSourceRow');+ if (!row) return;+ const show = _civitaiContext === 'video';+ row.style.display = show ? 'flex' : 'none';+ if (!show) _civitaiSource = 'civitai';+}+// Hugging Face source: the whole catalog for the lane comes at once (no+// paging), filtered by the query on the server.+async function _hfLoraSearch(grid, status, loadMore) {+ const params = new URLSearchParams();+ params.set('source', _civitaiSource);+ params.set('lane', _civitaiFamily === 'h3' ? 'h3' : 'ltx');+ const q = document.getElementById('civitaiQuery').value.trim();+ if (q) params.set('q', q);+ const r = await fetch('/hf/loras?' + params.toString());+ const data = await r.json();+ if (!data.ok) {+ grid.innerHTML = '';+ status.textContent = data.error || 'Could not load the catalog.';+ status.className = 'civitai-status-line err';+ return;+ }+ renderCivitaiGrid(data.items, false);+ loadMore.style.display = 'none';+ if ((data.items || []).length === 0) {+ grid.innerHTML = `<div class="hint">Nothing from ${escapeHtml(data.label || 'this source')} for ${_civitaiFamily === 'h3' ? 'Hailuo H3' : 'LTX'}${q ? ` matching "${escapeHtml(q)}"` : ''}.</div>`;+ } else {+ status.textContent = `${data.items.length} LoRA${data.items.length === 1 ? '' : 's'} from ${data.label} — each card plays the author's own example.`;+ status.className = 'civitai-status-line';+ }+}+async function civitaiSearch() {if (_civitaiSearching) return;_civitaiSearching = true;@@ -1383,6 +1440,13 @@ async function civitaiSearch() {loadMore.style.display = 'none';_civitaiCursor = '';try {+ // `_civitaiSource` lives at module level; the contract tests extract this+ // function alone, so read it defensively rather than assume the module.+ const _src = (typeof _civitaiSource === 'string') ? _civitaiSource : 'civitai';+ if (_src !== 'civitai') {+ await _hfLoraSearch(grid, status, loadMore);+ return;+ }const params = new URLSearchParams();const q = document.getElementById('civitaiQuery').value.trim();if (q) params.set('query', q);@@ -1414,6 +1478,7 @@ async function civitaiSearch() {status.className = 'civitai-status-line err';} finally {_civitaiSearching = false;+ if (typeof _civitaiRerun !== 'undefined' && _civitaiRerun) { _civitaiRerun = false; civitaiSearch(); }}}@@ -1484,14 +1549,16 @@ function renderCivitaiGrid(items, append) {<div class="ttl" title="${escapeHtml(it.name)}">${escapeHtml(it.name)}</div><div class="meta"><span>by ${escapeHtml(it.creator)}</span>- <span>↓ ${dl}</span>+ ${it.source === 'huggingface' ? `<span title="likes on Hugging Face">♥ ${Number(it.likes || 0)}</span>` : `<span>↓ ${dl}</span>`}<span>${sizeMb} MB</span>${it.nsfw ? '<span class="nsfw-badge">NSFW</span>' : ''}</div>${triggers ? `<div class="meta"><span title="trigger words">trigger: ${escapeHtml(triggers)}</span></div>` : ''}${it.civitai_url? `<div class="meta"><a class="civitai-source-link" href="${escapeHtml(it.civitai_url)}" target="_blank" rel="noopener" title="Open the original CivitAI page — usage notes, examples, comments">Read instructions on CivitAI <svg class="ph" aria-hidden="true" style="margin-left:3px;vertical-align:-2px"><use href="#ph-arrow-square-out"/></svg></a></div>`- : ''}+ : (it.hf_url+ ? `<div class="meta"><a class="civitai-source-link" href="${escapeHtml(it.hf_url)}" target="_blank" rel="noopener" title="Open the Hugging Face repo — the author's example clip and notes">Open on Hugging Face <svg class="ph" aria-hidden="true" style="margin-left:3px;vertical-align:-2px"><use href="#ph-arrow-square-out"/></svg></a></div>`+ : '')}</div><div class="actions"><button type="button" class="primary-btn" data-id="${it.id}">Install</button>@@ -1508,10 +1575,16 @@ async function civitaiInstall(btn, item) {const origLabel = btn.textContent;btn.textContent = 'Downloading…';const fd = new FormData();- fd.set('download_url', item.download_url);+ const fromHf = item.source === 'huggingface';+ if (fromHf) {+ fd.set('repo', item.id);+ fd.set('filename', item.filename);+ } else {+ fd.set('download_url', item.download_url);+ }fd.set('meta', JSON.stringify(item));try {- const r = await fetch('/civitai/download', {+ const r = await fetch(fromHf ? '/hf/loras/download' : '/civitai/download', {method: 'POST',headers: {'Content-Type': 'application/x-www-form-urlencoded'},body: new URLSearchParams(fd),@@ -1795,6 +1868,7 @@ async function cancelDownload() {// Inline handlers in the markup and the other files resolve these through// the global scope; everything NOT listed here is private to this module.Object.assign(globalThis, {+ civitaiSetSource, civitaiSourceRowSync,normalizeLivePreview, _liveStageMediaHeld, _showLiveReturnChip, _hideLiveStageChrome,_restoreSelectedOutputAfterLive, _handoffLiveStageToOutput, returnToLiveRender, _renderLiveStageFrame,renderLiveStage, renderNowPreview, stopEarly, markNoVoiceTouched,