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.

Settings: Models & licences lists every model, LoRA and node pack with its licence and a switch

Claude5688e9e6c692
diff --git a/src/app/(studio)/settings/about/page.tsx b/src/app/(studio)/settings/about/page.tsx
index a67cbbc1..52573ef5 100644
--- a/src/app/(studio)/settings/about/page.tsx
+++ b/src/app/(studio)/settings/about/page.tsx
@@ -97,7 +97,12 @@ export default async function Page() {
</h2>
<p className="mt-1 mb-5 max-w-2xl text-[13px] text-muted-foreground">
{list.counts.all} models and workflows: {list.counts.clear} allow commercial use, {list.counts.conditions} with conditions (revenue limits or use rules), {list.counts["non-commercial"]}{" "}
- non-commercial and {list.counts.territory} not available everywhere. Read the licence itself before you sell what you make; this list is a guide, not legal advice.
+ non-commercial and {list.counts.territory} not available everywhere. Read the licence itself before you sell what you make; this list is a guide, not legal advice. Which of them this
+ install offers is yours to decide in{" "}
+ <Link href="/settings/models" className="text-brand-text underline underline-offset-2">
+ Models &amp; licences
+ </Link>
+ .
</p>
<LicencesView list={list} />
</section>
diff --git a/src/app/(studio)/settings/models/loading.tsx b/src/app/(studio)/settings/models/loading.tsx
new file mode 100644
index 00000000..566e5d0a
--- /dev/null
+++ b/src/app/(studio)/settings/models/loading.tsx
@@ -0,0 +1,5 @@
+import { PageSkeleton } from "@/components/skeletons";
+
+export default function Loading() {
+ return <PageSkeleton title="Models & licences" />;
+}
diff --git a/src/app/(studio)/settings/models/page.tsx b/src/app/(studio)/settings/models/page.tsx
new file mode 100644
index 00000000..26058831
--- /dev/null
+++ b/src/app/(studio)/settings/models/page.tsx
@@ -0,0 +1,32 @@
+import { ArrowLeft } from "lucide-react";
+import type { Metadata } from "next";
+import Link from "next/link";
+import { ModelAccessView } from "@/components/model-access-view";
+import { PageHeader, PageShell } from "@/components/page-shell";
+
+export const metadata: Metadata = { title: "Models & licences" };
+
+/** Settings → Models & licences: every model's licence as information, and the switches that decide what this install offers. */
+export default function Page() {
+ return (
+ <PageShell>
+ <Link href="/settings" className="mb-3 inline-flex items-center gap-1.5 rounded-md text-[13px] text-muted-foreground hover:text-foreground">
+ <ArrowLeft className="size-3.5" /> Settings
+ </Link>
+ <PageHeader
+ title="Models & licences"
+ description={
+ <>
+ Every model, LoRA and node pack Fuobe can run, with its licence: paid and open, commercial or not. Licences are information here; you decide what this install offers. Everything is on until
+ you switch it off, and what is off leaves every picker and is refused on the server.{" "}
+ <Link href="/settings/about" className="text-brand-text underline-offset-2 hover:underline">
+ About &amp; licences
+ </Link>{" "}
+ has the notices and the full licence texts of the open models.
+ </>
+ }
+ />
+ <ModelAccessView />
+ </PageShell>
+ );
+}
diff --git a/src/app/api/settings/models/route.ts b/src/app/api/settings/models/route.ts
new file mode 100644
index 00000000..2a1b68e8
--- /dev/null
+++ b/src/app/api/settings/models/route.ts
@@ -0,0 +1,39 @@
+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";
+
+/**
+ * Settings → Models & licences: every model, LoRA and node pack with its licence and its switch, and the
+ * switches per licence class and provider (GET); flip switches (PUT `{ changes: AccessChange[] }`, answered with
+ * the list as it is now). Everything is on until an admin turns it off.
+ */
+export async function GET() {
+ await connection();
+ return Response.json(accessList());
+}
+
+const KINDS = new Set(["model", "class", "provider", "pack", "lora"]);
+
+/** A change as the API takes it, or why not. */
+function readChange(v: unknown): AccessChange | string {
+ if (!v || typeof v !== "object") return "Each change is an object";
+ const c = v as Record<string, unknown>;
+ if (c.kind === "reset") return { kind: "reset" };
+ if (typeof c.on !== "boolean") return "Each change says on: true or false";
+ 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 };
+}
+
+export async function PUT(request: Request) {
+ const body = (await request.json().catch(() => ({}))) as { changes?: unknown };
+ if (!Array.isArray(body.changes) || !body.changes.length) return Response.json({ error: "Send { changes: [...] }" }, { status: 400 });
+ const changes = body.changes.map(readChange);
+ const bad = changes.find((c): c is string => typeof c === "string");
+ if (bad) return Response.json({ error: bad }, { status: 400 });
+ changeAccess(changes as AccessChange[]);
+ return Response.json(accessList());
+}
diff --git a/src/components/lora-settings.tsx b/src/components/lora-settings.tsx
index d587e3eb..f0c63ccd 100644
--- a/src/components/lora-settings.tsx
+++ b/src/components/lora-settings.tsx
@@ -133,7 +133,7 @@ function LoraRow({ l, folder, onDownload, busy }: { l: LibraryLora; folder: bool
{l.target ? ` · ${l.target}-noise half` : ""}
</span>
<span aria-hidden>·</span>
- <span className={cn(!l.commercial && "text-destructive", l.commercial && !l.hostedOk && "text-foreground")}>{l.licence}</span>
+ <span className={cn(l.commercial && !l.hostedOk && "text-foreground")}>{l.licence}</span>
<span aria-hidden>·</span>
<span>{SOURCE[l.download]}</span>
{l.mirrored.length > 0 && (
diff --git a/src/components/model-access-view.tsx b/src/components/model-access-view.tsx
new file mode 100644
index 00000000..afbfde17
--- /dev/null
+++ b/src/components/model-access-view.tsx
@@ -0,0 +1,395 @@
+"use client";
+
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { Ban, CheckCircle2, CircleHelp, CreditCard, ExternalLink, FlaskConical, Globe, Info, RotateCcw, Search } from "lucide-react";
+import { Fragment, useDeferredValue, useMemo, useState } from "react";
+import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
+import { Skeleton } from "@/components/ui/skeleton";
+import { Switch } from "@/components/ui/switch";
+import { useProgressive } from "@/components/use-progressive";
+import { kindLabel, LICENCE_CLASSES, CLASS_LABEL, type LicenceClass, type LicenceInfo } from "@/lib/licences";
+import { allOn, applyChange, type AccessChange, type AccessList, type LoraInfo, type ModelAccess, type ModelEntry, type PackInfo } from "@/lib/model-access";
+import { cn } from "@/lib/utils";
+
+/** Settings → Models & licences: every model, LoRA and node pack with its licence, and the switches. */
+
+const CLASS_STYLE: Record<LicenceClass, { icon: typeof Ban; tone: string; fill: string }> = {
+ commercial: { icon: CheckCircle2, tone: "text-success", fill: "bg-success/12" },
+ conditions: { icon: Info, tone: "text-muted-foreground", fill: "bg-secondary" },
+ regions: { icon: Globe, tone: "text-warning", fill: "bg-warning/15" },
+ "non-commercial": { icon: Ban, tone: "text-destructive", fill: "bg-destructive/10 dark:bg-destructive/20" },
+ research: { icon: FlaskConical, tone: "text-destructive", fill: "bg-destructive/10 dark:bg-destructive/20" },
+ "paid-api": { icon: CreditCard, tone: "text-brand-text", fill: "bg-brand-faint" },
+ unknown: { icon: CircleHelp, tone: "text-muted-foreground", fill: "bg-secondary" },
+};
+
+const badge = "inline-flex h-5 shrink-0 items-center gap-1 rounded-full px-2 text-[11px] font-medium whitespace-nowrap text-foreground [&>svg]:size-3";
+
+function ClassBadge({ licence }: { licence: LicenceInfo }) {
+ const { icon: Icon, tone, fill } = CLASS_STYLE[licence.class];
+ return (
+ <span className={cn(badge, fill)}>
+ <Icon className={tone} aria-hidden />
+ {licence.class === "regions" && licence.excludes ? `Not in ${licence.excludes}` : CLASS_LABEL[licence.class]}
+ </span>
+ );
+}
+
+function LicenceLine({ licence, prefix }: { licence: LicenceInfo; prefix?: string }) {
+ return (
+ <div className="mt-1 space-y-0.5">
+ <p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px]">
+ {prefix && <span className="text-muted-foreground">{prefix}</span>}
+ {licence.url ? (
+ <a href={licence.url} target="_blank" rel="noreferrer" className="inline-flex min-w-0 items-center gap-1 font-medium [overflow-wrap:anywhere] hover:underline">
+ {licence.name}
+ <ExternalLink className="size-3 shrink-0 text-muted-foreground" aria-hidden />
+ <span className="sr-only">(opens in a new tab)</span>
+ </a>
+ ) : (
+ <span className="font-medium [overflow-wrap:anywhere]">{licence.name}</span>
+ )}
+ <ClassBadge licence={licence} />
+ {licence.notices?.map((n) => (
+ <span key={n} className={cn(badge, "border")}>
+ Shows “{n}”
+ </span>
+ ))}
+ </p>
+ {licence.note && <p className="line-clamp-2 text-[12px] leading-relaxed text-muted-foreground [overflow-wrap:anywhere]" title={licence.note}>{licence.note}</p>}
+ </div>
+ );
+}
+
+/** One switch with its label and what it covers; the whole row is the label. */
+function SwitchRow({ id, label, hint, count, checked, onChange, disabled }: { id: string; label: string; hint?: React.ReactNode; count?: string; checked: boolean; onChange: (on: boolean) => void; disabled?: boolean }) {
+ return (
+ <li className="flex items-start gap-3 py-3">
+ <div className="min-w-0 flex-1">
+ <label htmlFor={id} className="block text-[14px] font-medium [overflow-wrap:anywhere]">
+ {label}
+ {count && <span className="ml-1.5 font-normal text-muted-foreground tabular-nums">{count}</span>}
+ </label>
+ {hint && <div className="mt-0.5 text-[12px] leading-relaxed text-muted-foreground">{hint}</div>}
+ </div>
+ <Switch id={id} className="mt-1" checked={checked} onCheckedChange={onChange} disabled={disabled} />
+ </li>
+ );
+}
+
+type Tab = "models" | "loras" | "packs";
+type Show = "all" | "on" | "off";
+
+const chip = (active: boolean) =>
+ cn("h-8 shrink-0 rounded-full px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:bg-accent", active && "bg-secondary text-foreground");
+
+const ENGINE_WORDS: Record<string, string> = { open: "Open source", cloud: "Cloud" };
+
+function ModelRow({ m, on, onChange }: { m: ModelEntry; on: boolean; onChange: (on: boolean) => void }) {
+ const id = `model-${m.id}`;
+ const runs = on && !m.offBy.length;
+ return (
+ <li className="flex items-start gap-3 py-3.5">
+ <div className="min-w-0 flex-1">
+ <label htmlFor={id} className="block text-[14px] font-medium [overflow-wrap:anywhere]">
+ {m.name}
+ </label>
+ <p className="text-[12px] text-muted-foreground">
+ {m.vendor} · {kindLabel(m.kind)} · {m.engines.map((e) => ENGINE_WORDS[e] ?? e).join(" + ")}
+ {m.hidden ? " · a helper step studios run" : ""}
+ </p>
+ <LicenceLine licence={m.licence} />
+ {m.cloud && <LicenceLine licence={m.cloud} prefix="In the cloud:" />}
+ {on && m.offBy.length > 0 && <p className="mt-1 text-[12px] font-medium text-warning">Not offered: {m.offBy.join(" and ")}</p>}
+ {on && m.partly.length > 0 && <p className="mt-1 text-[12px] text-muted-foreground">Partly: {m.partly.join(" and ")}, so it runs on what is still on</p>}
+ </div>
+ <Switch id={id} className="mt-1" checked={on} onCheckedChange={onChange} aria-describedby={runs ? undefined : `${id}-state`} />
+ {!runs && (
+ <span id={`${id}-state`} className="sr-only">
+ {on ? "on, but not offered" : "off"}
+ </span>
+ )}
+ </li>
+ );
+}
+
+function LoraRow({ l, on, onChange }: { l: LoraInfo; on: boolean; onChange: (on: boolean) => void }) {
+ const id = `lora-${l.file}`;
+ return (
+ <li className="flex items-start gap-3 py-3.5">
+ <div className="min-w-0 flex-1">
+ <label htmlFor={id} className="block text-[14px] font-medium [overflow-wrap:anywhere]">
+ {l.name}
+ </label>
+ <p className="text-[12px] text-muted-foreground [overflow-wrap:anywhere]">
+ {l.group === "look" ? "Look" : l.group === "motion" ? "Camera motion" : "Effect"} · {l.base}
+ </p>
+ <LicenceLine licence={l.licence} />
+ </div>
+ <Switch id={id} className="mt-1" checked={on} onCheckedChange={onChange} />
+ </li>
+ );
+}
+
+function PackRow({ p, on, onChange }: { p: PackInfo; on: boolean; onChange: (on: boolean) => void }) {
+ const id = `pack-${p.name}`;
+ return (
+ <li className="flex items-start gap-3 py-3.5">
+ <div className="min-w-0 flex-1">
+ <label htmlFor={id} className="block text-[14px] font-medium [overflow-wrap:anywhere]">
+ {p.name}
+ </label>
+ <p className="text-[12px] text-muted-foreground">
+ {p.models ? `${p.models} ${p.models === 1 ? "model loads" : "models load"} it` : "No model loads it"}
+ {p.worker ? " · on the isolated worker" : ""}
+ </p>
+ <LicenceLine licence={p.licence} />
+ </div>
+ <Switch id={id} className="mt-1" checked={on} onCheckedChange={onChange} />
+ </li>
+ );
+}
+
+const matches = (q: string, ...texts: (string | undefined)[]) => !q || texts.some((t) => t?.toLowerCase().includes(q));
+
+export function ModelAccessView() {
+ const qc = useQueryClient();
+ const list = useQuery({
+ queryKey: ["model-access"],
+ queryFn: async () => {
+ const res = await fetch("/api/settings/models");
+ const body = (await res.json().catch(() => ({}))) as Partial<AccessList> & { error?: string };
+ if (!res.ok || !body.access) throw new Error(body.error ?? `The server answered ${res.status}`);
+ return body as AccessList;
+ },
+ });
+ const change = useMutation({
+ mutationFn: async (changes: AccessChange[]) => {
+ const res = await fetch("/api/settings/models", { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ changes }) });
+ const body = (await res.json().catch(() => ({}))) as Partial<AccessList> & { error?: string };
+ if (!res.ok || !body.access) throw new Error(body.error ?? `The switch didn't save (${res.status})`);
+ return body as AccessList;
+ },
+ // The switch moves at once; the server's answer brings what else changed (models now off, counts).
+ onMutate: async (changes) => {
+ await qc.cancelQueries({ queryKey: ["model-access"] });
+ const before = qc.getQueryData<AccessList>(["model-access"]);
+ if (before) qc.setQueryData<AccessList>(["model-access"], { ...before, access: changes.reduce(applyChange, before.access) });
+ return { before };
+ },
+ onError: (e: Error, _c, ctx) => {
+ if (ctx?.before) qc.setQueryData(["model-access"], ctx.before);
+ toast.error(e.message);
+ },
+ onSuccess: (data) => qc.setQueryData(["model-access"], data),
+ // Pickers, ⌘K and the Models page read what is off from the status.
+ onSettled: () => void qc.invalidateQueries({ queryKey: ["status"] }),
+ });
+ const flip = (c: AccessChange) => change.mutate([c]);
+
+ const [tab, setTab] = useState<Tab>("models");
+ const [show, setShow] = useState<Show>("all");
+ const [query, setQuery] = useState("");
+ const q = useDeferredValue(query.trim().toLowerCase());
+
+ const data = list.data;
+ const access: ModelAccess | undefined = data?.access;
+ const modelOn = (m: ModelEntry) => !access?.models.includes(m.id);
+ const keep = (on: boolean) => show === "all" || (show === "on" ? on : !on);
+
+ const models = useMemo(() => {
+ if (!data) return [];
+ const order = (c: LicenceClass) => LICENCE_CLASSES.indexOf(c);
+ return data.models
+ .filter((m) => keep(!access!.models.includes(m.id) && !m.offBy.length) && matches(q, m.name, m.vendor, m.id, m.licence.name, m.licence.note, m.cloud?.name, CLASS_LABEL[m.licence.class]))
+ .sort((a, b) => order(a.licence.class) - order(b.licence.class));
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [data, access, q, show]);
+ const loras = useMemo(
+ () => (data ? data.loras.filter((l) => keep(!access!.loras.includes(l.file)) && matches(q, l.name, l.file, l.base, l.licence.name, l.licence.note)) : []),
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [data, access, q, show],
+ );
+ const packs = useMemo(
+ () => (data ? data.packs.filter((p) => keep(!access!.packs.includes(p.name)) && matches(q, p.name, p.licence.name, p.licence.note)) : []),
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [data, access, q, show],
+ );
+ const rows = tab === "models" ? models.length : tab === "loras" ? loras.length : packs.length;
+ const { shown, hasMore, moreFrom, sentinel } = useProgressive(rows, `${tab}|${show}|${q}`, 40, 60);
+
+ if (list.isError) return <p className="py-8 text-[13px] text-destructive">{(list.error as Error).message}</p>;
+ if (!data || !access) {
+ return (
+ <div className="space-y-3" aria-busy="true">
+ <Skeleton className="h-28 w-full rounded-2xl" />
+ <Skeleton className="h-64 w-full rounded-2xl" />
+ </div>
+ );
+ }
+
+ const offModels = data.models.filter((m) => !modelOn(m) || m.offBy.length).length;
+ const tabs: { value: Tab; label: string; count: number }[] = [
+ { value: "models", label: "Models", count: data.models.length },
+ { value: "loras", label: "LoRAs", count: data.loras.length },
+ { value: "packs", label: "Node packs", count: data.packs.length },
+ ];
+ // Rows grouped by licence class, in class order, a page at a time.
+ const groups: { cls: LicenceClass; items: ModelEntry[] }[] = [];
+ for (const m of models.slice(0, shown)) {
+ const last = groups.at(-1);
+ if (last?.cls === m.licence.class) last.items.push(m);
+ else groups.push({ cls: m.licence.class, items: [m] });
+ }
+ const total = (cls: LicenceClass) => models.filter((m) => m.licence.class === cls).length;
+
+ return (
+ <div className="space-y-8">
+ <div className="flex flex-col gap-3 rounded-2xl border p-5 sm:flex-row sm:items-center">
+ <div className="min-w-0 flex-1">
+ <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>
+ </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
+ </Button>
+ )}
+ </div>
+
+ <section aria-labelledby="by-class">
+ <h2 id="by-class" className="text-[15px] font-semibold">
+ By licence
+ </h2>
+ <p className="mt-1 text-[13px] text-muted-foreground">
+ Switch off a whole kind of licence at once: the models and LoRAs under it. A model whose cloud and GPU halves differ keeps the half that is on. Node packs have their own switches below.
+ </p>
+ <ul className="mt-1 divide-y">
+ {data.classes.map((c) => (
+ <SwitchRow
+ key={c.id}
+ id={`class-${c.id}`}
+ label={c.label}
+ count={`· ${c.models} ${c.models === 1 ? "model" : "models"}${c.loras ? ` · ${c.loras} ${c.loras === 1 ? "LoRA" : "LoRAs"}` : ""}`}
+ hint={c.hint}
+ checked={!access.classes.includes(c.id)}
+ onChange={(on) => flip({ kind: "class", id: c.id, on })}
+ />
+ ))}
+ </ul>
+ </section>
+
+ <section aria-labelledby="by-provider">
+ <h2 id="by-provider" className="text-[15px] font-semibold">
+ By provider
+ </h2>
+ <p className="mt-1 text-[13px] text-muted-foreground">A model on several providers runs on one that is still on.</p>
+ <ul className="mt-1 divide-y">
+ {data.providers.map((p) => (
+ <SwitchRow
+ key={p.id}
+ id={`provider-${p.id}`}
+ label={p.label}
+ count={`· ${p.models} ${p.models === 1 ? "model" : "models"}`}
+ checked={!access.providers.includes(p.id)}
+ onChange={(on) => flip({ kind: "provider", id: p.id, on })}
+ />
+ ))}
+ </ul>
+ </section>
+
+ <section aria-labelledby="lora-rule">
+ <h2 id="lora-rule" className="text-[15px] font-semibold">
+ LoRAs licensed for your GPU only
+ </h2>
+ <ul className="mt-1 divide-y">
+ <SwitchRow
+ id="rule-gpu-only"
+ label="Keep them on your GPU"
+ hint="Some civitai LoRAs allow commercial use but not running them on another hosted service (no “Rent” permission). Off: they go to fal.ai or Replicate like any other LoRA, and the run says so. On: cloud runs leave them out."
+ checked={access.keepGpuOnlyLoras}
+ onChange={(on) => flip({ kind: "keepGpuOnlyLoras", on })}
+ />
+ </ul>
+ </section>
+
+ <section aria-labelledby="everything" className="space-y-4">
+ <h2 id="everything" className="text-[15px] font-semibold">
+ Everything, with its licence
+ </h2>
+ <div role="group" aria-label="What to list" className="flex flex-wrap gap-1">
+ {tabs.map((t) => (
+ <button key={t.value} type="button" aria-pressed={tab === t.value} className={chip(tab === t.value)} onClick={() => setTab(t.value)}>
+ {t.label} <span className="ml-0.5 tabular-nums opacity-70">{t.count}</span>
+ </button>
+ ))}
+ </div>
+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center">
+ <div className="relative w-full sm:w-72">
+ <Search className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
+ <input
+ type="search"
+ value={query}
+ onChange={(e) => setQuery(e.target.value)}
+ placeholder="Search names or licences"
+ aria-label="Search names or licences"
+ className="h-9 w-full rounded-full border bg-background pr-3 pl-9 text-[14px] outline-none placeholder:text-subtle-foreground focus:border-primary focus:ring-4 focus:ring-brand-faint"
+ />
+ </div>
+ <div role="group" aria-label="Show" className="flex flex-wrap gap-1">
+ {(["all", "on", "off"] as const).map((s) => (
+ <button key={s} type="button" aria-pressed={show === s} className={chip(show === s)} onClick={() => setShow(s)}>
+ {s === "all" ? "All" : s === "on" ? "On" : "Off"}
+ </button>
+ ))}
+ </div>
+ </div>
+ <p className="sr-only" aria-live="polite">
+ {rows} shown
+ </p>
+ {!rows && <p className="py-8 text-center text-[13px] text-muted-foreground">Nothing matches. Try another word or filter.</p>}
+
+ {tab === "models" &&
+ groups.map((g) => (
+ <Fragment key={g.cls}>
+ <h3 className="pt-2 text-[13px] font-semibold">
+ {CLASS_LABEL[g.cls]} <span className="font-normal text-muted-foreground tabular-nums">· {total(g.cls)}</span>
+ </h3>
+ <ul className="divide-y">
+ {g.items.map((m) => (
+ <ModelRow key={m.id} m={m} on={modelOn(m)} onChange={(on) => flip({ kind: "model", id: m.id, on })} />
+ ))}
+ </ul>
+ </Fragment>
+ ))}
+ {tab === "loras" && (
+ <ul className="divide-y">
+ {loras.slice(0, shown).map((l) => (
+ <LoraRow key={l.file} l={l} on={!access.loras.includes(l.file)} onChange={(on) => flip({ kind: "lora", id: l.file, on })} />
+ ))}
+ </ul>
+ )}
+ {tab === "packs" && (
+ <ul className="divide-y">
+ {packs.slice(0, shown).map((p) => (
+ <PackRow key={p.name} p={p} on={!access.packs.includes(p.name)} onChange={(on) => flip({ kind: "pack", id: p.name, on })} />
+ ))}
+ </ul>
+ )}
+ {hasMore && (
+ <button ref={sentinel} type="button" onClick={(e) => moreFrom(e, (e.currentTarget.previousElementSibling as HTMLElement) ?? null)} className="mx-auto block h-9 rounded-full px-4 text-[13px] font-medium text-muted-foreground hover:bg-accent">
+ Show more
+ </button>
+ )}
+ <p className="border-t pt-4 text-[12px] leading-relaxed text-muted-foreground">
+ Licences are recorded from each model&apos;s card, the workflow library and the providers&apos; pages; read the licence itself before you sell what you make. This list is a guide, not legal advice.
+ </p>
+ </section>
+ </div>
+ );
+}
diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsx
index 59ec53f4..4dacd64e 100644
--- a/src/components/settings-form.tsx
+++ b/src/components/settings-form.tsx
@@ -1,7 +1,7 @@
"use client";
import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { CheckCircle2, Cloud, Cpu, ExternalLink, Info, Layers, Link2 } from "lucide-react";
+import { CheckCircle2, Cloud, Cpu, ExternalLink, Info, Layers, Link2, Scale } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useState, useSyncExternalStore } from "react";
@@ -353,7 +353,7 @@ export function SettingsForm({ prices }: { prices?: string }) {
<Section
id="loras"
title="LoRAs · looks, motions and effects"
- description="Looks, camera moves and effects add LoRA files to open models, on your GPU and in the cloud. Fuobe fetches the pinned version a run needs and follows each file's licence: one that may only run on your GPU is never sent to a cloud API."
+ description="Looks, camera moves and effects add LoRA files to open models, on your GPU and in the cloud. Fuobe fetches the pinned version a run needs and shows each file's licence; what may run where is your call in Models & licences."
>
<LoraSettings folder={get("comfyLorasDir")} civitaiKey={get("civitaiKey")} />
</Section>
@@ -412,6 +412,16 @@ export function SettingsForm({ prices }: { prices?: string }) {
/>
</Section>
+ <Section
+ id="models"
+ title="Models & licences"
+ description="Every model, LoRA and node pack with its licence, as information. Everything is on: switch off a model, a whole kind of licence (say, all non-commercial ones), a provider or a node pack, and it leaves the pickers and is refused on the server."
+ >
+ <Link href="/settings/models" className="inline-flex items-center gap-2 rounded-xl border px-4 py-3 text-[13px] font-medium transition-colors hover:bg-accent">
+ <Scale className="size-4 text-muted-foreground" /> Open Models &amp; licences
+ </Link>
+ </Section>
+
<Section id="about" title="About & licences" description="Fuobe's version, and the licence of every open model it can run — some are non-commercial or exclude some countries.">
<Link href="/settings/about" className="inline-flex items-center gap-2 rounded-xl border px-4 py-3 text-[13px] font-medium transition-colors hover:bg-accent">
<Info className="size-4 text-muted-foreground" /> Open About & licences
diff --git a/src/lib/model-access.ts b/src/lib/model-access.ts
index 3e559084..f3129f6f 100644
--- a/src/lib/model-access.ts
+++ b/src/lib/model-access.ts
@@ -9,7 +9,7 @@
* A model is off when none of its routes is on; a Fuobe Original with one engine's routes off runs on the
* other one only.
*/
-import { CLASS_LABEL, LICENCE_CLASSES, PROVIDER_NAME, type LicenceClass } from "./licences";
+import { CLASS_LABEL, LICENCE_CLASSES, PROVIDER_NAME, type LicenceClass, type LicenceInfo } from "./licences";
import { enginesOf, providerEngine } from "./catalog/engines";
import type { Engine, ModelDef, ModelRoute } from "./catalog/types";
@@ -206,3 +206,55 @@ export function offered(summary: AccessSummary | undefined, id: string | undefin
export function firstOffered(summary: AccessSummary | undefined, ids: (string | undefined)[], engine?: Engine): string | undefined {
return ids.find((id) => offered(summary, id, engine));
}
+
+// ---------------------------------------------------------------------------
+// What Settings → Models & licences lists (GET /api/settings/models, built by src/server/model-access.ts)
+
+export interface ModelEntry {
+ id: string;
+ name: string;
+ vendor: string;
+ kind: string;
+ hidden?: true;
+ engines: Engine[];
+ providers: string[];
+ /** The licence that names it: its weights' on your GPU, else the provider's terms. */
+ licence: LicenceInfo;
+ /** A Fuobe Original's cloud half (open weights hosted by fal or Replicate, under their terms). */
+ cloud?: LicenceInfo;
+ packs: string[];
+ /** Its own switch. */
+ on: boolean;
+ /** Other switches that turn all its routes off (it doesn't run), or some of them. */
+ offBy: string[];
+ partly: string[];
+}
+
+export interface LoraInfo {
+ file: string;
+ name: string;
+ group: string;
+ base: string;
+ licence: LicenceInfo;
+ on: boolean;
+}
+
+export interface PackInfo {
+ name: string;
+ repo: string;
+ licence: LicenceInfo;
+ worker?: "isolated";
+ /** Catalog models that load it. */
+ models: number;
+ on: boolean;
+}
+
+export interface AccessList {
+ access: ModelAccess;
+ /** Each class with how many models (any of their routes) and library LoRAs it covers. */
+ classes: { id: LicenceClass; label: string; hint: string; models: number; loras: number; on: boolean }[];
+ providers: { id: string; label: string; models: number; on: boolean }[];
+ packs: PackInfo[];
+ models: ModelEntry[];
+ loras: LoraInfo[];
+}
diff --git a/src/server/model-access.ts b/src/server/model-access.ts
index 5a671015..5f23d782 100644
--- a/src/server/model-access.ts
+++ b/src/server/model-access.ts
@@ -1,16 +1,22 @@
import "server-only";
import { 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 type { Engine, LoraRef, ModelDef, ModelRoute } from "@/lib/catalog/types";
import type { ManifestWorkflow } from "@/lib/comfy";
import {
BROWSER_LICENCE,
+ CLASS_HINT,
+ CLASS_LABEL,
+ LICENCE_CLASSES,
llmLicence,
licenceInfo,
loraLicenceInfo,
mergeLicences,
+ NODE_PACKS,
paidApiLicence,
+ PROVIDER_NAME,
workflowLicence,
type LicenceInfo,
} from "@/lib/licences";
@@ -23,8 +29,11 @@ import {
offSwitches,
parseAccess,
routeOff,
+ switchLabel,
type AccessChange,
+ type AccessList,
type AccessSummary,
+ type ModelEntry,
type FactsOf,
type ModelAccess,
} from "@/lib/model-access";
@@ -208,3 +217,77 @@ export function offeredLoras(loras: LoraRef[]): { loras: LoraRef[]; notes: strin
const notes = dropped.length ? [`${dropped.map((d) => loraName({ file: d.file })).join(", ")} ${dropped.length > 1 ? "are" : "is"} left out: turned off in ${ACCESS_PLACE}`] : [];
return { loras: kept, notes, dropped };
}
+
+// ---------------------------------------------------------------------------
+// Settings → Models & licences: everything with its licence and its switch
+
+const isOpenRoute = (r: ModelRoute) => providerEngine(r.provider) === "open";
+
+/** A model's licence as the list shows it: the open half names it, the cloud half is said beside it. */
+export function modelLicence(m: ModelDef): { licence: LicenceInfo; cloud?: LicenceInfo; packs: string[] } {
+ const open = m.routes.filter(isOpenRoute);
+ const cloud = m.routes.filter((r) => !isOpenRoute(r));
+ const packs = [...new Set(open.flatMap((r) => (r.provider === "comfyui" ? comfyFacts(r.endpoint).packs : [])))];
+ const openLicence = open.length ? mergeLicences([...new Map(open.map((r) => [r.endpoint, routeLicence(r, m)])).values()]) : undefined;
+ const cloudRoutes = cloud.filter((r) => r.provider !== "llm");
+ const cloudLicence = cloudRoutes.length ? paidApiLicence(m.vendor, cloudRoutes) : cloud.length ? routeLicence(cloud[0], m) : undefined;
+ if (openLicence) return { licence: openLicence, ...(cloudLicence && { cloud: cloudLicence }), packs };
+ return { licence: cloudLicence ?? { name: "Not recorded", class: "unknown", note: "" }, packs };
+}
+
+export function accessList(): AccessList {
+ const access = readAccess();
+ const models: ModelEntry[] = MODELS.map((m) => {
+ const { licence, cloud, packs } = modelLicence(m);
+ const others = { ...access, models: access.models.filter((x) => x !== m.id) };
+ const off = m.routes.map((r) => routeOff(m, r, others, factsOf)).filter((s): s is NonNullable<typeof s> => !!s);
+ const labels = [...new Set(off.map(switchLabel))];
+ const all = off.length === m.routes.length;
+ return {
+ id: m.id,
+ name: m.name,
+ vendor: m.vendor,
+ kind: m.kind,
+ ...(m.hidden && { hidden: true as const }),
+ engines: m.engines ?? [m.engine],
+ providers: [...new Set(m.routes.map((r) => r.provider))],
+ licence,
+ ...(cloud && { cloud }),
+ packs,
+ on: !access.models.includes(m.id),
+ offBy: all ? labels : [],
+ partly: all ? [] : labels,
+ };
+ });
+ const count = (f: (e: ModelEntry) => boolean) => models.filter(f).length;
+ const routeClasses = (id: string) => {
+ const m = MODELS.find((x) => x.id === id)!;
+ 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) };
+ });
+ return {
+ access,
+ classes: LICENCE_CLASSES.map((id) => ({
+ id,
+ label: CLASS_LABEL[id],
+ hint: CLASS_HINT[id],
+ models: count((e) => classesOf.get(e.id)!.has(id)),
+ loras: loras.filter((l) => l.licence.class === id).length,
+ on: !access.classes.includes(id),
+ })),
+ providers: [...new Set(MODELS.flatMap((m) => m.routes.map((r) => r.provider)))].map((id) => ({
+ id,
+ label: PROVIDER_NAME[id] ?? id,
+ models: count((e) => e.providers.includes(id)),
+ on: !access.providers.includes(id),
+ })),
+ packs: NODE_PACKS.map((p) => ({ ...p, models: count((e) => e.packs.includes(p.name)), on: !access.packs.includes(p.name) })),
+ models,
+ loras,
+ };
+}
diff --git a/tests/model-access-listings.test.ts b/tests/model-access-listings.test.ts
index 1df52b52..bebb53d0 100644
--- a/tests/model-access-listings.test.ts
+++ b/tests/model-access-listings.test.ts
@@ -20,6 +20,7 @@ process.env.OLLAMA_URL = "http://127.0.0.1:9";
const { GET: listModels } = await import("@/app/api/models/route");
const { GET: status } = await import("@/app/api/status/route");
const { POST: postGeneration } = await import("@/app/api/generations/route");
+const settingsRoute = await import("@/app/api/settings/models/route");
const { changeAccess } = await import("@/server/model-access");
const tools = await import("@/server/assist/tools");
const { offlinePlan } = await import("@/server/assist/agent");
@@ -87,4 +88,23 @@ describe("Models & licences in listings and picks", () => {
expect(res.status).toBe(422);
expect(((await res.json()) as { error: string }).error).toMatch(/^FLUX\.1 \[dev\] is turned off in Settings → Models & licences \(Non-commercial is switched off\)/);
});
+
+ 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);
+ 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/);
+ expect(list.classes.find((c) => c.id === "non-commercial")).toMatchObject({ on: true });
+ const put = (changes: unknown) => settingsRoute.PUT(new Request("http://localhost/api/settings/models", { method: "PUT", body: JSON.stringify({ changes }) }));
+ 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);
+ 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);
+ // A model only fal hosts is off by that switch, and says which.
+ expect(after.models.find((m) => m.id === "fal-ai-flux-dev" || (m.providers.length === 1 && m.providers[0] === "fal"))!.offBy).toEqual(["fal.ai is switched off"]);
+ });
});