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: every page quotes the same model counts

Adarsh372231a503a2
diff --git a/src/app/(studio)/models/page.tsx b/src/app/(studio)/models/page.tsx
index a7a8a8ad..77bf08bc 100644
--- a/src/app/(studio)/models/page.tsx
+++ b/src/app/(studio)/models/page.tsx
@@ -1,14 +1,18 @@
import type { Metadata } from "next";
import { PageHeader, PageShell } from "@/components/page-shell";
import { ModelsIntro, ModelsTable } from "@/components/models-table";
-import { MODELS } from "@/lib/catalog";
+import { isListed, MODELS } from "@/lib/catalog";
import { toModelRow } from "@/lib/model-rows";
import { modelHref } from "@/lib/palette-index";
export const metadata: Metadata = { title: "Models" };
-/** Each row opens where its model runs; a model no studio offers has nowhere else to go (its link is this page). */
-const ROWS = MODELS.map((m) => {
+/**
+ * Each row opens where its model runs; a model no studio offers has nowhere else to go (its link is this page). The
+ * models a visitor can pick, as Home and Project status count them (modelCounts): a hidden step a preset or a tool
+ * runs (trim, join, a self-test) isn't one.
+ */
+const ROWS = MODELS.filter(isListed).map((m) => {
const href = modelHref(m);
return { ...toModelRow(m), ...(!href.startsWith("/models") && { href }) };
});
diff --git a/src/app/(studio)/settings/about/page.tsx b/src/app/(studio)/settings/about/page.tsx
index dbd5d656..8970c67f 100644
--- a/src/app/(studio)/settings/about/page.tsx
+++ b/src/app/(studio)/settings/about/page.tsx
@@ -5,7 +5,7 @@ import type { Metadata } from "next";
import Link from "next/link";
import { LicencesView } from "@/components/licences-view";
import { PageHeader, PageShell } from "@/components/page-shell";
-import { MODELS } from "@/lib/catalog";
+import { MODELS, modelCounts } from "@/lib/catalog";
import type { Manifest } from "@/lib/comfy";
import { FUOBE_REPO } from "@/lib/connections";
import { ATTRIBUTIONS, buildLicenceList } from "@/lib/licences";
@@ -54,7 +54,8 @@ function Fact({ label, children }: { label: string; children: React.ReactNode })
export default async function Page() {
const about = await readAbout();
const { list } = about;
- const inStudios = list.rows.filter((r) => r.inCatalog).length;
+ const library = list.rows.filter((r) => !r.inCatalog).length;
+ const models = modelCounts();
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">
@@ -135,8 +136,8 @@ export default async function Page() {
Open model licences
</h2>
<p className="mt-1 mb-5 max-w-2xl text-[13px] text-muted-foreground">
- {list.counts.all} open models with weights of their own: {inStudios} in Fuobe&apos;s studios and {list.counts.all - inStudios} more workflows in the library (tools with no weights
- aren&apos;t counted). {list.counts.clear} allow commercial use, {list.counts.conditions} with conditions (revenue limits or use rules), {list.counts["non-commercial"]} non-commercial
+ Fuobe&apos;s studios offer {models.open} open-source models. Below is the licence of every set of open weights Fuobe runs: theirs, the helper steps its presets run
+ and {library} more workflows in the library, {list.counts.all} in all (tools with no weights aren&apos;t listed). {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. Which models this install offers
is set in{" "}
<Link href="/settings/models" className="text-brand-text underline underline-offset-2">
diff --git a/src/app/(studio)/status/page.tsx b/src/app/(studio)/status/page.tsx
index d53117d3..2c1caca2 100644
--- a/src/app/(studio)/status/page.tsx
+++ b/src/app/(studio)/status/page.tsx
@@ -6,8 +6,7 @@ import Link from "next/link";
import ReactMarkdown, { type Components } from "react-markdown";
import remarkGfm from "remark-gfm";
import { PageHeader, PageShell } from "@/components/page-shell";
-import { MODELS } from "@/lib/catalog";
-import { enginesOf } from "@/lib/catalog/engines";
+import { modelCounts } from "@/lib/catalog";
import type { Manifest } from "@/lib/comfy";
import { FUOBE_REPO } from "@/lib/connections";
import { headingId, STATUS_ON_GITHUB, statusBody, statusDate, statusLink, statusOutline } from "@/lib/status-page";
@@ -66,9 +65,8 @@ const link = "text-brand-text underline underline-offset-2";
export default async function Page() {
const [md, workflows] = await Promise.all([readStatus(), readWorkflows()]);
- const open = MODELS.filter((m) => enginesOf(m).includes("open")).length;
- // Models with no open-source route: a self-hosted studio runs them with its own key.
- const cloudOnly = MODELS.filter((m) => !enginesOf(m).includes("open")).length;
+ // The same numbers as Home and /models: models a visitor can pick, each once.
+ const models = modelCounts();
const updated = statusDate(md);
const outline = statusOutline(md);
return (
@@ -87,9 +85,9 @@ export default async function Page() {
</Fact>
<Fact label="Models">
<Link href="/models" className={link}>
- {open} open-source
+ {models.open} open-source
</Link>
- <span className="text-muted-foreground"> · {cloudOnly} more with a fal.ai or Replicate key</span>
+ <span className="text-muted-foreground"> · {models.cloud} more with a fal.ai or Replicate key</span>
</Fact>
<Fact label="Licence">
<a href={`${FUOBE_REPO}/blob/main/LICENSE`} target="_blank" rel="noreferrer" className={link}>
diff --git a/src/lib/catalog/counts.ts b/src/lib/catalog/counts.ts
new file mode 100644
index 00000000..bdbef594
--- /dev/null
+++ b/src/lib/catalog/counts.ts
@@ -0,0 +1,32 @@
+/**
+ * How many models Fuobe has, as every page quotes it (Home, /models, Project status, About & licences).
+ *
+ * The rule:
+ * - A model counts when a visitor can pick it: it is listed in a studio's picker, on /models and in the ⌘K palette.
+ * A hidden model is a step a preset or a tool runs for you (trim a clip, join two clips, a self-test, a relight
+ * LoRA an app uses): it is part of what it serves, never picked on its own, so it isn't counted.
+ * - `open`: the models that run on the open engine (ComfyUI on your own GPU). A Fuobe Original runs on both engines
+ * and counts here, once.
+ * - `cloud`: the models that run only in the cloud, through your own fal.ai or Replicate key (the partner models).
+ * - `all`: open + cloud, so every pickable model counts exactly once.
+ *
+ * The licence list on About & licences is a different count (one row per set of open weights, helper steps and
+ * library workflows included); the page says so next to it.
+ */
+import { runsOn } from "./engines";
+import type { ModelDef } from "./types";
+
+export interface ModelCounts {
+ open: number;
+ cloud: number;
+ all: number;
+}
+
+/** A model a visitor can pick (not a hidden step a preset or a tool runs). */
+export const isListed = (m: Pick<ModelDef, "hidden">): boolean => !m.hidden;
+
+export function countModels(models: readonly Pick<ModelDef, "hidden" | "engine" | "engines">[]): ModelCounts {
+ const listed = models.filter(isListed);
+ const open = listed.filter((m) => runsOn(m, "open")).length;
+ return { open, cloud: listed.length - open, all: listed.length };
+}
diff --git a/src/lib/catalog/index.ts b/src/lib/catalog/index.ts
index 41a0f232..441a5ade 100644
--- a/src/lib/catalog/index.ts
+++ b/src/lib/catalog/index.ts
@@ -1,4 +1,5 @@
import { APP_ALIASES, APPS as RAW_APPS } from "./apps";
+import { countModels, isListed, type ModelCounts } from "./counts";
import { EFFECTS as RAW_EFFECTS, MOTIONS as RAW_MOTIONS } from "./motions";
import { MODELS } from "./models";
import { LLM_MODELS } from "./llm-models";
@@ -9,6 +10,10 @@ import type { Engine, MediaKind, ModelDef, Operation, Preset } from "./types";
MODELS.push(...LLM_MODELS.filter((m) => !MODELS.some((x) => x.id === m.id))); // text steps (translate, write) on the configured LLM; once per hot reload
export { MODELS };
+export { isListed, type ModelCounts };
+
+/** The model counts every page quotes (what counts: src/lib/catalog/counts.ts). */
+export const modelCounts = (): ModelCounts => countModels(MODELS);
const modelIndex = new Map(MODELS.map((m) => [m.id, m]));
/**
diff --git a/src/lib/home-showcase.ts b/src/lib/home-showcase.ts
index 97d75403..ecca4072 100644
--- a/src/lib/home-showcase.ts
+++ b/src/lib/home-showcase.ts
@@ -8,14 +8,13 @@ import fs from "node:fs/promises";
import path from "node:path";
import type { BeforeAfterStill } from "@/components/home/before-after";
import { NAV } from "@/components/nav-items";
-import { APPS, EFFECTS, MODELS, MOTIONS, getPreset } from "@/lib/catalog";
+import { APPS, EFFECTS, MODELS, MOTIONS, getPreset, isListed, modelCounts } from "@/lib/catalog";
import { CAMERA_MOVES } from "@/lib/catalog/cinema";
import { LLM_PROVIDERS } from "@/lib/catalog/llm-providers";
import { TEMPLATES } from "@/lib/catalog/marketing";
import type { ModelDef } from "@/lib/catalog/types";
import type { Manifest } from "@/lib/comfy";
import { HUB_MODES } from "@/lib/hubs";
-import { buildLicenceList } from "@/lib/licences";
import { modelHref } from "@/lib/palette-index";
import { cacheLife } from "next/cache";
import { toPresetCard } from "@/lib/preset-card-data";
@@ -161,11 +160,11 @@ export const HOME_TRY = [
] as const;
export interface HomeFacts {
- /** Open models with their ComfyUI workflow and licence (About & licences' count). */
+ /** Models a visitor can pick that run on their own GPU (modelCounts().open). */
openModels: number;
workflows: number;
originals: number;
- /** Paid models through the viewer's own fal.ai or Replicate key. */
+ /** Models that run only in the cloud, through the viewer's own fal.ai or Replicate key (modelCounts().cloud). */
partners: number;
presets: number;
apps: number;
@@ -271,16 +270,13 @@ export async function homeShowcase() {
readSkills(),
]);
const workflows = manifest?.workflows ?? [];
- const licences = buildLicenceList(
- MODELS.map((m) => ({ id: m.id, name: m.name, vendor: m.vendor, kind: m.kind, hidden: m.hidden, routes: m.routes.map((r) => ({ provider: r.provider, endpoint: r.endpoint })) })),
- workflows.map((w) => ({ id: w.id, title: w.title, capability: w.capability, license: w.license, models: w.models.map((m) => ({ url: m.url, sizeGb: m.sizeGb })) })),
- );
- const visible = MODELS.filter((m) => !m.hidden);
+ const visible = MODELS.filter(isListed);
+ const counts = modelCounts();
const facts: HomeFacts = {
- openModels: licences.counts.all,
+ openModels: counts.open,
workflows: workflows.length,
originals: visible.filter((m) => m.vendor === "Fuobe Original").length,
- partners: visible.filter((m) => !isOpen(m)).length,
+ partners: counts.cloud,
presets: APPS.length + MOTIONS.length + EFFECTS.length,
apps: APPS.length,
motions: MOTIONS.length,
diff --git a/tests/home-showcase.test.ts b/tests/home-showcase.test.ts
index 70443ad6..e819ff1d 100644
--- a/tests/home-showcase.test.ts
+++ b/tests/home-showcase.test.ts
@@ -2,13 +2,12 @@ import fs from "node:fs";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import { NAV } from "@/components/nav-items";
-import { APPS, EFFECTS, MODELS, MOTIONS, getPreset } from "@/lib/catalog";
+import { APPS, EFFECTS, MODELS, MOTIONS, getPreset, modelCounts } from "@/lib/catalog";
import { CAMERA_MOVES } from "@/lib/catalog/cinema";
import { LLM_PROVIDERS } from "@/lib/catalog/llm-providers";
import { TEMPLATES } from "@/lib/catalog/marketing";
import { ASSIST_PROMPT_MAX, ASSIST_SUGGESTIONS, assistDraft } from "@/lib/assist";
import { HUB_MODES } from "@/lib/hubs";
-import { buildLicenceList, type LicenceWorkflowInput } from "@/lib/licences";
import {
HOME_BEFORE_AFTER,
HOME_CAPTION_MAX,
@@ -180,26 +179,21 @@ describe("Home's showcase", () => {
it("quotes the catalog's own numbers", async () => {
const { facts, studios, audioTools } = await homeShowcase();
const visible = MODELS.filter((m) => !m.hidden);
- const open = (m: (typeof MODELS)[number]) => m.engine === "open" || !!m.engines?.includes("open");
- const manifest = JSON.parse(fs.readFileSync(path.join(root, "workflows", "comfyui", "manifest.json"), "utf8")) as { workflows: LicenceWorkflowInput[] };
+ const manifest = JSON.parse(fs.readFileSync(path.join(root, "workflows", "comfyui", "manifest.json"), "utf8")) as { workflows: unknown[] };
expect(facts.workflows).toBe(manifest.workflows.length);
expect(facts.presets).toBe(APPS.length + MOTIONS.length + EFFECTS.length);
expect([facts.apps, facts.motions, facts.effects]).toEqual([APPS.length, MOTIONS.length, EFFECTS.length]);
expect(facts.originals).toBe(visible.filter((m) => m.vendor === "Fuobe Original").length);
expect(facts.originals).toBeGreaterThan(0);
+ // The open and partner models are the counts every page quotes (modelCounts: Home, /models, Project status, About).
+ expect(facts.openModels).toBe(modelCounts().open);
+ expect(facts.partners).toBe(modelCounts().cloud);
expect(facts.partners).toBe(visible.filter((m) => m.engine === "cloud" && !m.engines?.includes("open")).length);
expect(facts.cinemaMoves).toBe(CAMERA_MOVES.length);
expect(facts.adTemplates).toBe(TEMPLATES.length);
expect(facts.mixedLooks).toBe(EFFECTS.filter((e) => e.category === "Mixed Media").length);
expect(facts.audioTools).toBe(HUB_MODES.audio.length);
expect(facts.skills).toBe(fs.readdirSync(path.join(root, "skills")).filter((d) => fs.existsSync(path.join(root, "skills", d, "SKILL.md"))).length);
- // The open models are About & licences' count (src/app/(studio)/settings/about/page.tsx): one row per model or graph with weights.
- const about = buildLicenceList(
- MODELS.map((m) => ({ id: m.id, name: m.name, vendor: m.vendor, kind: m.kind, hidden: m.hidden, routes: m.routes.map((r) => ({ provider: r.provider, endpoint: r.endpoint })) })),
- manifest.workflows,
- );
- expect(facts.openModels).toBe(about.counts.all);
- expect(facts.openModels).toBeGreaterThan(visible.filter((m) => open(m)).length / 2);
// The studio cards' lines carry them.
expect(studios.find((s) => s.href === "/cinema")?.line).toContain(`${facts.cinemaMoves} moves`);
expect(studios.find((s) => s.href === "/marketing")?.line).toContain(`${facts.adTemplates} ad templates`);
diff --git a/tests/model-counts.test.ts b/tests/model-counts.test.ts
new file mode 100644
index 00000000..858d7020
--- /dev/null
+++ b/tests/model-counts.test.ts
@@ -0,0 +1,57 @@
+import fs from "node:fs";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+import { MODELS, modelCounts } from "@/lib/catalog";
+import { countModels } from "@/lib/catalog/counts";
+import { runsOn } from "@/lib/catalog/engines";
+import type { ModelDef } from "@/lib/catalog/types";
+import { paletteIndex } from "@/lib/palette-index";
+
+/*
+ * One model count for every page (src/lib/catalog/counts.ts): the models a visitor can pick, each once. Home, /models,
+ * Project status and About & licences all read it, so their numbers match.
+ */
+const root = path.resolve(__dirname, "..");
+const read = (file: string) => fs.readFileSync(path.join(root, file), "utf8");
+
+describe("model counts", () => {
+ it("counts each pickable model once: open (Originals included) plus cloud only", () => {
+ const counts = modelCounts();
+ const listed = MODELS.filter((m) => !m.hidden);
+ expect(counts.all).toBe(listed.length);
+ expect(counts.open + counts.cloud).toBe(counts.all);
+ expect(counts.open).toBe(listed.filter((m) => runsOn(m, "open")).length);
+ expect(counts.cloud).toBe(listed.filter((m) => !runsOn(m, "open")).length);
+ // The ⌘K palette lists the same models.
+ expect(paletteIndex().models).toHaveLength(counts.all);
+ });
+
+ it("leaves out the hidden steps presets and tools run, and counts an Original once", () => {
+ const m = (id: string, engine: "open" | "cloud", extra: Partial<ModelDef> = {}) => ({ id, engine, ...extra });
+ expect(
+ countModels([
+ m("a", "open"),
+ m("b", "cloud"),
+ m("original", "open", { engines: ["open", "cloud"] }),
+ m("trim", "cloud", { hidden: true }),
+ m("join", "open", { hidden: true }),
+ ]),
+ ).toEqual({ open: 2, cloud: 1, all: 3 });
+ // The catalog has hidden steps on both engines, so the rule matters.
+ expect(MODELS.some((x) => x.hidden && x.engine === "open")).toBe(true);
+ expect(MODELS.some((x) => x.hidden && x.engine === "cloud")).toBe(true);
+ });
+
+ it("is the count Home, /models, Project status and About quote", () => {
+ expect(read("src/lib/home-showcase.ts")).toMatch(/modelCounts\(\)/);
+ expect(read("src/app/(studio)/status/page.tsx")).toMatch(/modelCounts\(\)/);
+ expect(read("src/app/(studio)/settings/about/page.tsx")).toMatch(/modelCounts\(\)/);
+ // /models lists the same models the counts count.
+ expect(read("src/app/(studio)/models/page.tsx")).toMatch(/MODELS\.filter\(isListed\)/);
+ // No page counts the catalog on its own.
+ for (const file of ["src/app/(studio)/status/page.tsx", "src/app/(studio)/settings/about/page.tsx", "src/lib/home-showcase.ts"]) {
+ expect(read(file), file).not.toMatch(/MODELS\.filter\([^)]*enginesOf/);
+ expect(read(file), file).not.toMatch(/openModels: licences/);
+ }
+ });
+});