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.

Merge main into claude/fuobe-r5-batch-7

Claude2c60ade58b62
diff --cc docs/ARCHITECTURE.md
index f58a63bf,f023a182..d0f667e1
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@@ -66,8 -66,8 +66,8 @@@ Feed, Library, studios (React Query cac
| `trainers.generated.ts` | Round 4 part 4. The fal trainers (`HOSTED_TRAINERS`: endpoint, fields, price per step, the output field the LoRA comes back in, licence). **Generated** by `scripts/gen-trainers.py` from `fuobe-originals-recipes-5.json`'s trainers; `training.ts` prices Soul ID from it |
| `studio-packs.generated.ts` | Round 4 part 5. The 14 Photodump / Instadump packs and the 6 Fashion Factory templates (name, photo or shot count, description). **Generated** by `scripts/gen-studio-packs.py` from the research in `higgsfield-image-studios.json`. It replaces `higgsfield-presets.generated.ts`, which went with `higgsfield-models.generated.ts` and their generators (see Retired models); the Soul preset fallback list and `presetPrompt` left `packs.ts` with it |
| `replaced.ts` | Round 4 part 5 (O7). What replaced each retired model, training target and lost operation, pure and browser-safe: `REPLACED_BY` (12 model ids → the model that does the job now, with `was`, the name it ran under, a `note`, and `original`, `ops`, `withReferences` and `director` where they apply), `TRAINING_REPLACED_BY`, `OPS_REPLACED_BY`, `replacedBy`, `currentModelId`, `replacementOf` and `migrateRequest` (see Retired models) |
-| `models.ts` | Open-source models (ComfyUI workflow ids), fal utility models (Join clips, and the hidden Extract frame, Crop to size, Mix voice and music, Level audio, Forced Alignment), the browser-only models (`local` provider: Color Grade, Ad compositor) + the generated cloud lists (whose hidden chain helpers include Trim video, Add soundtrack, Voice timeline and Extract soundtrack). A launch price (`Pricing.promo`) is applied when the list loads (`withCurrentPrice` → `pricingAt`). Since round 4 part 3 `MODELS` starts with the Fuobe Originals: `original()` joins each one's ComfyUI routes to its generated cloud half. Since round 4 part 5 the cloud list is `CLOUD_MODELS` and the cloud tools only (no Higgsfield models or routes are joined, and the hand-written `ai-influencer` is gone), and two hidden open models run Character Swap Studio's graphs: `oss-h3-swap-segment` (`video-swap` on `video-character-swap-h3-segment`) and `oss-h3-person-mask` (`bg-remove-video` on `video-mask-h3-relay`). Since round 5 part 1 `originals` holds the eight new Originals' GPU halves, `oss-video-depth-vda-large` joins the open list, the hidden `oss-face-mosaic` (`face-mosaic` on `image-face-mosaic-sam3`) is the face mosaic's GPU step, and `oss-tryon-klein` carries the try-on LoRA in `ModelOptions.loras`, so its switch governs it |
+| `models.ts` | Open-source models (ComfyUI workflow ids), fal utility models (Join clips, and the hidden Extract frame, Crop to size, Mix voice and music, Level audio, Forced Alignment), the browser-only models (`local` provider: Color Grade, Ad compositor) + the generated cloud lists (whose hidden chain helpers include Trim video, Add soundtrack, Voice timeline and Extract soundtrack). A launch price (`Pricing.promo`) stays beside the list price (see `promo.ts`): the catalog never reads the clock. Since round 4 part 3 `MODELS` starts with the Fuobe Originals: `original()` joins each one's ComfyUI routes to its generated cloud half. Since round 4 part 5 the cloud list is `CLOUD_MODELS` and the cloud tools only (no Higgsfield models or routes are joined, and the hand-written `ai-influencer` is gone), and two hidden open models run Character Swap Studio's graphs: `oss-h3-swap-segment` (`video-swap` on `video-character-swap-h3-segment`) and `oss-h3-person-mask` (`bg-remove-video` on `video-mask-h3-relay`). Since round 5 part 1 `originals` holds the eight new Originals' GPU halves, `oss-video-depth-vda-large` joins the open list, the hidden `oss-face-mosaic` (`face-mosaic` on `image-face-mosaic-sam3`) is the face mosaic's GPU step, and `oss-tryon-klein` carries the try-on LoRA in `ModelOptions.loras`, so its switch governs it |
- | `llm-models.ts` | `text-llm` (cloud: Claude, else Ollama) and `oss-text-llm` (open: Ollama, never Claude; since round 4 its translations run on ComfyUI's Qwen3.5 4B, `oss-qwen35-translate`, when Ollama isn't running), kind `text`, ops `translate` and `write` |
+ | `llm-models.ts` | `text-llm` (cloud: Claude, else a local model) and `oss-text-llm` (open: a local model only, never Claude, route endpoint `ollama`; since round 4 its translations run on ComfyUI's Qwen3.5 4B, `oss-qwen35-translate`, when no local model server is ready), kind `text`, ops `translate` and `write` |
| `elements.ts` | Elements (character / location / prop / style / voice), `@handle` parsing and `applyMentions`; since round 4 part 4 an element holds up to 80 photos (`MAX_ELEMENT_PHOTOS`) and a mention brings its trained LoRA to every model of the LoRA's family on either engine (`identityFor`); since round 4 part 5 an older Soul ID (Higgsfield's `referenceId`) goes to no model; the element shows "Older Soul ID" with "Retrain for Fuobe Soul" (nothing retrains by itself) |
| `sketch.ts` | `applySketch` (masks and drawings → the right operation and inputs) |
| `storyboard.ts` | Storyboard models per engine, scene splitting and frame prompts. Since round 5 part 1 (O13, Popcorn) `planStoryboard` writes each frame's request: Fuobe's open recipe on both engines (`STORYBOARD_MODELS`: in the cloud Z-Image Turbo, or Qwen-Image-Edit 2511 with references, then Qwen-Image-Edit 2509 with the next-scene LoRA, `nextLoras`), Nano Banana Pro as a cloud partner for every frame (`STORYBOARD_PARTNERS`), and a Fuobe Soul look (frame 1 on `fuobe-soul` without references, the look's words on the next frames, `frame.look`; a 21:9 look board made at 16:9 and cropped, `LOOK_CROPPED`) |
diff --cc scripts/comfy/export-templates.mjs
index 32cc44a1,f1888ae4..ef93b45f
--- a/scripts/comfy/export-templates.mjs
+++ b/scripts/comfy/export-templates.mjs
@@@ -22,7 -22,8 +22,7 @@@
import fs from 'node:fs';
import path from 'node:path';
- import { fileURLToPath } from 'node:url';
+ import { fileURLToPath, pathToFileURL } from 'node:url';
-import { chromium } from 'playwright-core';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const COMFYUI_URL = process.env.COMFYUI_URL || 'http://127.0.0.1:8188';
diff --cc src/app/api/audio-tools/route.ts
index 37eb1a09,c5fc1079..c499765b
--- a/src/app/api/audio-tools/route.ts
+++ b/src/app/api/audio-tools/route.ts
@@@ -1,22 -1,20 +1,23 @@@
import { AudioToolBody, AudioToolError, previewAudioTool, runAudioTool } from "@/server/audio-tools";
+ import { priceAs } from "@/server/visitor";
-/** Audio → Loop / extend and Join: start a run; `?preview=1` only plans and prices it. */
+/** What a field that doesn't check out means, in words the page shows. */
+const MESSAGES: Record<string, string> = {
+ media: "Add the audio or video to split",
+ video: "Add the video to put the mix on",
+ audio: "Add the audio to loop",
+ duration: "Pick a length up to 10 minutes",
+ crossfade: "Keep the crossfade between 0 and 10 seconds",
+};
+
+/** Audio → Loop / extend, Join and Split soundtrack (and a split's mix put back on its video): start a run; `?preview=1` only plans and prices it. */
- export async function POST(request: Request) {
+ async function post(request: Request) {
- const parsed = AudioToolBody.safeParse(await request.json().catch(() => null));
+ const raw: unknown = await request.json().catch(() => null);
+ const parsed = AudioToolBody.safeParse(raw);
if (!parsed.success) {
const path = parsed.error.issues[0]?.path.join(".") ?? "";
- const msg = path.startsWith("clips")
- ? "Add 2 to 10 audio clips to join"
- : path === "audio"
- ? "Add the audio to loop"
- : path === "duration"
- ? "Pick a length up to 10 minutes"
- : path === "crossfade"
- ? "Keep the crossfade between 0 and 10 seconds"
- : "Check the settings";
+ const remux = (raw as { tool?: unknown } | null)?.tool === "remux";
+ const msg = path.startsWith("clips") ? "Add 2 to 10 audio clips to join" : remux && path === "audio" ? "Export the mix first" : (MESSAGES[path] ?? "Check the settings");
return Response.json({ error: msg }, { status: 400 });
}
try {
diff --cc src/app/api/models/route.ts
index d3349ba3,e3f45637..f29fd381
--- a/src/app/api/models/route.ts
+++ b/src/app/api/models/route.ts
@@@ -74,12 -76,11 +77,12 @@@ export async function GET(request: Requ
const defaults = Object.fromEntries(
Object.entries(DEFAULTS).map(([k, ids]) => [k, { ...(mode !== "open" && ids.cloud && { cloud: pick(ids.cloud, "cloud") }), ...(mode !== "cloud" && ids.open && { open: pick(ids.open, "open") }) }]),
);
- const demoMode = getSetting("demoMode");
+ const demoMode = visitor ? "off" : getSetting("demoMode");
- return Response.json({
- engineMode: mode,
- demoMode,
- defaults,
- items: list.map((m) => ({ ...toModelInfo(m), connected: visitor || connected(m), runs: visitor ? ("real" as const) : runsAs(m, demoMode) })),
+ // The price of the day asked (a launch price while it lasts); the row keeps the launch price and its last day too.
+ const now = Date.now();
+ const items = list.map((m) => {
+ const info = toModelInfo(m);
- return { ...info, price: rowPrice(info, now), connected: connected(m), runs: runsAs(m, demoMode) };
++ return { ...info, price: rowPrice(info, now), connected: visitor || connected(m), runs: visitor ? ("real" as const) : runsAs(m, demoMode) };
});
+ return Response.json({ engineMode: mode, demoMode, defaults, items });
}
diff --cc src/components/studio/model-picker.tsx
index b6cdccda,9c90977a..2303c426
--- a/src/components/studio/model-picker.tsx
+++ b/src/components/studio/model-picker.tsx
@@@ -6,8 -6,10 +6,11 @@@ import { useMemo, useState } from "reac
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
+ import { RowDot } from "@/components/gpu/readiness-chip";
+ import { badgeFor, useGpuBadges } from "@/hooks/use-gpu";
import { useIsMobile } from "@/hooks/use-mobile";
+import { useToday } from "@/hooks/use-today";
+ import type { Badge as BadgeT } from "@/lib/gpu/types";
import { type Engine, type ModelDef } from "@/lib/catalog/types";
import { useEngineMode, useStatus } from "@/lib/api";
import { bestForStudio, groupModels, toggleIn } from "@/lib/composer";
@@@ -73,16 -83,18 +76,21 @@@ function ModelRow(
selected,
starred,
showEngine,
+ today,
onStar,
+ gpu,
+ gpuName,
}: {
m: ModelDef;
selected: boolean;
starred: boolean;
showEngine: boolean;
+ /** The browser's day: a launch price holds through its last day (null until hydrated: no price shown for one). */
+ today: number | null;
onStar: () => void;
+ /** Its state on the viewer's GPU (the GPU pre-flight). */
+ gpu?: BadgeT | null;
+ gpuName?: string;
}) {
return (
<>
@@@ -236,7 -249,15 +246,16 @@@ function PickerList({ models, value, on
data-checked={value?.id === m.id}
className={cn("gap-2.5 rounded-lg px-2 py-1.5 [&>svg:last-child]:hidden", value?.id === m.id && "bg-brand-faint data-selected:bg-brand-faint-hover")}
>
- <ModelRow m={m} selected={value?.id === m.id} starred={starred.includes(m.id)} showEngine={!!q || m.engine !== engine} today={today} onStar={() => setStarred((s) => toggleIn(s, m.id))} />
+ <ModelRow
+ m={m}
+ selected={value?.id === m.id}
+ starred={starred.includes(m.id)}
+ showEngine={!!q || m.engine !== engine}
++ today={today}
+ onStar={() => setStarred((s) => toggleIn(s, m.id))}
+ gpu={m.engine === "open" ? badgeFor(badges, { modelId: m.id }) : null}
+ gpuName={badges?.gpu}
+ />
</CommandItem>
))}
</CommandGroup>
diff --cc src/server/providers/comfyui.ts
index 6bbfb376,7c25efbd..7f1f6547
--- a/src/server/providers/comfyui.ts
+++ b/src/server/providers/comfyui.ts
@@@ -36,11 -36,13 +37,14 @@@ import
type ManifestWorkflow,
} from "@/lib/comfy";
import { fpsPlan } from "@/lib/av/fps";
+ import { resolveWorkflowId } from "@/lib/comfy-variants";
+ import { fixFromPromptError } from "@/lib/gpu/fix-codes";
+ import { loadIndex } from "../gpu/index-file";
import { crossfadeProblem, fadeCurveWav } from "@/lib/av/crossfade";
+import { dbsChannelsFor, dbsModelFor, dbsSurroundBed, installedDbs, surroundSource, type DbsModel } from "@/lib/av/split";
import { expandAudioJoinWorkflow, expandVideoJoinWorkflow } from "@/lib/av/joins";
import { expandTimelineWorkflow, readTimeline } from "@/lib/av/timeline";
- import { exportValues, exrWorkflow, framesPerPass, hdrColorSpace, upscaleShortSide, wholeClipProblem, wholeClipTool } from "@/lib/av/video-finish";
+ import { exportValues, framesPerPass, hdrColorSpace, upscaleShortSide, wholeClipProblem, wholeClipTool } from "@/lib/av/video-finish";
import { guessKind } from "@/lib/catalog/payload";
import { loraByFile, needsToken } from "@/lib/catalog/loras";
import { CHARACTER_SWAP, packResolution, samCoords, swapPrompt, SWAP_LORAS, windowPlan } from "@/lib/catalog/character-swap";
@@@ -451,51 -509,9 +511,52 @@@ export async function probeComfy(force
return sharedCheck("comfy", url, () => checkComfy(url));
}
+declare global {
+ /** The torch device each ComfyUI address reported last (GET /system_stats devices[0].type), and when. */
+ var __fuobeComfyDevice: Map<string, { type?: string; at: number }> | undefined;
+}
+
+/**
+ * The connected ComfyUI's first torch device type ("cuda" for NVIDIA and ROCm, "cpu", "mps"…), from GET /system_stats
+ * (devices[0], as Settings' test reads it), kept for a minute; undefined when the server doesn't say or can't be reached.
+ */
+export async function comfyDevice(worker: ComfyWorker = "main"): Promise<string | undefined> {
+ const url = baseUrl(worker);
+ if (!url) return undefined;
+ const cache = (globalThis.__fuobeComfyDevice ??= new Map());
+ const hit = cache.get(url);
+ if (hit && Date.now() - hit.at < 60_000) return hit.type;
+ const s = await comfyJson<{ devices?: { type?: unknown }[] }>("/system_stats", worker).catch(() => undefined);
+ const type = typeof s?.devices?.[0]?.type === "string" ? (s.devices[0].type as string) : undefined;
+ if (s) cache.set(url, { type, at: Date.now() });
+ return type;
+}
+
+declare global {
+ /** The DBS models each ComfyUI address listed last (GET /models/dbs), and when. */
+ var __fuobeComfyDbs: Map<string, { models?: DbsModel[]; at: number }> | undefined;
+}
+
+/**
+ * The DBS models the connected ComfyUI has on disk (GET /models/dbs, which ComfyUI-DBS registers: both files of a
+ * model, or it isn't there), at most `maxAgeMs` old; undefined when the server can't say (unreachable, or the pack
+ * isn't loaded, so there is no dbs folder).
+ */
+export async function comfyDbsModels(worker: ComfyWorker = "main", maxAgeMs = 10_000): Promise<DbsModel[] | undefined> {
+ const url = baseUrl(worker);
+ if (!url) return undefined;
+ const cache = (globalThis.__fuobeComfyDbs ??= new Map());
+ const hit = cache.get(url);
+ if (hit && Date.now() - hit.at < maxAgeMs) return hit.models;
+ const files = await comfyJson<unknown>("/models/dbs", worker).catch(() => undefined);
+ const models = Array.isArray(files) ? installedDbs(files.filter((f): f is string => typeof f === "string")) : undefined;
+ cache.set(url, { models, at: Date.now() });
+ return models;
+}
+
/** The connected ComfyUI's RAM in bytes, as the last reachability check read it (whole-clip tools' budget). */
export function comfyRam(): number | undefined {
+ if (ownGpu()) return undefined;
const cur = globalThis.__fuobeComfyReach;
return cur?.ok && cur.url === baseUrl() ? cur.ram : undefined;
}