Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Models & licences: the preset map's LoRAs on the page, switch ids checked, plainer notes

Claude7b4761718c3e
diff --git a/README.md b/README.md
index adf090e2..413a1394 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ Uploads up to 200 MB work with sign-in on. Inputs given as URLs are fetched only
### Setting up the open-source engine
-1. Install ComfyUI on a machine with a GPU (24 GB VRAM covers almost every workflow; Z-Image Turbo, Wan 2.2 5B and SDXL run in 8–16 GB; VOID, Remove object's "Shadows and reflections too", may need up to 40 GB). `scripts/comfy/install-comfyui.sh` installs ComfyUI and the 15 custom node packs at the commits Fuobe was validated with (`NC_PACKS=1` adds the non-commercial ComfyUI-Whisper).
+1. Install ComfyUI on a machine with a GPU (24 GB VRAM covers almost every workflow; Z-Image Turbo, Wan 2.2 5B and SDXL run in 8–16 GB; VOID, Remove object's "Shadows and reflections too", may need up to 40 GB). `scripts/comfy/install-comfyui.sh` installs ComfyUI and the 16 custom node packs at the commits Fuobe was validated with, the non-commercial ComfyUI-Whisper included (`NC_PACKS=0` leaves it out; Settings → Models & licences switches packs and models off per install).
2. Open **ComfyUI workflows** in Fuobe. Each workflow lists the model files it needs, which are already installed (✓) and a **Copy install commands** button that produces the exact `wget` / `git clone` lines.
3. Switch the engine toggle (top-right of every studio) to **Open source**.
4. For LoRAs (camera motions, effects, trained characters), set **Settings → LoRAs → LoRA folder** to ComfyUI's `models/loras`, and add a civitai key for civitai files. Fuobe then downloads a LoRA ComfyUI doesn't have before the run.
diff --git a/scripts/comfy/README.md b/scripts/comfy/README.md
index d105bcd0..9ecdf698 100644
--- a/scripts/comfy/README.md
+++ b/scripts/comfy/README.md
@@ -12,7 +12,7 @@ Full write-up (what is in the library, validation results, models, quirks for ap
| file | purpose |
|---|---|
-| `install-comfyui.sh` | reproducible CPU install of ComfyUI + the 15 custom node packs (pinned commits; Chatterbox, IndexTTS2 and Video-Depth-Anything added for the comfyui-oss-2 workflows — IndexTTS2's runtime deps only with `INDEXTTS_RUNTIME=1`; MelBandRoFormer, QwenASR and HunyuanVideo-Foley for comfyui-oss-3; ToSVG (VTracer) in round 4). Non-commercial node code is opt-in: `NC_PACKS=1` adds ComfyUI-Whisper (CC-BY-NC-SA-4.0, only for `captions-whisper-burnin`) |
+| `install-comfyui.sh` | reproducible CPU install of ComfyUI + the 16 custom node packs (pinned commits; Chatterbox, IndexTTS2 and Video-Depth-Anything added for the comfyui-oss-2 workflows — IndexTTS2's runtime deps only with `INDEXTTS_RUNTIME=1`; MelBandRoFormer, QwenASR and HunyuanVideo-Foley for comfyui-oss-3; ToSVG (VTracer) in round 4). Licences are information: the non-commercial ComfyUI-Whisper (CC-BY-NC-SA-4.0, only for `captions-whisper-burnin`) is installed too, and `NC_PACKS=0` leaves it out (Settings → Models & licences has a switch per node pack) |
| `install-isolated-worker.sh` | a second ComfyUI with its own code copy, base directory, `HOME` and virtualenv for LatentSync 1.6 and ThinkSound (below) |
| `start-comfyui.sh` / `stop-comfyui.sh` | run ComfyUI in the background on 127.0.0.1:8188 (log: `$COMFYUI_DIR/logs/comfyui.log`) |
| `export-templates.mjs` | Playwright: opens the ComfyUI frontend, `app.loadGraphData(ui)` → `app.graphToPrompt().output`, writes `build/raw/<key>.api.json` + `.meta.json` (embedded model URLs, missing node types) |
diff --git a/src/app/api/settings/models/route.ts b/src/app/api/settings/models/route.ts
index 2a1b68e8..cdf1ee3c 100644
--- a/src/app/api/settings/models/route.ts
+++ b/src/app/api/settings/models/route.ts
@@ -1,7 +1,7 @@
import { connection } from "next/server";
import { LICENCE_CLASSES } from "@/lib/licences";
import type { AccessChange } from "@/lib/model-access";
-import { accessList, changeAccess } from "@/server/model-access";
+import { accessList, changeAccess, knownSwitch } from "@/server/model-access";
/**
* Settings → Models & licences: every model, LoRA and node pack with its licence and its switch, and the
@@ -14,6 +14,7 @@ export async function GET() {
}
const KINDS = new Set(["model", "class", "provider", "pack", "lora"]);
+const NOUN = { model: "Model", provider: "Provider", pack: "Node pack", lora: "LoRA" } as const;
/** A change as the API takes it, or why not. */
function readChange(v: unknown): AccessChange | string {
@@ -24,8 +25,13 @@ function readChange(v: unknown): AccessChange | string {
if (c.kind === "keepGpuOnlyLoras") return { kind: "keepGpuOnlyLoras", on: c.on };
if (typeof c.kind !== "string" || !KINDS.has(c.kind)) return "kind is model, class, provider, pack, lora, keepGpuOnlyLoras or reset";
if (typeof c.id !== "string" || !c.id.trim()) return "Each change names its id";
- if (c.kind === "class" && !(LICENCE_CLASSES as string[]).includes(c.id)) return `class is one of ${LICENCE_CLASSES.join(", ")}`;
- return { kind: c.kind as "model", id: c.id.trim(), on: c.on };
+ const id = c.id.trim();
+ if (c.kind === "class") return (LICENCE_CLASSES as string[]).includes(id) ? { kind: "class", id, on: c.on } : `class is one of ${LICENCE_CLASSES.join(", ")}`;
+ const kind = c.kind as keyof typeof NOUN;
+ // Switching off something this install doesn't have would store a switch that does nothing (a typo, say).
+ // Turning one back on always works, so a switch left from a model that has since gone can be cleared.
+ if (!c.on && !knownSwitch(kind, id)) return `${NOUN[kind]} ${id} isn't one this install has (GET /api/settings/models lists them)`;
+ return { kind, id, on: c.on };
}
export async function PUT(request: Request) {
diff --git a/src/components/model-access-view.tsx b/src/components/model-access-view.tsx
index afbfde17..bcce1718 100644
--- a/src/components/model-access-view.tsx
+++ b/src/components/model-access-view.tsx
@@ -230,6 +230,17 @@ export function ModelAccessView() {
}
const offModels = data.models.filter((m) => !modelOn(m) || m.offBy.length).length;
+ const offLoras = data.loras.filter((l) => access.loras.includes(l.file) || access.classes.includes(l.licence.class)).length;
+ // What the switches do, each said once: models that no longer run, LoRAs left out, and the GPU-only LoRA rule.
+ const summary = allOn(access)
+ ? "Everything is on. Switch off what this install shouldn't offer: it leaves the pickers and the server refuses it."
+ : [
+ offModels ? `${offModels} ${offModels === 1 ? "model is" : "models are"} turned off by the switches below` : "Every model still runs",
+ offLoras > 0 && `${offLoras} ${offLoras === 1 ? "LoRA is" : "LoRAs are"} left out of runs`,
+ access.keepGpuOnlyLoras && "LoRAs licensed for your GPU only stay off the cloud",
+ ]
+ .filter(Boolean)
+ .join(". ") + ".";
const tabs: { value: Tab; label: string; count: number }[] = [
{ value: "models", label: "Models", count: data.models.length },
{ value: "loras", label: "LoRAs", count: data.loras.length },
@@ -251,13 +262,11 @@ export function ModelAccessView() {
<p className="text-[15px] font-semibold tabular-nums">
{data.models.length - offModels} of {data.models.length} models offered
</p>
- <p className="mt-0.5 text-[13px] text-muted-foreground">
- {allOn(access) ? "Everything is on. Switch off what this install shouldn't offer: it leaves the pickers and the server refuses it." : `${offModels} ${offModels === 1 ? "model is" : "models are"} turned off by the switches below.`}
- </p>
+ <p className="mt-0.5 text-[13px] text-muted-foreground">{summary}</p>
</div>
{!allOn(access) && (
<Button variant="secondary" size="sm" className="h-9 shrink-0 self-start sm:self-center" onClick={() => flip({ kind: "reset" })} disabled={change.isPending}>
- <RotateCcw /> Turn everything back on
+ <RotateCcw /> Back to the defaults
</Button>
)}
</div>
diff --git a/src/lib/catalog/loras.ts b/src/lib/catalog/loras.ts
index 514dbc0b..301fdecc 100644
--- a/src/lib/catalog/loras.ts
+++ b/src/lib/catalog/loras.ts
@@ -219,14 +219,15 @@ export function fitLoras(loras: LoraRef[], route: Pick<ModelRoute, "provider" |
const unsent = loras.filter((l) => !localOnly(l) && !gated(l) && !sendable(l));
if (unsent.length) notes.push(`${list(unsent.map(loraName))} ${unsent.length > 1 ? "exist" : "exists"} only on your ComfyUI, so this cloud run leaves ${unsent.length > 1 ? "them" : "it"} out`);
const cloud = sendableToCloud(loras);
- const gpuOnly = [...new Set(cloud.filter(gpuOnlyLicence).map(loraName))];
- if (gpuOnly.length) notes.push(`${list(gpuOnly)}: ${gpuOnly.length > 1 ? "their licences allow your GPU only (civitai lists no “Rent”); they run" : "its licence allows your GPU only (civitai lists no “Rent”); it runs"} in the cloud because Settings → Models & licences lets such LoRAs go there`);
const field = routeLoraField(route);
if (!field) {
if (cloud.length) notes.push(`This model takes no LoRAs in the cloud, so ${list(cloud.map(loraName))} ${cloud.length > 1 ? "are" : "is"} left out`);
return { loras: [], notes };
}
const { kept, over } = fitSlots(field, cloud);
+ // Said only of the LoRAs this run really sends (not of one the route or its capacity leaves out).
+ const gpuOnly = [...new Set(kept.filter(gpuOnlyLicence).map(loraName))];
+ if (gpuOnly.length) notes.push(`${list(gpuOnly)}: ${gpuOnly.length > 1 ? "their licences allow your GPU only (civitai lists no “Rent”); they run" : "its licence allows your GPU only (civitai lists no “Rent”); it runs"} in the cloud because Settings → Models & licences lets such LoRAs go there`);
if (over.length) {
const why = field.shape === "experts" ? "one LoRA per expert" : `up to ${loraCapacity(field)} LoRA${loraCapacity(field) > 1 ? "s" : ""}`;
notes.push(`This API takes ${why}, so ${list(over.map(loraName))} ${over.length > 1 ? "are" : "is"} left out`);
diff --git a/src/lib/command-search.ts b/src/lib/command-search.ts
index 876f012d..eacf5a7d 100644
--- a/src/lib/command-search.ts
+++ b/src/lib/command-search.ts
@@ -191,12 +191,10 @@ export function indexEntries(index: PaletteIndex, mode: "both" | "cloud" | "open
...presets(index.motions, "motion", (id) => `/video?preset=${id}`),
...presets(index.effects, "effect", (id) => `/video?preset=${id}`),
...index.models
- .filter((m) => mode === "both" || (m.engines ?? [m.engine]).includes(mode))
+ // Settings → Models & licences: a model switched off isn't offered here either (its switch is on that page,
+ // which has its own entry).
+ .filter((m) => (mode === "both" || (m.engines ?? [m.engine]).includes(mode)) && offered(access, m.id, mode === "both" ? undefined : mode))
.map((m): PaletteEntry => {
- // Settings → Models & licences: a model switched off opens the switches, not a studio that would refuse it.
- if (!offered(access, m.id, mode === "both" ? undefined : mode)) {
- return { key: `model:${m.id}`, kind: "model", label: m.name, hint: `${m.vendor} · turned off in Models & licences`, href: "/settings/models", keywords: `${m.ops} turned off licence` };
- }
const both = (m.engines?.length ?? 0) > 1;
return {
key: `model:${m.id}`,
diff --git a/src/lib/model-access.ts b/src/lib/model-access.ts
index f3129f6f..247e7b6c 100644
--- a/src/lib/model-access.ts
+++ b/src/lib/model-access.ts
@@ -207,6 +207,16 @@ export function firstOffered(summary: AccessSummary | undefined, ids: (string |
return ids.find((id) => offered(summary, id, engine));
}
+/**
+ * A studio menu's choices as this install offers them: the ones that are on, in their order. With every one off
+ * the menu keeps them all, so the studio still shows what it does and a run names the switch to turn back on.
+ * `on` says whether an item is on (the browser: offered(summary, …); the server: isOffered).
+ */
+export function keepOffered<T>(items: readonly T[], on: (item: T) => boolean): T[] {
+ const kept = items.filter(on);
+ return kept.length ? kept : [...items];
+}
+
// ---------------------------------------------------------------------------
// What Settings → Models & licences lists (GET /api/settings/models, built by src/server/model-access.ts)
diff --git a/src/server/loras.ts b/src/server/loras.ts
index faa9ed3a..ef218361 100644
--- a/src/server/loras.ts
+++ b/src/server/loras.ts
@@ -386,13 +386,23 @@ export async function prepareCloudLoras(
hostedUrl,
sha256: facts?.sha256 ?? crypto.createHash("sha256").update(data).digest("hex"),
sizeBytes: data.length,
- licence: { ...licenceSnapshot(l, entry, now), ...(!now?.includes("Rent") && { hosting: "copied without civitai's “Rent” permission: Settings → Models & licences lets LoRAs licensed for your GPU only go to the cloud" }) },
+ licence: { ...licenceSnapshot(l, entry, now), ...(hostingNote(now) && { hosting: hostingNote(now) }) },
});
out.push({ ...l, hostedUrl });
}
return out;
}
+/**
+ * What a mirror records about the hosting right it was copied under (nothing when civitai lists "Rent"): civitai
+ * didn't answer, so it is unknown, or civitai lists no "Rent" and the admin lets such LoRAs go to the cloud.
+ */
+function hostingNote(now: string[] | null): string | undefined {
+ if (!now) return "copied without civitai's current permissions: civitai didn't answer, so its hosting right wasn't confirmed";
+ if (!now.includes("Rent")) return "copied without civitai's “Rent” permission: Settings → Models & licences lets LoRAs licensed for your GPU only go to the cloud";
+ return undefined;
+}
+
/**
* Download a library LoRA into the LoRA folder ahead of a run (Settings → LoRAs). Returns the copy recorded.
*/
diff --git a/src/server/model-access.ts b/src/server/model-access.ts
index ce55b072..e970e463 100644
--- a/src/server/model-access.ts
+++ b/src/server/model-access.ts
@@ -1,8 +1,9 @@
import "server-only";
-import { MODELS } from "@/lib/catalog";
+import { getPreset, MODELS } from "@/lib/catalog";
import { onEngine, providerEngine } from "@/lib/catalog/engines";
import { LORA_LIBRARY, MOTION_EFFECT_LORAS } from "@/lib/catalog/lora-library.generated";
import { libraryEntry, loraName } from "@/lib/catalog/loras";
+import { OSS_LORAS, type OssLora } from "@/lib/catalog/oss-loras.generated";
import type { Engine, LoraRef, ModelDef, ModelRoute } from "@/lib/catalog/types";
import type { ManifestWorkflow } from "@/lib/comfy";
import {
@@ -14,6 +15,7 @@ import {
licenceInfo,
loraLicenceInfo,
mergeLicences,
+ modelCardOf,
NODE_PACKS,
paidApiLicence,
PROVIDER_NAME,
@@ -33,6 +35,7 @@ import {
type AccessChange,
type AccessList,
type AccessSummary,
+ type LoraInfo,
type ModelEntry,
type FactsOf,
type ModelAccess,
@@ -161,14 +164,11 @@ export function isOffered(id: string | undefined, engine?: Engine): boolean {
}
/**
- * An automatic pick: the first of these that is on. When none is, the error says what to turn on (the first
- * one's switch), so a studio never silently runs something else.
+ * A studio's default among its own models (Shorts' restyle models, a Layers tool's): the first that is on, else
+ * the first (its run then refuses, naming the switch to turn back on).
*/
-export function pickOffered(ids: (string | undefined)[], engine?: Engine): string {
- const id = ids.find((x) => isOffered(x, engine));
- if (id) return id;
- const first = ids.map((x) => (x ? MODELS.find((m) => m.id === x) : undefined)).find(Boolean);
- throw new Error(first ? offReason(first) : `No model for this is turned on in ${ACCESS_PLACE}`);
+export function firstOn(ids: readonly string[], engine?: Engine): string | undefined {
+ return ids.find((id) => isOffered(id, engine)) ?? ids[0];
}
/**
@@ -236,6 +236,60 @@ export function modelLicence(m: ModelDef): { licence: LicenceInfo; cloud?: Licen
return { licence: cloudLicence ?? { name: "Not recorded", class: "unknown", note: "" }, packs };
}
+/** The presets a map key names: a map v2 preset id, or a round-1 slug (the motion, effect or app it matches). */
+const presetsOf = (key: string) => (getPreset(key) ? [getPreset(key)!] : ["motion", "effect", "app"].flatMap((k) => getPreset(`${k}-${key}`) ?? []));
+
+/** A map LoRA's name as its download names it: the Hugging Face repo ("Remade-AI/Crane_up" → "Crane up"), else its file. */
+function mapLoraName(l: OssLora): string {
+ const repo = l.url && /^https:\/\/huggingface\.co\/[^/]+\/([^/]+)\//.exec(l.url)?.[1];
+ return (repo || l.file.replace(/\.safetensors$/i, "")).replace(/[_-]+/g, " ").trim();
+}
+
+/**
+ * Every LoRA a run can load, with its licence: the library's, then the preset LoRA map's files that aren't
+ * library files (the round-1 Wan LoRAs camera motions and effects load), their licence as the map records it.
+ */
+function loraRows(access: ModelAccess): LoraInfo[] {
+ const rows: LoraInfo[] = LORA_LIBRARY.map((e) => {
+ const row = MOTION_EFFECT_LORAS.find((r) => r.loras.includes(e.key));
+ const hold = row?.status === "licence-hold" ? "The research holds this licence: its Hugging Face and civitai pages disagree" : undefined;
+ return { file: e.file, name: e.name, group: e.group, base: e.base, licence: loraLicenceInfo(e.licence, e.page, hold), on: !access.loras.includes(e.file) };
+ });
+ const map = new Map<string, { ref: OssLora; keys: string[] }>();
+ for (const [key, refs] of Object.entries(OSS_LORAS)) {
+ for (const ref of refs) {
+ if (libraryEntry(ref)) continue;
+ const hit = map.get(ref.file);
+ if (hit) hit.keys.push(key);
+ else map.set(ref.file, { ref, keys: [key] });
+ }
+ }
+ for (const [file, { ref, keys }] of map) {
+ const presets = [...new Map(keys.flatMap(presetsOf).map((p) => [p.id, p])).values()];
+ const motion = presets.length ? presets.every((p) => p.id.startsWith("motion-")) : keys.every((k) => k.startsWith("motion-"));
+ const used = presets.length ? `In the preset LoRA map: ${presets.map((p) => p.name).join(", ")}` : "In the preset LoRA map";
+ rows.push({ file, name: mapLoraName(ref), group: motion ? "motion" : "effect", base: ref.base, licence: loraLicenceInfo(ref.licence, modelCardOf(ref.url), used), on: !access.loras.includes(file) });
+ }
+ return rows;
+}
+
+/**
+ * Whether a switch names something this install has (a model, a provider in use, a node pack, a LoRA the
+ * library or the preset map loads): the settings API refuses a typo rather than storing a switch that does nothing.
+ */
+export function knownSwitch(kind: "model" | "provider" | "pack" | "lora", id: string): boolean {
+ switch (kind) {
+ case "model":
+ return MODELS.some((m) => m.id === id);
+ case "provider":
+ return MODELS.some((m) => m.routes.some((r) => r.provider === id));
+ case "pack":
+ return NODE_PACKS.some((p) => p.name === id);
+ case "lora":
+ return LORA_LIBRARY.some((e) => e.file === id) || Object.values(OSS_LORAS).some((refs) => refs.some((r) => r.file === id));
+ }
+}
+
export function accessList(): AccessList {
const access = readAccess();
const models: ModelEntry[] = MODELS.map((m) => {
@@ -266,11 +320,7 @@ export function accessList(): AccessList {
return new Set(m.routes.map((r) => factsOf(r, m).class));
};
const classesOf = new Map(models.map((e) => [e.id, routeClasses(e.id)]));
- const loras = LORA_LIBRARY.map((e) => {
- const row = MOTION_EFFECT_LORAS.find((r) => r.loras.includes(e.key));
- const hold = row?.status === "licence-hold" ? "The research holds this licence: its Hugging Face and civitai pages disagree" : undefined;
- return { file: e.file, name: e.name, group: e.group, base: e.base, licence: loraLicenceInfo(e.licence, e.page, hold), on: !access.loras.includes(e.file) };
- });
+ const loras = loraRows(access);
return {
access,
classes: LICENCE_CLASSES.map((id) => ({
diff --git a/tests/fal-lora.test.ts b/tests/fal-lora.test.ts
index c2d6c361..bb14ea2d 100644
--- a/tests/fal-lora.test.ts
+++ b/tests/fal-lora.test.ts
@@ -100,6 +100,9 @@ describe("fal LoRA payloads (generated FieldMap.loras)", () => {
expect(loraFields(r.map!.loras!, [{ ...wiggle, keepOnGpu: true, hostedUrl: "https://v3.fal.media/x" }])).toEqual({});
// The open engine carries every LoRA.
expect(fitLoras([{ ...wiggle, keepOnGpu: true }, keep], { provider: "comfyui" }).loras).toHaveLength(2);
+ // A route that takes no LoRAs says only that: the licence note is for LoRAs a run really sends.
+ const none = fitLoras([wiggle], { provider: "fal", map: {} });
+ expect(none).toEqual({ loras: [], notes: ["This model takes no LoRAs in the cloud, so Wiggle Redmond is left out"] });
});
it("never sends a civitai URL (the user's key stays home): only its mirror", () => {
diff --git a/tests/lora-fetch.test.ts b/tests/lora-fetch.test.ts
index a81e7f76..249ca53b 100644
--- a/tests/lora-fetch.test.ts
+++ b/tests/lora-fetch.test.ts
@@ -233,6 +233,18 @@ describe("Before a cloud run", () => {
expect(mirror.licence).toMatchObject({ permissionsNow: ["Image", "RentCivit"], hosting: expect.stringMatching(/without civitai's “Rent” permission: Settings → Models & licences/) });
});
+ it("records an unconfirmed hosting right, not a missing one, when civitai doesn't answer", async () => {
+ setSetting("civitaiKey", KEY);
+ const routes = civitaiRoutes(Y2K_BODY);
+ net = network({ ...routes, "https://civitai.com/api/v1/models/2979601": () => new Response("down", { status: 503 }) });
+ const up = upload();
+ const out = (await prepareCloudLoras([y2k], "replicate", up.fn)) as LoraRef[];
+ expect(out[0].hostedUrl).toBe("https://v3.fal.media/files/civitai-3422541-y2k.safetensors");
+ const mirror = listLoraCopies().find((c) => c.target === "replicate")!;
+ expect(mirror.licence?.hosting).toMatch(/civitai didn't answer, so its hosting right wasn't confirmed/);
+ expect(mirror.licence?.hosting).not.toMatch(/without civitai's “Rent” permission/);
+ });
+
it("goes back to civitai's hosting permission while Settings → Models & licences keeps GPU-only LoRAs on the GPU", async () => {
setSetting("civitaiKey", KEY);
net = network(civitaiRoutes(Y2K_BODY, { permissions: ["Image", "RentCivit"] }));
diff --git a/tests/model-access-listings.test.ts b/tests/model-access-listings.test.ts
index 0a2ae694..431e073c 100644
--- a/tests/model-access-listings.test.ts
+++ b/tests/model-access-listings.test.ts
@@ -75,11 +75,13 @@ describe("Models & licences in listings and picks", () => {
expect(plan()).not.toBe("nano-banana-pro");
});
- it("sends a switched-off model in the ⌘K palette to Models & licences instead of its studio", () => {
+ it("leaves a switched-off model out of the ⌘K palette, and an Original off on one engine out of that engine's list", () => {
const index = paletteIndex();
- const entry = (access?: { off: string[] }) => indexEntries(index, "both", access).find((e) => e.key === "model:nano-banana-pro")!;
- expect(entry().href).not.toBe("/settings/models");
- expect(entry({ off: ["nano-banana-pro"] })).toMatchObject({ href: "/settings/models", hint: "Google · turned off in Models & licences" });
+ expect(indexEntries(index, "both").some((e) => e.key === "model:nano-banana-pro")).toBe(true);
+ expect(indexEntries(index, "both", { off: ["nano-banana-pro"] }).some((e) => e.key === "model:nano-banana-pro")).toBe(false);
+ const soulOpenOnly = { off: [], engines: { "fuobe-soul": ["open" as const] } };
+ expect(indexEntries(index, "cloud", soulOpenOnly).some((e) => e.key === "model:fuobe-soul")).toBe(false);
+ expect(indexEntries(index, "open", soulOpenOnly).some((e) => e.key === "model:fuobe-soul")).toBe(true);
});
it("refuses a model that is off through the API, naming the switch", async () => {
@@ -92,7 +94,17 @@ describe("Models & licences in listings and picks", () => {
it("lists every model, LoRA and node pack with its licence, and flips switches through the settings API", async () => {
const list = (await (await settingsRoute.GET()).json()) as import("@/lib/model-access").AccessList;
expect(list.models.length).toBeGreaterThan(300);
- expect(list.loras.length).toBe(114);
+ // The library's 114 LoRAs and the preset LoRA map's files that aren't library files, each once.
+ expect(list.loras.length).toBe(166);
+ expect(new Set(list.loras.map((l) => l.file)).size).toBe(list.loras.length);
+ expect(list.loras.find((l) => l.file === "crane_up.safetensors")).toMatchObject({
+ name: "Crane up",
+ group: "motion",
+ licence: { class: "commercial", name: "Apache-2.0", url: "https://huggingface.co/Remade-AI/Crane_up" },
+ on: true,
+ });
+ expect(list.loras.find((l) => l.file === "crane_up.safetensors")!.licence.note).toMatch(/In the preset LoRA map: Jib Up/);
+ expect(list.loras.find((l) => l.file === "cakeify_16_epochs.safetensors")).toMatchObject({ group: "effect" });
expect(list.packs.find((p) => p.name === "ComfyUI-Whisper")).toMatchObject({ licence: { class: "non-commercial" }, models: 1, on: true });
expect(list.models.find((m) => m.id === "fuobe-soul")).toMatchObject({ licence: { class: "commercial" }, cloud: { class: "paid-api" }, engines: ["open", "cloud"], on: true });
expect(list.loras.find((l) => l.file === "BTSMovieSet_LTX25_v1.safetensors")!.licence.note).toMatch(/research holds this licence/);
@@ -101,6 +113,14 @@ describe("Models & licences in listings and picks", () => {
expect((await put([{ kind: "class", id: "free", on: false }])).status).toBe(400);
expect((await put([{ kind: "model", on: false }])).status).toBe(400);
expect((await put([])).status).toBe(400);
+ // A switch that names nothing this install has is refused, not stored.
+ for (const [kind, id] of [["model", "nano-bananna-pro"], ["provider", "nope"], ["pack", "ComfyUI-Nope"], ["lora", "nope.safetensors"]]) {
+ const res = await put([{ kind, id, on: false }]);
+ expect(res.status, `${kind} ${id}`).toBe(400);
+ expect(((await res.json()) as { error: string }).error).toMatch(/isn't one this install has/);
+ }
+ expect((await put([{ kind: "lora", id: "crane_up.safetensors", on: false }])).status).toBe(200);
+ expect((await put([{ kind: "lora", id: "crane_up.safetensors", on: true }])).status).toBe(200);
const after = (await (await put([{ kind: "provider", id: "fal", on: false }, { kind: "keepGpuOnlyLoras", on: true }])).json()) as import("@/lib/model-access").AccessList;
expect(after.access).toMatchObject({ providers: ["fal"], keepGpuOnlyLoras: true });
expect(after.providers.find((p) => p.id === "fal")!.on).toBe(false);