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.

Placeholder results: off by default, and a run with nothing connected opens the connect card

Adarsh1a183b2cc14c
diff --git a/.agents/skills/fuobe/SKILL.md b/.agents/skills/fuobe/SKILL.md
index 446e3124..c49c5269 100644
--- a/.agents/skills/fuobe/SKILL.md
+++ b/.agents/skills/fuobe/SKILL.md
@@ -38,7 +38,7 @@ Open models cost nothing but GPU time; cloud models are billed by the user's pro
- CLI: `fuobe estimate "<prompt>" --model <id> …`, then
`fuobe generate "<prompt>" --model <id> --image ./photo.png --aspect 16:9 --duration 5 --out ./renders --json`
(`--out` waits and saves the files; `--wait` waits and prints the URLs).
-- A result marked demo means no provider is connected for that model, or Demo mode is on: say it's
+- A result marked demo means Settings → Placeholder results is on (for a tour): say it's
placeholder media.
## 4. Files
diff --git a/README.md b/README.md
index fb158731..b429dcad 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,7 @@ pnpm install
pnpm dev # http://localhost:3000 (production: pnpm build && pnpm start)
```
-Open **Settings → Engine mode** and connect what you have: a ComfyUI server, a fal.ai or Replicate key, or nothing at all. Demo mode lets you click through every tool with labelled placeholder outputs.
+Open **Settings → Engine mode** and connect what you have: a ComfyUI server, a fal.ai or Replicate key, or nothing at all. With nothing connected, a run asks you to connect one. To give a tour without keys or a GPU, turn on **Settings → Show placeholder results (for a tour)**: every run then makes a labelled placeholder.
**Requirements:** Windows, macOS or Linux · Node 22+ · pnpm · for the open engine, a GPU running ComfyUI (24 GB of VRAM covers almost every workflow). On Windows, `start.bat` installs and starts everything for you.
diff --git a/bin/lib/commands.mjs b/bin/lib/commands.mjs
index 21cd6938..c02b9193 100644
--- a/bin/lib/commands.mjs
+++ b/bin/lib/commands.mjs
@@ -403,7 +403,7 @@ async function models(ctx) {
ctx.print(`No models match.${res.engineMode !== "both" ? ` This Fuobe runs ${res.engineMode === "open" ? "open-source" : "cloud"} models only (Settings → Engine mode).` : ""}`);
return EXIT.ok;
}
- // How a run goes today (Settings → Demo mode decides with the providers); an older server only says `connected`.
+ // How a run goes today (Settings → placeholder results decide with the providers); an older server only says `connected`.
const runs = (m) => m.runs ?? (m.connected ? "real" : "demo");
const mark = { real: "", demo: " (demo)", refused: " (not set up)" };
// A Fuobe Original runs on both engines (open+cloud); --engine lists it as that engine's model.
@@ -411,9 +411,9 @@ async function models(ctx) {
ctx.print(table(["ID", "NAME", "ENGINE", "PRICE", "DOES"], rows, ctx.io.columns));
const count = (r) => items.filter((m) => runs(m) === r).length;
const notes = [`${items.length} model${items.length === 1 ? "" : "s"}${items.length < res.items.length ? ` of ${res.items.length}` : ""}.`];
- if (res.demoMode === "on") notes.push("Demo mode is on (Settings → Demo mode): every run returns demo media, for free.");
- else if (count("demo")) notes.push("Those marked (demo) have no provider set up here yet: they return demo media, for free.");
- if (count("refused")) notes.push("Those marked (not set up) need their provider set up in Settings first (Demo mode is off, so they won't run as a demo).");
+ if (res.demoMode === "on") notes.push("Placeholder results are on (Settings → Placeholder results): every run returns placeholder media, for free.");
+ else if (count("demo")) notes.push("Those marked (demo) return placeholder media, for free.");
+ if (count("refused")) notes.push("Those marked (not set up) need their provider set up in Settings first.");
ctx.note(notes.join(" "));
return EXIT.ok;
}
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 8a37f335..43a60afa 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -28,7 +28,7 @@ Composer / studio (React) ──POST /api/generations (or a studio route that bu
chooseRoute() among the routes still on (offeredRoutes()): first configured provider for that operation, preferring one that carries
│ every LoRA and makes the clip length asked (Preferred provider sets
│ fal/Replicate order otherwise; "llm" for text steps), else the demo
- │ provider (Settings → Demo mode; request.demo, a skill's free dry run, forces it)
+ │ provider (Settings → Placeholder results; request.demo, a skill's free dry run, forces it)
fitLoras() src/lib/catalog/loras.ts: LoRAs a cloud run can't carry are left out, with notes
│ (a recipe LoRA the model always loads, left out or switched off, refuses the run instead)
▼
@@ -521,7 +521,7 @@ Liner-inspired shell (pale frame, rounded inset sheet, 13px sidebar rows, serif
- **Shell (round 4).** "Skip to content" is the first Tab stop, the sidebar is a `<nav aria-label="Main">`, and each page has one `<main>`. Full-screen studios (`fullScreenStudio()` in `nav.ts`: a Cinema, Canvas or Layers project, and every Assist page) fold the sidebar to its icon rail without touching the remembered choice: only `SidebarShell` writes the sidebar cookie, and only when that choice changes (`persistOpen` on `SidebarProvider`). Phones get a header with the menu and Search on gallery and settings pages (`phone-bar.tsx`). `intent-link.tsx` prefetches a link on hover or focus instead of when it appears on screen (rows marked `eager` still prefetch on view). Shortcut labels show ⌘ on Apple devices and Ctrl elsewhere (`src/lib/keys.ts`). Every Copy button goes through `copyText` (`src/lib/clipboard.ts`), so copying works on plain-http LAN addresses. Since round 5 part 1 `StudioChrome` (`app-sidebar.tsx`) wraps the shell in `SkillBuilderProvider` (see Skills that run by themselves).
- **Command palette** (`command-palette.tsx`, ⌘K / Ctrl+K, also the sidebar's Search row and the phone header's Search): pages, Settings sections, apps, camera motions, effects, models (filtered by engine mode, and since round 4 part 4 by Settings → Models & licences through the access summary) and recent creations, ranked with typo tolerance in `src/lib/command-search.ts`. The catalog part is `GET /api/search-index`, a static, prerendered slim index built by `paletteIndex()` in `src/lib/palette-index.ts` and fetched the first time the palette opens. `modelHref()` opens a model where it runs (a studio with `?model=`, a Video tools mode, Image to 3D, an app, Layers, Captions / Trim / Translate), else the Models page filtered by `?q=`; the round-4 tools (Remove object, Genjutsu, FPS Boost, SDR to HDR, Export, the 3D scene) aren't in its lists yet, so their models open the Models page. Since round 4 part 3 every Image to 3D model and Meshy Rigging open `/image-to-3d`, and a Fuobe Original is listed once with both engines. Since round 4 part 4 it also lists "Models & licences" (`/settings/models`) and "Assist connectors". Since round 5 part 1 a "Run a skill" group lists "Run <skill>…" for every enabled recipe skill (`skillEntries`), and Settings lists "Training (AI-Toolkit)". It replaces `global-shortcuts.tsx` (⌘K used to go Home).
- **Home** (`src/app/(studio)/page.tsx`): `homeShowcase()` in `src/lib/home-showcase.ts` (server only, `"use cache"`) names the presets, studios, models and skills Home shows and computes every number it quotes from the catalog, the ComfyUI manifest (About & licences' count), the skills folder and `LLM_PROVIDERS`; `tests/home-showcase.test.ts` checks each id has its cover and clip, shows once, and each number is the catalog's. `HomeView` keeps the composer and renders the wall right under it; the sections below (`components/home/home-sections.tsx`) are server components passed as children, with small client islands (`showcase-tile.tsx`, `before-after.tsx`, `home-islands.tsx`). Effect and app cards rest on their clip's peak frame (`public/previews/presets/peak/`, `preset-peaks.generated.ts`, cut by `scripts/gen-preset-peaks.mjs` from the published clips) and their clip starts from that frame (`PresetPreview`'s `rest`). The before/after under Apps shows each app's HD stills (`public/previews/presets/ba/1280/`, `ba/960/` and `ba/512/`, `preset-before-after.generated.ts`, made by `scripts/gen-before-after.mjs` from the reveal clips' masters for every app whose cover is one): each picture starts as its 512 px still, and the browser then picks the 960 or 1280 px copy the screen needs (`srcset`; a 1x desktop or 2x phone the 960, a 2x desktop or 3x phone the 1280), added only once the slider comes within a screen of view and the page has loaded, so it never competes with the page's first paint. The playback store gained `auto: "touch"` (studio cards wait for a hover where one is possible) and `paused` (Pause previews, kept in localStorage under `fuobe:previews`). Assist reads `?prompt=` into a new chat without sending it (`assistDraft`).
-- **Getting started and connections.** `get-started.tsx` is the first-run guide under Home's composer and at the top of Settings (Use paid models, Use your GPU, Just try it), shown until `onboarded` is set (`showFirstRun`, `FIRST_RUN_SCRIPT` in `src/lib/connections.ts`). Every connection field in Settings is a `ConnectField` (`connect-field.tsx`): Save & test sends the typed value to `POST /api/providers/test` (`{provider, value | values, field}`; the old `{provider}` body still works) and saves it only when the test passes, with a "Save anyway" link. `settings-form.tsx` has a status strip with one chip per connection (`connectionSummary`); since round 4 part 2 it has a LoRAs section (`#loras`, `lora-settings.tsx`: the LoRA folder, the civitai key with Save & test, and the library with licences and Download buttons), which the command palette also lists. `/settings/about` (`licences-view.tsx`, `src/lib/licences.ts`) lists each open model's licence from the catalog and the workflow manifest, read at build time, and since round 4 part 4 links to Settings → Models & licences (`/settings/models`, `model-access-view.tsx`: the switches; see Models & licences). Round 4 part 4 also adds a Models & licences section and Assist · connectors (`#assist-connectors`, `components/assist/connectors-settings.tsx`) to `settings-form.tsx`. Round 4 part 5 drops the Higgsfield key field and chip and the "Higgsfield first" Preferred provider (`PROVIDER_SETTINGS`, `CLOUD_PROVIDERS` and `connectionSummary` in `src/lib/connections.ts`). Round 5 part 1 adds Training · AI-Toolkit (`#training`: three `ConnectField`s tested as provider `ai-toolkit`), retitles the LoRAs section "LoRAs · looks, motions, effects and adapters" with an Adapters tab, and (fixes-5) makes every "Settings → …" message and `/settings#…` link name a section that exists, which `tests/settings-links.test.ts` enforces.
+- **Getting started and connections.** `get-started.tsx` is the first-run guide under Home's composer and at the top of Settings (Use paid models, Use your GPU; no demo card: placeholder results are a Settings switch, for a tour), shown until `onboarded` is set (`showFirstRun`, `FIRST_RUN_SCRIPT` in `src/lib/connections.ts`). Every connection field in Settings is a `ConnectField` (`connect-field.tsx`): Save & test sends the typed value to `POST /api/providers/test` (`{provider, value | values, field}`; the old `{provider}` body still works) and saves it only when the test passes, with a "Save anyway" link. `settings-form.tsx` has a status strip with one chip per connection (`connectionSummary`); since round 4 part 2 it has a LoRAs section (`#loras`, `lora-settings.tsx`: the LoRA folder, the civitai key with Save & test, and the library with licences and Download buttons), which the command palette also lists. `/settings/about` (`licences-view.tsx`, `src/lib/licences.ts`) lists each open model's licence from the catalog and the workflow manifest, read at build time, and since round 4 part 4 links to Settings → Models & licences (`/settings/models`, `model-access-view.tsx`: the switches; see Models & licences). Round 4 part 4 also adds a Models & licences section and Assist · connectors (`#assist-connectors`, `components/assist/connectors-settings.tsx`) to `settings-form.tsx`. Round 4 part 5 drops the Higgsfield key field and chip and the "Higgsfield first" Preferred provider (`PROVIDER_SETTINGS`, `CLOUD_PROVIDERS` and `connectionSummary` in `src/lib/connections.ts`). Round 5 part 1 adds Training · AI-Toolkit (`#training`: three `ConnectField`s tested as provider `ai-toolkit`), retitles the LoRAs section "LoRAs · looks, motions, effects and adapters" with an Adapters tab, and (fixes-5) makes every "Settings → …" message and `/settings#…` link name a section that exists, which `tests/settings-links.test.ts` enforces.
- **Studio pages** render `<Studio config>` (`src/components/studio/studio.tsx`), a server component that passes `studioCatalog(config)` from `src/lib/studio-catalog.ts`: the studio's models without provider field maps. Inside, `CatalogProvider` / `useCatalog()` resolve models; `loadFullCatalog()` imports `@/lib/catalog` lazily for motions, effects, `?preset=` and unknown ids. Client components under `studio/` must not import `@/lib/catalog` or `@/lib/studios`. `StudioPage` renders the same tree in the static shell and after hydration; hand-off params merge into the draft with `mergeHandoff`. `StudioConfig` (`studio-context.tsx`) gained `pickerOps`, `anyOf`, `signature` and `extraModels`, and in round 4 `frames` (Frames mode), `comfyOnly` (a tool that runs only on ComfyUI, with a note and an alternative) and `related` (a link under the hero). `HandoffSync` in `studio-page.tsx` also runs Home's Start: Home issues a one-time token (`issueStartToken` in `src/lib/composer.ts`, kept in sessionStorage) and opens the studio with `?prompt=…&go=<token>`; the studio submits once if `claimStartToken` accepts it, so a link from elsewhere can't start a run. A `?model=` that names the other engine's model switches the remembered engine; since round 4 part 3 it also survives the composer's swap of an untouched draft's default model when the engine is read after hydration (`followEngineDefault`: before, a link on the open engine landed on the studio's default model). Since round 4 part 5 a `?model=` naming a retired model opens on its replacement (`currentModelId`), and Reuse of a run on one migrates its request in the browser (`migrateRequest` without Director words) and toasts what changed; the composer's provider style chip (`ProviderPresetChip`, Higgsfield's live styles) is gone. The line under Home's composer prices what Start will run from the catalog (`startQuotes` in `src/lib/starter-prices.ts`, worded by `startLine` in `src/lib/connections.ts`).
- **Hubs** (Audio, Video tools, Upscale) have one prerendered path per mode (`src/lib/hubs.ts`, `ModeSwitchStudio` in `mode-switch-studio.tsx`, `[mode]/page.tsx`); old `?mode=` links redirect in `next.config.ts`, and an unknown mode is a real 404. Round 4 adds `/upscale/fps`, `/upscale/hdr`, `/upscale/export`, `/audio/transcribe`, `/audio/loop`, `/audio/join` and `/video-tools/remove-object`; round 5 part 1 adds `/video-tools/evolution`, and round 5 part 2 `/audio/split` (`SplitSoundtrackTool` in `TOOLS`).
- **Composer** pieces: pure logic in `src/lib/composer.ts` (summary, blockers, `onImageChange`, `fitAttachments`, `firstMissingSlot`; since round 4 `blockerLine` for the phone's blocked-Generate line, `framesRequest` and the Frames strip helpers, the start token), `attachments.ts` (`useAttach`, `useUploadReaper`), `settings-panel.tsx`, `model-picker.tsx` (cmdk), `attach-menu.tsx`, `preset-chips.tsx` (lazy), `radio-keys.ts`, `frames-strip.tsx`, and since round 4 part 3 `look-chip.tsx` (lazy: Fuobe Soul's looks, a popover on desktop and a sheet on phones). Since round 4 part 3 the composer sends `engine` for a Fuobe Original, drops a look when the model changes to one without looks, moves to a motion's or effect's Original when one is picked, and follows a move across an engine switch (the pure helpers are in `src/lib/composer.ts`: see Fuobe Originals). Video finishing reads the attached clip's facts from `POST /api/media/probe` for its "24 → 60 fps · 5 s → 10 s" line and its prices. Since round 5 part 1 Edit video does too (`clipFacts`, fixes-5): a clip edit that keeps the clip's length is priced on its seconds, and `clipBlocker` blocks Generate with the reason when the clip is outside the model's window (`clip-windows.ts`; the server refuses the same for an API call that sends no length, after the clip is uploaded to the provider's storage, nothing billed). Lipsync reads the voice's length (`StudioConfig.voiceFacts`) to price talking avatars, and the Image studio prices a look's step after the picture (`postStepCost`, with the face mosaic's models in `extraModels`). The Look chip has a "No look" state (`none`, Storyboard). Since round 5 part 2 a price is read on the browser's day (`useToday` in `src/hooks/use-today.ts`: null on the server and while the page hydrates, so a launch-priced model shows no price until then, and it changes at UTC midnight): the composer's estimate, the model picker (`pickerPrice`) and the Models page (`rowPrice` with `ModelRow.launch`; `GET /api/models` answers the day's `price` and keeps `launch`). The slim studio catalog carries `Pricing.promo` as it is. A run with LoRAs on an endpoint with no published price shows "Price unknown", never free, in the composer and on Canvas nodes. The Image studio's controls chip reads "Options" (`StudioConfig.controlsTitle`), where MOSS-Image's Quality sits.
diff --git a/docs/FEATURES.md b/docs/FEATURES.md
index d075d9c0..8005bc53 100644
--- a/docs/FEATURES.md
+++ b/docs/FEATURES.md
@@ -29,7 +29,7 @@ Fuobe is a complete creative studio you can run yourself: 108 camera motions, 25
- [Elements, Soul ID and LoRAs](#elements-soul-id-and-loras)
- [Catalog and the open-source engine](#catalog-and-the-open-source-engine)
- [Evaluation harness](#evaluation-harness)
-- [Demo mode](#demo-mode)
+- [Placeholder results](#placeholder-results)
- [Model licences](#model-licences)
## Assist, skills, MCP and the command line
@@ -104,9 +104,9 @@ Fuobe is a complete creative studio you can run yourself: 108 camera motions, 25
More on running it: [Development → Evaluation harness](DEVELOPMENT.md#evaluation-harness).
-## Demo mode
+## Placeholder results
-- **No keys? No GPU?** Demo mode lets you click through everything with clearly-labelled placeholder outputs.
+- **Off by default.** With nothing connected, a run opens the connect card: the ComfyUI on this computer, a server address, or an API key. To give a tour without keys or a GPU, turn on **Settings → Show placeholder results (for a tour)**: every run then makes a result labelled "Placeholder", and the sidebar shows a "Placeholders on" chip that turns it off.
## Model licences
diff --git a/docs/SELF-HOSTING.md b/docs/SELF-HOSTING.md
index e40fec20..fbf09351 100644
--- a/docs/SELF-HOSTING.md
+++ b/docs/SELF-HOSTING.md
@@ -14,7 +14,7 @@ How to install Fuobe, connect a GPU, cloud keys and local language models, and r
## Install and start
-Fuobe runs on Windows, macOS or Linux. It needs Node 22 or later and pnpm, plus a running ComfyUI for the open engine (default address `http://127.0.0.1:8188`). Without a ComfyUI or a cloud key, demo mode lets you click through everything with labelled placeholder outputs.
+Fuobe runs on Windows, macOS or Linux. It needs Node 22 or later and pnpm, plus a running ComfyUI for the open engine (default address `http://127.0.0.1:8188`). Without a ComfyUI or a cloud key, a run asks you to connect one; for a tour, **Settings → Show placeholder results (for a tour)** makes every run a labelled placeholder.
```bash
pnpm install
@@ -83,7 +83,7 @@ Public sign-up, guest browsing and connecting your own GPU to a shared install a
| `FUOBE_TRUST_PROXY=1` | Behind a reverse proxy: trust the last `X-Forwarded-For` hop, so wrong passwords, and too many wrong share links, lock out only that visitor (60 s). Without it, everyone shares one limit: passwords are slowed to one attempt every 4 s and never locked, and wrong share links past 100 a minute get 429 while real links still open |
| `FUOBE_ALLOW_PRIVATE_URLS=1` | Let inputs, product links and project sources be fetched from private / LAN addresses (they are refused by default), and let Assist connectors use plain http beyond localhost (without it a connector needs https unless it is on localhost; a private https address is accepted, with a warning that Claude can only reach it through a public tunnel) |
| `FUOBE_DATA_DIR` | Where the database, files and `auth.json` live (default `./data`). Back up `secrets.key` there with `auth.json`: it opens the fal.ai and Replicate keys accounts saved ([Your keys](public-signup.md#your-keys)), which must be added again without it |
-| `FUOBE_DEMO_MODE` | `auto` (default: demo outputs only when a model's provider isn't connected), `on` or `off` |
+| `FUOBE_DEMO_MODE` | `off` (default: a run with nothing connected asks you to connect one) or `on` (placeholder results, for a tour: every run makes a labelled placeholder). The old `auto` reads as `off`, and a saved `auto` is cleared on start |
| `FUOBE_SKILLS_DIR` | Where Assist's built-in skills are read from (default `./skills`) |
| `FUOBE_ENGINE_MODE`, `FUOBE_CLOUD_PROVIDER`, `FUOBE_ENHANCE_PROVIDER`, `FUOBE_LLM_PROVIDER` | The Settings choices above |
| `FUOBE_LLM_CONTEXT` | Tokens of context for the local model (default `16384`): Ollama's `num_ctx`, and the context LM Studio loads a model with. `0` leaves it to the server |
diff --git a/docs/cli.md b/docs/cli.md
index 1e650710..123068b0 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -79,9 +79,9 @@ fuobe models --hidden # also the helper models studios
```
`--kind` is `image`, `video`, `audio`, `text` or `model3d`; `--engine` is `open` or `cloud`. The
-price says how a run goes today, following Settings → Demo mode: "(demo)" runs but returns demo
-media for free (no provider set up yet, or Demo mode is on); "(not set up)" won't run until its
-provider is set up, because Demo mode is off. `--json` gives the same as `runs` (`real`, `demo` or
+price says how a run goes today, following Settings → Placeholder results: "(demo)" runs but returns placeholder
+media for free (placeholder results are on); "(not set up)" won't run until its
+provider is set up. `--json` gives the same as `runs` (`real`, `demo` or
`refused`) per model. An install set to one engine only (Settings → Engine mode) lists that
engine's models only.
@@ -149,7 +149,7 @@ Without `--wait` or `--out`, `generate` prints the job ids and returns at once.
### `fuobe status`, `fuobe wait`, `fuobe download`, `fuobe cancel`
```bash
-fuobe status # the server: engine mode, demo mode, providers, the local LLM, the token
+fuobe status # the server: engine mode, placeholder results, providers, the local LLM, the token
fuobe status V1StGXR8_Z5j # one or more generations
fuobe wait V1StGXR8_Z5j 3Kp9x2LmQa7c # until each is done; prints the output URLs (text results inline)
fuobe wait V1StGXR8_Z5j --out renders/
@@ -285,11 +285,11 @@ server too (`fuobe mcp`).
- **"… refused the API token"** — it was revoked, or belongs to another server: create a new one.
- **"The token "fuobe login" saved is for …, so it isn't sent here"** — `--url` or `FUOBE_URL` names
another server than the one you signed in to: pass `--token`, or `fuobe login --url <that server>`.
-- **"(demo)" results** — no provider is set up for that model, or Settings → Demo mode is on: add a
+- **"(demo)" results** — Settings → Placeholder results is on (for a tour): turn it off, and add a
key in Settings (cloud), or start ComfyUI (open source). Demo results cost nothing and are
labelled in the Library.
-- **"(not set up)" in `fuobe models`, or "Connect … in Settings to run this model"** — Demo mode is
- off and the model's provider isn't set up yet.
+- **"(not set up)" in `fuobe models`, or "Connect … in Settings to run this model"** — the
+ model's provider isn't set up yet.
- **"… is a cloud model, but you asked for --engine open"** — pick a model of that engine
(`fuobe models --engine open`) or leave out `--engine`.
diff --git a/scripts/eval/README.md b/scripts/eval/README.md
index d5124700..20c65e6e 100644
--- a/scripts/eval/README.md
+++ b/scripts/eval/README.md
@@ -47,10 +47,10 @@ The harness finds its server the way `bin/fuobe.mjs` does: `--url` / `--token`,
the public API (`/api/generations`, `/api/uploads`, `/api/elements`, the studio routes), so the
harness measures what a user gets.
-- `--engine demo` needs **Settings → Demo mode** on Auto or On. A job that would run for real is
+- `--engine demo` needs **Settings → Placeholder results** turned on. A job that would run for real is
skipped.
- `--engine open` / `cloud` refuse a server whose engine mode excludes them. A job that would come
- back as demo media is skipped and says why: Demo mode is On, no ComfyUI is connected, or there is
+ back as demo media is skipped and says why: placeholder results are on, no ComfyUI is connected, or there is
no cloud key.
- **The model it names.** A job the server would run on another model than the one the case names
(a studio's default maker, or a retired model the server runs on the Original that replaced it) is
diff --git a/scripts/eval/lib/run.mjs b/scripts/eval/lib/run.mjs
index c4ebbc53..9a91020f 100644
--- a/scripts/eval/lib/run.mjs
+++ b/scripts/eval/lib/run.mjs
@@ -181,7 +181,7 @@ export async function runEval(opts, io) {
const t = targets.find((x) => x.id === j.train.target);
const usd = trainingPrice(t);
let why = null;
- if (t?.demo) why = `training on ${j.train.target} would run as a demo on that Fuobe (${facts.demoMode === "on" ? "Demo mode is On" : `no ${t.provider === "fal" ? "fal.ai key" : "AI-Toolkit"} connected`}), so nothing would be trained`;
+ if (t?.demo) why = `training on ${j.train.target} would run as a demo on that Fuobe (${facts.demoMode === "on" ? "placeholder results are on" : `no ${t.provider === "fal" ? "fal.ai key" : "AI-Toolkit"} connected`}), so nothing would be trained`;
else if (t?.blocker) why = `training on ${j.train.target} can't start there: ${t.blocker}`;
else if (engine === "cloud" && usd == null && !opts.allowUnpriced) why = `training on ${j.train.target} has no price${t ? ` (the server says “${t.price}”)` : ""}, so the spend cap can't cover it: --allow-unpriced runs it anyway`;
if (why) for (const x of jobs.filter((y) => y.caseId === j.caseId && !y.skip)) x.skip = why;
@@ -198,11 +198,11 @@ export async function runEval(opts, io) {
const inputs = job.train ? {} : await up.inputs(job.inputs);
const p = await price(client, job, inputs, { engine, runId: runId ?? "dry-run" });
job.preview = p;
- if (engine === "demo" && !p.demo) job.skip = `would run for real on ${p.providerId}: turn on Settings → Demo mode for a free self-test`;
+ if (engine === "demo" && !p.demo) job.skip = `would run for real on ${p.providerId}: turn on Settings → Placeholder results for a free self-test`;
else if (engine !== "demo" && p.demo) {
job.skip =
facts.demoMode === "on"
- ? "would run as a demo: Demo mode is On on that Fuobe (set Settings → Demo mode to Auto or Off to measure real models)"
+ ? "would run as a demo: placeholder results are on on that Fuobe (turn off Settings → Placeholder results to measure real models)"
: `would run as a demo: ${p.modelName ?? job.model.id} has no ${engine === "open" ? "ComfyUI" : "cloud provider"} connected on that Fuobe`;
}
else if (engine !== "demo" && p.engine && p.engine !== engine) job.skip = `${p.modelName ?? job.model.id} is ${p.engine === "open" ? "an open-source" : "a cloud"} model, not ${engine}`;
diff --git a/scripts/eval/lib/server.mjs b/scripts/eval/lib/server.mjs
index aaa83282..c2b026d2 100644
--- a/scripts/eval/lib/server.mjs
+++ b/scripts/eval/lib/server.mjs
@@ -40,7 +40,7 @@ export async function serverFacts(client) {
/** Why this engine can't run on that server (or null). */
export function engineProblem(engine, facts) {
if (engine === "demo") {
- return facts.demoMode === "off" ? "--engine demo needs Settings → Demo mode set to Auto or On on that Fuobe (it is Off)" : null;
+ return facts.demoMode === "off" ? "--engine demo needs Settings → Placeholder results turned on on that Fuobe (they are off)" : null;
}
if (facts.engineMode !== "both" && facts.engineMode !== engine) {
return `That Fuobe runs ${facts.engineMode === "open" ? "open-source" : "cloud"} models only (Settings → Engine mode), so --engine ${engine} can't run there`;
diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.ts
index ed17ef56..9c9d95b2 100644
--- a/src/app/api/generations/route.ts
+++ b/src/app/api/generations/route.ts
@@ -1,5 +1,5 @@
import { connection } from "next/server";
-import { CONNECT_GPU_HEADER, GUEST_RUN_MESSAGE, OWN_GPU_TOOL_MESSAGE } from "@/lib/guest-access";
+import { CONNECT_GPU_HEADER, CONNECT_NEEDS_HEADER, GUEST_RUN_MESSAGE, OWN_GPU_TOOL_MESSAGE } from "@/lib/guest-access";
import { missingFilesMessage } from "@/lib/missing-files";
import { ADD_KEY_HEADER } from "@/lib/your-keys";
import { requestViewer, validToken } from "@/server/auth";
@@ -180,12 +180,17 @@ export async function POST(request: Request) {
// A price check of a paid model the account has no key for says so, without opening "Add your key".
if (refusal && !preview) return refused(refusal);
if (account && !preview) unhit(`run:${account.id}`);
- // Nothing connected runs this, and ComfyUI could: the owner's own browser (never a script's token) opens "Connect
- // your GPU" for it, and the run starts once it is connected.
- const connect = e instanceof ConnectComfyError && viewer.kind === "owner" && !preview && !token;
+ // Nothing connected runs this, and ComfyUI or a key could (Demo mode off): the owner's own browser (never a
+ // script's token) opens the connect card for it, with the ways that would run it, and the run starts once one is
+ // connected.
+ const connect = e instanceof ConnectComfyError && viewer.kind === "owner" && !preview && !token ? e.needs : null;
return Response.json(
- { error: (e as Error).message, ...(refusal && { code: refusal.code, ...(refusal.provider && { provider: refusal.provider }) }), ...(connect && { code: "connect-gpu" }) },
- { status: 422, ...(connect && { headers: { [CONNECT_GPU_HEADER]: "1" } }) },
+ {
+ error: (e as Error).message,
+ ...(refusal && { code: refusal.code, ...(refusal.provider && { provider: refusal.provider }) }),
+ ...(connect && { code: "connect-gpu", needs: connect }),
+ },
+ { status: 422, ...(connect && { headers: { [CONNECT_GPU_HEADER]: "1", [CONNECT_NEEDS_HEADER]: connect } }) },
);
}
}
diff --git a/src/app/api/models/route.ts b/src/app/api/models/route.ts
index 5cee5386..18713dea 100644
--- a/src/app/api/models/route.ts
+++ b/src/app/api/models/route.ts
@@ -19,7 +19,7 @@ const connected = (m: ModelDef) => m.routes.some((r) => (r.provider === "llm" ?
/**
* How a run of the model goes today, the way chooseRoute decides: "real" on its provider, "demo"
- * (placeholder media, free: Demo mode on, or auto with no provider set up) or "refused" (Demo mode
+ * (placeholder media, free: placeholder results on, or "auto" with no provider set up) or "refused" (placeholders
* off and no provider: the run fails with "Connect … in Settings").
*/
function runsAs(m: ModelDef, demoMode: string): "real" | "demo" | "refused" {
diff --git a/src/app/api/settings/route.ts b/src/app/api/settings/route.ts
index 2f40eb4e..5601f395 100644
--- a/src/app/api/settings/route.ts
+++ b/src/app/api/settings/route.ts
@@ -12,7 +12,7 @@ export async function PUT(request: Request) {
const body = (await request.json().catch(() => ({}))) as Record<string, unknown>;
const entries = Object.entries(body).filter(([name, value]) => name in SETTINGS && typeof value === "string") as [SettingName, string][];
try {
- entries.forEach(([name, value]) => validateSetting(name, value.trim()));
+ entries.forEach(([name, value]) => validateSetting(name, value.trim(), "api"));
} catch (e) {
return Response.json({ error: (e as Error).message }, { status: 400 });
}
diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx
index 5d9bbeb7..5f563bef 100644
--- a/src/components/app-sidebar.tsx
+++ b/src/components/app-sidebar.tsx
@@ -35,6 +35,8 @@ import {
import { Kbd } from "@/components/ui/kbd";
import { Skeleton } from "@/components/ui/skeleton";
import { CommandPalette, CommandPaletteProvider, useCommandPalette } from "@/components/command-palette";
+import { PlaceholdersOnChip } from "@/components/demo-mode";
+import { placeholdersOn } from "@/lib/demo-mode";
import { GitHubMark } from "@/components/github-mark";
import { IntentLink } from "@/components/intent-link";
import { JobNotifications } from "@/components/job-notifications";
@@ -560,7 +562,6 @@ export function AppSidebar() {
const place = usePagePlace();
// Not in Paid APIs only mode: ComfyUI isn't used there, wherever it runs.
const ownerGpu = status && !status.viewer && mode !== "cloud" && (status.ownerGpu || (place === "hosted" && !comfy)) ? (ownGpuOf(status) ?? { connected: false }) : null;
- const ready = mode === "open" ? comfy : mode === "cloud" ? cloud : cloud || comfy;
const [closed, setClosed] = useState(readClosed);
const toggle = useCallback((id: string) => {
setClosed((c) => {
@@ -644,12 +645,9 @@ export function AppSidebar() {
</IntentLink>
)}
<YourGpuChip gpu={ownerGpu} guest={false} />
- {(mode !== "both" || (!ready && status?.demoMode !== "off")) && (
+ {mode !== "both" && (
<div className="flex flex-col gap-1.5 px-2 pb-1 text-[11px] text-muted-foreground group-data-[collapsible=icon]:hidden">
- {mode !== "both" && <span>{mode === "open" ? "Open source only" : "Paid APIs only"}</span>}
- {!ready && status?.demoMode !== "off" && (
- <span className="w-fit rounded-sm bg-highlight/25 px-1.5 py-0.5 text-highlight-foreground dark:text-highlight">Demo mode · placeholder outputs</span>
- )}
+ <span>{mode === "open" ? "Open source only" : "Paid APIs only"}</span>
</div>
)}
</>
@@ -676,13 +674,15 @@ export function AppSidebar() {
</span>
)}
{mode !== "both" && <span className="text-[11px] text-muted-foreground">{mode === "open" ? "Open source only" : "Paid APIs only"}</span>}
- {status && !ready && status.demoMode !== "off" && (
- <span className="mt-0.5 rounded-sm bg-highlight/25 px-1.5 py-0.5 text-[11px] text-highlight-foreground dark:text-highlight">
- Demo mode · placeholder outputs
- </span>
- )}
</IntentLink>
)}
+ {/* Placeholder results, only while the owner has them on (Settings, for a tour): a click turns them off. Its own
+ button beside the status link (a button never sits inside a link). */}
+ {status && !status.viewer && placeholdersOn(status.demoMode) && (
+ <div className="-mt-1 px-2 pb-1 group-data-[collapsible=icon]:hidden">
+ <PlaceholdersOnChip />
+ </div>
+ )}
<SidebarMenu className="flex-row gap-1 group-data-[collapsible=icon]:flex-col">
<SidebarMenuItem className="min-w-0 flex-1">
<SidebarMenuButton tooltip="Toggle theme" className="h-8 text-[13px]" onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}>
diff --git a/src/components/cinema/cinema-feed.tsx b/src/components/cinema/cinema-feed.tsx
index dcf0e470..cf4ea896 100644
--- a/src/components/cinema/cinema-feed.tsx
+++ b/src/components/cinema/cinema-feed.tsx
@@ -50,6 +50,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { FailedTile, MediaThumb, PendingTile, downloadName, tileRatio } from "@/components/studio/feed";
import { useSoulFinish } from "@/components/studio/soul-finish";
import { Viewer } from "@/components/studio/viewer";
+import { PlaceholderChip } from "@/components/demo-mode";
import { getModel } from "@/lib/catalog";
import type { CinemaFolder } from "@/lib/catalog/cinema";
import type { Generation, OutputFile } from "@/lib/catalog/types";
@@ -428,6 +429,7 @@ function TileView({
{media}
{overlay}
{checkbox}
+ {g.status === "succeeded" && !selecting && <PlaceholderChip g={g} overlay className="absolute top-2 left-10" />}
<div className="pointer-events-none absolute top-2 right-2 flex items-center gap-1">
{g.favorite && <Heart className="size-4 fill-highlight text-highlight drop-shadow" />}
{u.scene && (
diff --git a/src/components/cinema/prompt-bar.tsx b/src/components/cinema/prompt-bar.tsx
index fbd7c80b..ebf5d590 100644
--- a/src/components/cinema/prompt-bar.tsx
+++ b/src/components/cinema/prompt-bar.tsx
@@ -74,6 +74,7 @@ import { directorPicks, draftToInput, type BarAction, type CinemaDraft, type Ref
import { useCinemaGenerate } from "./hooks";
import { firstFrame, mediaDuration } from "./media";
import { formatUsd } from "./money";
+import { placeholdersOn } from "@/lib/demo-mode";
const chip = "inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full px-3 text-[13px] font-medium transition-colors";
const chipIdle = "bg-secondary text-secondary-foreground hover:bg-accent";
@@ -363,7 +364,7 @@ export function PromptBar(props: PromptBarProps) {
audios: draft.refs.filter((r) => r.kind === "audio").map((r) => r.duration ?? NaN),
elements: mentions.length,
});
- const demo = !!status && status.demoMode !== "off" && !model.routes.some((r) => status.providers[r.provider]?.configured);
+ const demo = placeholdersOn(status?.demoMode);
const cost = demo ? 0 : plan.costUsd;
const overCap = costCapUsd != null && cost != null && cost > 0 && spentUsd + cost > costCapUsd + 1e-9;
const uploading = draft.refs.some((r) => r.uploading);
@@ -852,7 +853,7 @@ export function PromptBar(props: PromptBarProps) {
</span>
</TooltipTrigger>
<TooltipContent>
- {demo ? "Demo mode: no key connected for this model, so takes are free placeholders" : cost === 0 ? "Runs on your own GPU" : "Estimated cost of this run, billed by the provider to your key"}
+ {demo ? "Placeholder results are on (Settings), so takes are free stand-ins" : cost === 0 ? "Runs on your own GPU" : "Estimated cost of this run, billed by the provider to your key"}
</TooltipContent>
</Tooltip>
<Tooltip>
diff --git a/src/components/cinema/scene-actions.tsx b/src/components/cinema/scene-actions.tsx
index a1d47d6b..37a8c45a 100644
--- a/src/components/cinema/scene-actions.tsx
+++ b/src/components/cinema/scene-actions.tsx
@@ -10,6 +10,7 @@ import { IMAGE_ASPECTS, planCinema, type CinemaPlan, type DirectorSettings } fro
import type { Engine } from "@/lib/catalog/types";
import { formatCost } from "@/lib/format";
import type { CinemaGeneration } from "./hooks";
+import { placeholdersOn } from "@/lib/demo-mode";
/**
* Cinema Studio's 3D scene, the light half (the viewer and three.js load only when a scene opens): which takes
@@ -41,10 +42,10 @@ export function sceneTake(g: CinemaGeneration): SceneTake | null {
return { generation: g, still, source, aspect: ar && IMAGE_ASPECTS.includes(ar) ? ar : "16:9" };
}
-/** What a plan costs here: "Demo" when demo mode is on, or answers because no provider of its model is connected. */
+/** What a plan costs here: "Demo" while placeholder results are on (Settings, for a tour). */
export function usePlanPrice(plan: CinemaPlan): { cost: number | null; label: string; demo: boolean } {
const status = useStatus().data;
- const demo = !!status && (status.demoMode === "on" || (status.demoMode !== "off" && !plan.model.routes.some((r) => status.providers[r.provider]?.configured)));
+ const demo = placeholdersOn(status?.demoMode);
const cost = demo ? 0 : plan.costUsd;
return { cost, demo, label: demo ? "Demo · free" : cost === 0 ? "Free" : cost != null ? `≈ ${formatCost(cost)}` : "Price unknown" };
}
diff --git a/src/components/cinema/soul-builders.tsx b/src/components/cinema/soul-builders.tsx
index 4b4dec81..bb00e475 100644
--- a/src/components/cinema/soul-builders.tsx
+++ b/src/components/cinema/soul-builders.tsx
@@ -40,6 +40,7 @@ import { formatCost } from "@/lib/format";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
import { useCinemaGenerate, useCinemaItems } from "./hooks";
+import { placeholdersOn } from "@/lib/demo-mode";
interface BuilderProps {
open: boolean;
@@ -195,9 +196,9 @@ function useBuilderRun(projectId: string) {
return { generate, results, setIds, current };
}
-function CostLabel({ plan, demoModel }: { plan: { costUsd: number | null }; demoModel: { routes: { provider: string }[] } }) {
+function CostLabel({ plan }: { plan: { costUsd: number | null } }) {
const status = useStatus().data;
- const demo = !!status && status.demoMode !== "off" && !demoModel.routes.some((r) => status.providers[r.provider]?.configured);
+ const demo = placeholdersOn(status?.demoMode);
return <span className="font-mono text-[12px] whitespace-nowrap text-muted-foreground">{demo ? "Demo · free" : plan.costUsd === 0 ? "Free" : plan.costUsd != null ? `≈ ${formatCost(plan.costUsd)}` : ""}</span>;
}
@@ -326,7 +327,7 @@ function SoulCast({ projectId, folderId, engine, context, brief, onOpenChange }:
</button>
))}
</div>
- <CostLabel plan={plan} demoModel={plan.model} />
+ <CostLabel plan={plan} />
<Button onClick={run} disabled={generate.isPending}>
{generate.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />} Generate character
</Button>
@@ -446,7 +447,7 @@ function SoulLocation({ projectId, folderId, engine, settings, context, brief, o
</button>
))}
</div>
- <CostLabel plan={plan} demoModel={plan.model} />
+ <CostLabel plan={plan} />
<Button onClick={() => run()} disabled={generate.isPending || !prompt.trim()}>
{generate.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />} Generate location
</Button>
diff --git a/src/components/command-palette.tsx b/src/components/command-palette.tsx
index 2047fae9..ec2f69b5 100644
--- a/src/components/command-palette.tsx
+++ b/src/components/command-palette.tsx
@@ -67,7 +67,7 @@ const SETTINGS: { id: string; label: string; icon: LucideIcon; keywords: string;
{ id: "assist-connectors", label: "Assist connectors", icon: Plug, keywords: "mcp connector claude tools notion linear slack server token" },
{ id: "notifications", label: "Notifications", icon: Bell, keywords: "browser done alerts" },
{ id: "security", label: "Password and API tokens", icon: ShieldCheck, keywords: "security sign in mcp token" },
- { id: "demo", label: "Demo mode", icon: Settings2, keywords: "placeholder free try" },
+ { id: "demo", label: "Placeholder results", icon: Settings2, keywords: "demo mode placeholder tour free try" },
];
const PAGES: (PaletteEntry & { icon: LucideIcon })[] = NAV.flatMap((g) =>
diff --git a/src/components/demo-mode.tsx b/src/components/demo-mode.tsx
new file mode 100644
index 00000000..e6f7fa70
--- /dev/null
+++ b/src/components/demo-mode.tsx
@@ -0,0 +1,193 @@
+"use client";
+
+import { useQueryClient } from "@tanstack/react-query";
+import { ChevronDown, Cpu, KeyRound, Loader2, PowerOff, Sparkles, X } from "lucide-react";
+import Link from "next/link";
+import { useState } from "react";
+import { toast } from "sonner";
+import { openConnect } from "@/components/gpu/open-connect";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { saveSettings, useIsOwner, useStatus } from "@/lib/api";
+import { toastError } from "@/lib/refusals";
+import {
+ PLACEHOLDER_ACTION_LABELS,
+ PLACEHOLDER_CHIP,
+ PLACEHOLDERS_ON,
+ isPlaceholder,
+ placeholderActions,
+ placeholderLine,
+ type PlaceholderAction,
+} from "@/lib/demo-mode";
+import { cn } from "@/lib/utils";
+
+/**
+ * Placeholder results (src/lib/demo-mode.ts): off by default, on only by the owner's choice in Settings, for a tour.
+ * While on, the sidebar shows "Placeholders on", a chip whose click turns them off (with Undo). Every result the demo
+ * provider made carries a "Placeholder" chip; for the owner it opens a small card with the ways to the real thing:
+ * the ComfyUI on this computer (the connect card), an API key (Settings), and placeholders off.
+ */
+
+const ICONS: Record<PlaceholderAction, typeof Cpu> = { computer: Cpu, key: KeyRound, off: PowerOff };
+
+const ROW =
+ "flex min-h-10 w-full items-center gap-2.5 rounded-md px-2.5 text-left text-[13px] font-medium transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-60 sm:min-h-9";
+
+/** Save the switch, refresh what reads it, and say so (turning off offers Undo). */
+function useSetPlaceholders() {
+ const qc = useQueryClient();
+ const [busy, setBusy] = useState(false);
+ const apply = async (on: boolean): Promise<boolean> => {
+ setBusy(true);
+ try {
+ await saveSettings({ demoMode: on ? "on" : "off" });
+ await Promise.all([qc.invalidateQueries({ queryKey: ["status"] }), qc.invalidateQueries({ queryKey: ["settings"] })]);
+ return true;
+ } catch (e) {
+ toastError(e);
+ return false;
+ } finally {
+ setBusy(false);
+ }
+ };
+ const turnOff = async () => {
+ if (!(await apply(false))) return false;
+ toast.success("Placeholder results are off", {
+ description: "Runs now make the real thing, or ask you to connect ComfyUI or add a key first.",
+ action: { label: "Undo", onClick: () => void apply(true) },
+ });
+ return true;
+ };
+ return { busy, turnOff };
+}
+
+function PlaceholderCard({ close }: { close: () => void }) {
+ const status = useStatus().data;
+ const { busy, turnOff } = useSetPlaceholders();
+ const actions = placeholderActions({ owner: true, engineMode: status?.engineMode, demoMode: status?.demoMode });
+ return (
+ <>
+ <div className="space-y-1 px-1 pt-0.5">
+ <p className="flex items-center gap-1.5 text-[13px] font-semibold">
+ <Sparkles aria-hidden className="size-3.5 text-highlight-foreground dark:text-highlight" /> {PLACEHOLDER_CHIP}
+ </p>
+ <p className="text-[13px] leading-snug text-muted-foreground">{placeholderLine(status?.demoMode)}</p>
+ </div>
+ <div className="flex flex-col gap-0.5">
+ {actions.map((a) => {
+ const Icon = ICONS[a];
+ const inner = (
+ <>
+ {a === "off" && busy ? <Loader2 aria-hidden className="size-4 shrink-0 animate-spin" /> : <Icon aria-hidden className="size-4 shrink-0 text-muted-foreground" />}
+ {PLACEHOLDER_ACTION_LABELS[a]}
+ </>
+ );
+ if (a === "key")
+ return (
+ <Link key={a} href="/settings#cloud" className={ROW} onClick={close}>
+ {inner}
+ </Link>
+ );
+ return (
+ <button
+ key={a}
+ type="button"
+ className={ROW}
+ disabled={a === "off" && busy}
+ onClick={async () => {
+ if (a === "off") {
+ if (await turnOff()) close();
+ return;
+ }
+ close();
+ // The button said "Use the ComfyUI on this computer": the connect card opens already looking.
+ openConnect(true);
+ }}
+ >
+ {inner}
+ </button>
+ );
+ })}
+ </div>
+ </>
+ );
+}
+
+/**
+ * The sidebar's "Placeholders on" while the switch is on (the owner's only: nobody else's runs make placeholders). A
+ * click turns them off at once, with Undo in the toast; Settings has the switch itself.
+ */
+export function PlaceholdersOnChip({ className }: { className?: string }) {
+ const { busy, turnOff } = useSetPlaceholders();
+ return (
+ <button
+ type="button"
+ disabled={busy}
+ onClick={() => void turnOff()}
+ title="Turn off placeholder results"
+ aria-label={`${PLACEHOLDERS_ON}. Turn off placeholder results`}
+ className={cn(
+ "group/chip inline-flex h-6 w-fit max-w-full items-center gap-1 rounded-full bg-highlight/25 pr-1.5 pl-2 text-[11px] font-medium text-highlight-foreground transition-colors outline-none hover:bg-highlight/40 focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-60 dark:text-highlight",
+ className,
+ )}
+ >
+ <span className="min-w-0 truncate">{PLACEHOLDERS_ON}</span>
+ {busy ? <Loader2 aria-hidden className="size-3 shrink-0 animate-spin" /> : <X aria-hidden className="size-3 shrink-0 opacity-70 group-hover/chip:opacity-100" />}
+ </button>
+ );
+}
+
+/**
+ * "Placeholder" on a result the demo provider made (nothing for any other). `overlay`: over the media, in a tile's
+ * corner (`className` places the strip it sits in: "absolute top-2"); otherwise inline, in a row of text (`className`
+ * goes on the chip). For the owner it opens the ways to the real thing; for anyone else it is a label.
+ */
+export function PlaceholderChip({ g, overlay, className }: { g: { provider?: string | null } | null | undefined; overlay?: boolean; className?: string }) {
+ const owner = useIsOwner();
+ const [open, setOpen] = useState(false);
+ if (!isPlaceholder(g)) return null;
+ const look = cn(
+ "pointer-events-auto inline-flex h-7 max-w-full items-center gap-1 rounded-full px-2.5 text-[12px] font-medium whitespace-nowrap",
+ overlay ? "bg-black/65 text-white backdrop-blur" : "bg-highlight/25 text-highlight-foreground dark:text-highlight",
+ !overlay && className,
+ );
+ const label = (
+ <>
+ <Sparkles aria-hidden className="size-3 shrink-0" />
+ <span className="truncate">{PLACEHOLDER_CHIP}</span>
+ </>
+ );
+ const chip = !owner ? (
+ <span className={look} data-placeholder-chip="">
+ {label}
+ </span>
+ ) : (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ data-placeholder-chip=""
+ aria-label="Placeholder: not a real result. Show the ways to the real thing"
+ onClick={(e) => e.stopPropagation()}
+ className={cn(look, "transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", overlay ? "hover:bg-black/80" : "hover:bg-highlight/40")}
+ >
+ {label}
+ <ChevronDown aria-hidden className="size-3 shrink-0" />
+ </button>
+ </PopoverTrigger>
+ {/* Clicks inside never reach a tile or card underneath (React passes them up through the portal). */}
+ <PopoverContent
+ side="bottom"
+ align="start"
+ collisionPadding={16}
+ className="w-[min(18rem,calc(100vw-2rem))] gap-2 p-2"
+ onClick={(e) => e.stopPropagation()}
+ onPointerDown={(e) => e.stopPropagation()}
+ >
+ <PlaceholderCard close={() => setOpen(false)} />
+ </PopoverContent>
+ </Popover>
+ );
+ if (!overlay) return chip;
+ // A strip clear of the tile's right-hand icons; only the chip takes the pointer.
+ return <div className={cn("pointer-events-none right-10 left-2 flex", className)}>{chip}</div>;
+}
diff --git a/src/components/get-started.tsx b/src/components/get-started.tsx
index e2d3d1d7..11397faa 100644
--- a/src/components/get-started.tsx
+++ b/src/components/get-started.tsx
@@ -1,7 +1,7 @@
"use client";
import { useQueryClient } from "@tanstack/react-query";
-import { AudioLines, Bot, ChevronDown, Clapperboard, Cloud, Copy, Cpu, ExternalLink, ImageIcon, Megaphone, Mic2, Sparkles, Video, Wand2, X } from "lucide-react";
+import { AudioLines, Bot, ChevronDown, Clapperboard, Cloud, Copy, Cpu, ExternalLink, ImageIcon, Megaphone, Mic2, Video, Wand2, X } from "lucide-react";
import Link from "next/link";
import { useId, useState } from "react";
import { toast } from "sonner";
@@ -123,15 +123,15 @@ function GuideCard({ icon: Icon, title, cost, children }: { icon: typeof Cloud;
}
/**
- * The first-run guide: three ways to make things for real (a paid API key, your own GPU, or the
- * demo), each finished without leaving the page, then Liner's "What do you want to do?" chips.
+ * The first-run guide: the ways to make things for real (a paid API key, or your own GPU), each
+ * finished without leaving the page, then Liner's "What do you want to do?" chips. There is no
+ * demo card: placeholder results are only for a tour, and only turned on in Settings.
* It shows while nothing is connected and it wasn't dismissed (showFirstRun); connecting something
* or "Hide" remembers that on the server, so it doesn't come back in another browser.
*/
export function GetStarted({
status,
prices,
- onDemo,
onHide,
onMode,
intents = true,
@@ -141,9 +141,7 @@ export function GetStarted({
status?: StatusInfo;
/** What a first image and clip cost on the paid route (starterPriceLine on the server). */
prices?: string;
- /** "Just try it": after the guide is put away (Home focuses its composer). */
- onDemo?: () => void;
- /** After Hide or "Try the demo" put it away (Settings closes a guide it reopened). */
+ /** After Hide put it away (Settings closes a guide it reopened). */
onHide?: () => void;
/** An image / video / edit chip: Home switches its composer instead of leaving the page. */
onMode?: (mode: IntentMode) => void;
@@ -162,10 +160,6 @@ export function GetStarted({
const mode = status?.engineMode ?? cachedMode;
// Where this page is: unknown in the server's HTML (Home's static shell), so the GPU card waits for it there.
const place = usePagePlace();
- // "Just try it": the owner's demo, never a visitor's, and not when the demo is off (a run then asks for a GPU instead).
- // Unknown (undefined) in Home's static shell.
- const demo = status ? !status.viewer && status.demoMode !== "off" : undefined;
-
const hide = async () => {
setHiding(true);
try {
@@ -191,10 +185,8 @@ export function GetStarted({
</h2>
<p className="mt-1 text-[13px] text-muted-foreground">
{status && nothingConnected(status)
- ? status.demoMode === "off"
- ? "Nothing is connected yet. Connect a model to make the real thing:"
- : "Nothing is connected yet, so every run is a free demo with placeholder results. Connect a model to make the real thing:"
- : "Three ways to make things with Fuobe. Connect another one, or check one you set up:"}
+ ? "Nothing is connected yet. Connect a model to make the real thing:"
+ : "The ways to make things with Fuobe. Connect another one, or check one you set up:"}
</p>
</div>
<Button variant="ghost" size="sm" className="-mt-1 -mr-2 shrink-0 text-muted-foreground" disabled={hiding} onClick={() => void hide()} aria-label="Hide the setup guide">
@@ -202,7 +194,7 @@ export function GetStarted({
</Button>
</div>
- <div className={cn("mt-4 grid gap-3", mode === "both" && demo !== false ? "lg:grid-cols-3" : "md:grid-cols-2")}>
+ <div className="mt-4 grid gap-3 md:grid-cols-2">
{mode !== "open" && (
<GuideCard icon={Cloud} title="Use paid models" cost={prices ? `Pay per run with your own key: ${prices}` : "Pay per run with your own key"}>
<p className="text-[13px] leading-relaxed text-muted-foreground">The Fuobe Originals hosted on open weights, plus Nano Banana, Seedance, Kling, Veo and many more, through one fal.ai key. A Replicate token works too (Settings).</p>
@@ -259,22 +251,6 @@ export function GetStarted({
/>
</GuideCard>
)}
- {/* The owner's demo: not in the first paint (a visitor of a public studio never sees it). */}
- {demo && (
- <GuideCard icon={Sparkles} title="Just try it" cost="Free: no keys, no GPU">
- <p className="text-[13px] leading-relaxed text-muted-foreground">Click through every studio with clearly labelled placeholder results. You can connect a model later in Settings.</p>
- <Button
- variant="outline"
- className="mt-auto w-full sm:w-fit"
- disabled={hiding}
- onClick={async () => {
- if (await hide()) onDemo?.();
- }}
- >
- Try the demo
- </Button>
- </GuideCard>
- )}
</div>
{intents && (
diff --git a/src/components/gpu/connect-choice.tsx b/src/components/gpu/connect-choice.tsx
index 1b6151db..5bc96549 100644
--- a/src/components/gpu/connect-choice.tsx
+++ b/src/components/gpu/connect-choice.tsx
@@ -305,7 +305,20 @@ export function HostedRefusal({ line }: { line: string }) {
* `onlyAddress`: the address alone (the first-run guide). On a hosted page the second ComfyUI (the isolated worker) is
* only in Settings (`advanced`), never in the connect dialog.
*/
-export function OwnerServerComfy({ hosted, computer = false, onlyAddress = false, advanced = false }: { hosted: boolean; computer?: boolean; onlyAddress?: boolean; advanced?: boolean }) {
+export function OwnerServerComfy({
+ hosted,
+ computer = false,
+ onlyAddress = false,
+ advanced = false,
+ onConnected: then,
+}: {
+ hosted: boolean;
+ computer?: boolean;
+ onlyAddress?: boolean;
+ advanced?: boolean;
+ /** After a green test: the card a refused run opened closes, and the run starts. */
+ onConnected?: () => void;
+}) {
const qc = useQueryClient();
const settings = useSettings().data;
const status = useStatus().data;
@@ -317,6 +330,7 @@ export function OwnerServerComfy({ hosted, computer = false, onlyAddress = false
const connected = (r: { detail: string }) => {
toast.success("ComfyUI connected", { description: r.detail });
void qc.invalidateQueries({ queryKey: ["viewer"] });
+ then?.();
};
return (
<div className="space-y-4">
@@ -512,7 +526,7 @@ function OwnerChoice({ fromRun, kind, reason, onStart, onNotNow, className, look
// Opens by itself for a server address of the owner's: connected, or saved and one the server may call from here.
const usable = !!address?.isSet && !(hosted && refusedOnHosted(addressKind(address.value), allowPrivate));
const open = serverOpen ?? (serverConnected || usable);
- const serverForm = <OwnerServerComfy hosted={hosted} computer={computer} advanced={advanced} />;
+ const serverForm = <OwnerServerComfy hosted={hosted} computer={computer} advanced={advanced} onConnected={fromRun ? onStart : undefined} />;
const findHere = {
label: "Use the ComfyUI on this computer",
go: () => {
diff --git a/src/components/guest-prompt.tsx b/src/components/guest-prompt.tsx
index 843d1d1c..7d2cb2f7 100644
--- a/src/components/guest-prompt.tsx
+++ b/src/components/guest-prompt.tsx
@@ -1,7 +1,7 @@
"use client";
import { useQueryClient } from "@tanstack/react-query";
-import { Cpu, LogIn, Sparkles } from "lucide-react";
+import { Cpu, ExternalLink, KeyRound, LogIn, Sparkles } from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
@@ -11,7 +11,21 @@ import { takeGpuRetry } from "@/hooks/use-gpu";
import { KeyInstead } from "@/components/keys/your-keys";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
-import { CONNECT_GPU_EVENT, GUEST_PROMPT_EVENT, refusalCard, signInHref, useStatus, useViewer, watchGuestRefusals, type ConnectGpuDetail as ConnectDetail, type RefusalAction, type RefusalCard } from "@/lib/api";
+import {
+ CONNECT_GPU_EVENT,
+ GUEST_PROMPT_EVENT,
+ refusalCard,
+ signInHref,
+ useStatus,
+ useViewer,
+ watchGuestRefusals,
+ type ConnectGpuDetail as ConnectDetail,
+ type ConnectNeeds,
+ type RefusalAction,
+ type RefusalCard,
+} from "@/lib/api";
+import { ConnectField, useSettings } from "@/components/connect-field";
+import { FAL_KEYS_URL } from "@/lib/connections";
import { CLOUD_KEY } from "@/lib/your-keys";
/**
@@ -37,6 +51,8 @@ export function GuestPrompt() {
const [retry, setRetry] = useState<{ retry: () => void; kind?: string } | null>(null);
// Opened by a button that said "Use the ComfyUI on this computer": the finder looks at once.
const [look, setLook] = useState(false);
+ // The owner's refused run (Demo mode off, nothing connected): what would run it. A GPU when not said.
+ const [needs, setNeeds] = useState<ConnectNeeds>("gpu");
const close = useCallback(() => {
setOpen(false);
setRetry(null);
@@ -52,6 +68,14 @@ export function GuestPrompt() {
was.current = who?.signedIn ? (who.owner ? "owner" : "account") : null;
}, [who]);
const [signedOut, setSignedOut] = useState<"owner" | "account" | null>(null);
+ // The owner's own refused run (never an account's: theirs has "Add your key" of its own).
+ const ownerRun = !!who?.owner && action === "run" && !reason;
+ const keyOnly = ownerRun && needs === "key";
+ const start = () => {
+ const r = retry;
+ close();
+ r?.retry();
+ };
useEffect(() => {
watchGuestRefusals();
const show = (kind: RefusalCard["kind"]) => {
@@ -86,6 +110,7 @@ export function GuestPrompt() {
setReason(d.reason);
setAction(d.action ?? "connect");
setLook(!!d.look);
+ setNeeds(d.needs ?? "gpu");
};
window.addEventListener(GUEST_PROMPT_EVENT, guest);
window.addEventListener(CONNECT_GPU_EVENT, gpu);
@@ -113,11 +138,15 @@ export function GuestPrompt() {
<>
<DialogHeader>
<div className="mb-1 grid size-10 place-items-center rounded-xl bg-primary text-primary-foreground">
- <Cpu className="size-5" />
+ {keyOnly ? <KeyRound className="size-5" /> : <Cpu className="size-5" />}
</div>
- <DialogTitle>{reason ? TITLES[reason] : action === "upload" && !keysAllowed ? "Connect your GPU to add your own files" : TITLES[action]}</DialogTitle>
+ <DialogTitle>
+ {reason ? TITLES[reason] : keyOnly ? "Add an API key to run this" : action === "upload" && !keysAllowed ? "Connect your GPU to add your own files" : TITLES[action]}
+ </DialogTitle>
<DialogDescription>
- {!reason && action === "upload" ? (
+ {keyOnly ? (
+ "This model runs in the cloud with your own fal.ai or Replicate key. Runs are billed to your account with them."
+ ) : !reason && action === "upload" ? (
keysAllowed ? (
"Your files are kept for your own runs, on your own ComfyUI or with your own fal.ai or Replicate key."
) : (
@@ -134,18 +163,9 @@ export function GuestPrompt() {
</DialogHeader>
{/* No key yet: "Add a key" opens here, over the studio (this card makes room). */}
<KeyInstead onOpen={close} />
- <ConnectChoice
- fromRun={!!retry}
- kind={retry?.kind}
- reason={reason}
- look={look}
- onStart={() => {
- const r = retry;
- close();
- r?.retry();
- }}
- onNotNow={() => setRetry(null)}
- />
+ {!keyOnly && <ConnectChoice fromRun={!!retry} kind={retry?.kind} reason={reason} look={look} onStart={start} onNotNow={() => setRetry(null)} />}
+ {/* The owner's refused run a fal.ai or Replicate key would run: the key right here, and the run starts once it's saved. */}
+ {ownerRun && needs !== "gpu" && <OwnerKey alone={keyOnly} onConnected={start} />}
</>
) : signedOut ? (
<>
@@ -216,3 +236,34 @@ function CloseOnNavigation({ close }: { close: () => void }) {
useEffect(() => close(), [pathname, close]);
return null;
}
+
+/**
+ * The owner's fal.ai key, right in the card a refused run opened (Demo mode off, nothing connected): a green test saves
+ * it and the run starts. `alone`: the key is the only way (a cloud model); otherwise it is the second way, under the GPU.
+ */
+function OwnerKey({ alone, onConnected }: { alone: boolean; onConnected: () => void }) {
+ const setting = useSettings().data?.find((s) => s.name === "falKey");
+ return (
+ <div className={alone ? "space-y-2" : "space-y-2 rounded-2xl border border-dashed p-4"}>
+ {!alone && <p className="text-[13px] font-medium">Or add an API key</p>}
+ <ConnectField
+ name="falKey"
+ setting={setting}
+ provider="fal"
+ label="fal.ai API key"
+ placeholder="key_id:key_secret"
+ onConnected={onConnected}
+ hint={
+ <span className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <a href={FAL_KEYS_URL} target="_blank" rel="noreferrer" className="inline-flex items-center gap-1 text-brand-text underline-offset-2 hover:underline">
+ Get a key at fal.ai <ExternalLink className="size-3" />
+ </a>
+ <Link href="/settings#cloud" className="text-brand-text underline-offset-2 hover:underline">
+ A Replicate token instead
+ </Link>
+ </span>
+ }
+ />
+ </div>
+ );
+}
diff --git a/src/components/home-view.tsx b/src/components/home-view.tsx
index 5fef019f..d1ebd514 100644
--- a/src/components/home-view.tsx
+++ b/src/components/home-view.tsx
@@ -18,6 +18,7 @@ import { EngineSwitch } from "@/components/studio/engine-switch";
import type { Generation } from "@/lib/catalog/types";
import { issueStartToken, START_PARAM } from "@/lib/composer";
import { FIRST_RUN_KEY, FIRST_RUN_SCRIPT, FUOBE_REPO, nothingConnected as noConnection, showFirstRun, startLine, type StartQuote } from "@/lib/connections";
+import { placeholdersOn } from "@/lib/demo-mode";
import { userTitle } from "@/lib/library";
import { NEW_CREATION_PARAM } from "@/lib/nav";
import { cn } from "@/lib/utils";
@@ -393,7 +394,6 @@ export function HomeView({
className={cn("mt-6 max-w-[960px]", !status && "hidden [html[data-first-run='1']_&]:block")}
status={status}
prices={prices}
- onDemo={focusComposer}
onMode={(id) => {
setMode(MODES.find((m) => m.id === id) ?? MODES[0]);
focusComposer();
@@ -402,13 +402,13 @@ export function HomeView({
</>
) : nothingConnected && !status?.viewer && (
<p className="mt-4 text-[13px] text-muted-foreground">
- {/* With the demo off, a run asks for a GPU or a key: no promise of placeholders. */}
- {status?.demoMode === "off" ? (
- "Nothing is connected yet. "
- ) : (
+ {/* Placeholders on (Settings, for a tour): say so; otherwise a run asks for a GPU or a key. */}
+ {placeholdersOn(status?.demoMode) ? (
<>
- You’re in <span className="font-medium text-foreground">demo mode</span> — outputs are placeholders.{" "}
+ <span className="font-medium text-foreground">Placeholder results are on</span>, so runs make stand-ins.{" "}
</>
+ ) : (
+ "Nothing is connected yet. "
)}
{hostedPage && engineMode !== "cloud" ? (
<button type="button" onClick={() => window.dispatchEvent(new Event(CONNECT_GPU_EVENT))} className="text-brand-text underline underline-offset-2">
@@ -419,7 +419,7 @@ export function HomeView({
{engineMode === "open" ? "Connect ComfyUI" : engineMode === "cloud" ? "Add a fal.ai or Replicate key" : "Add a fal.ai key or connect ComfyUI"}
</Link>
)}{" "}
- {status?.demoMode === "off" ? "to make the real thing." : "to generate for real."}
+ to make the real thing.
</p>
)}
</div>
diff --git a/src/components/home/home-sections.tsx b/src/components/home/home-sections.tsx
index 33fc0301..7acdabe1 100644
--- a/src/components/home/home-sections.tsx
+++ b/src/components/home/home-sections.tsx
@@ -363,7 +363,7 @@ export function StartSection() {
<div className="min-w-0 rounded-2xl bg-media p-5 text-white ring-1 ring-white/10 lg:col-span-7">
<p className="text-[15px] font-medium">Or run all of Fuobe yourself</p>
<p className="mt-1 text-[13px] text-white/70">
- MIT licence. Keys, settings and results stay on your machine. Demo mode works with nothing connected.
+ MIT licence. Keys, settings and results stay on your machine.
</p>
<div className="mt-4 min-w-0 overflow-hidden rounded-xl bg-white/[0.04] ring-1 ring-white/10">
<div className="flex items-center justify-between py-2 pr-2 pl-4">
diff --git a/src/components/library/asset-card.tsx b/src/components/library/asset-card.tsx
index 95d6b71a..06bdfa63 100644
--- a/src/components/library/asset-card.tsx
+++ b/src/components/library/asset-card.tsx
@@ -10,6 +10,7 @@ import { elapsed, timeAgo } from "@/lib/format";
import { coverOf, trashDaysLeft, userTitle, type LibraryEntry } from "@/lib/library";
import { isLayered, shownOutputs } from "@/lib/output-actions";
import { cn } from "@/lib/utils";
+import { PlaceholderChip } from "@/components/demo-mode";
import { DRAG_TYPE } from "./folders";
import { ReviewBadge } from "./review";
import type { Layout } from "./view-options";
@@ -236,6 +237,7 @@ export const AssetCard = memo(function AssetCard({
<span className="truncate text-[14px] font-medium">{title}</span>
{g.pinnedAt && !stack && !trashed && <Pin className="size-3 shrink-0 text-muted-foreground" aria-label="Pinned" />}
{!stack && !trashed && <ReviewBadge status={g.review} className="bg-muted" />}
+ {!stack && !selecting && <PlaceholderChip g={g} className="h-6 shrink-0 px-2 text-[11px]" />}
</p>
<p className="truncate text-[12px] text-muted-foreground">
{stack ? `${stack.label} · ` : `${g.modelName ?? g.modelId} · ${OPERATION_LABELS[g.op]} · `}
@@ -307,6 +309,10 @@ export const AssetCard = memo(function AssetCard({
</div>
)}
{badges}
+ {/* A placeholder says so on the card, past the select dot (not while selecting: a tap there selects). */}
+ {!stack && done && !selecting && !trashed && (
+ <PlaceholderChip g={g} overlay className={cn("absolute top-2", audio && canHover && "group-focus-within/card:opacity-0 group-hover/card:opacity-0")} />
+ )}
<SelectDot selected={selected} visible={selecting} onToggle={(s) => api.toggle(entry.key, ids, s)} label={`Select ${title}`} />
{actions}
{!stack && (g.status === "failed" || g.status === "canceled") && !trashed && !selecting && (
diff --git a/src/components/model3d/model-card.tsx b/src/components/model3d/model-card.tsx
index e135779b..3f18663a 100644
--- a/src/components/model3d/model-card.tsx
+++ b/src/components/model3d/model-card.tsx
@@ -13,6 +13,7 @@ import { toastError } from "@/lib/refusals";
import { loadModelViewer, TURNTABLE_BACKDROP, useViewerSrc, viewerLook } from "./model-viewer";
import type { Model3dInfo } from "./model3d-studio";
import { RigDialog } from "./rig-dialog";
+import { PlaceholderChip } from "@/components/demo-mode";
import { recordableType, recordTurntable } from "./turntable";
/** Downloads besides the main file, by the name the provider gave them. */
@@ -240,7 +241,7 @@ export function ModelCard({ g, info, cloudAllowed }: { g: Generation; info: Reco
Recording the turntable… {Math.round(recording * 100)}%
</div>
)}
- {g.provider === "mock" && <span className="absolute top-3 left-3 rounded-full bg-highlight/40 px-2 py-0.5 text-[11px] font-medium">Demo</span>}
+ <PlaceholderChip g={g} className="absolute top-3 left-3 bg-highlight/40 text-foreground dark:text-foreground" />
{choices.length > 1 && recording === null && (
<div role="radiogroup" aria-label="Show" className="absolute top-3 right-3 inline-flex max-w-[calc(100%-1.5rem)] flex-wrap justify-end rounded-full bg-background/85 p-0.5 shadow-soft backdrop-blur">
{choices.map((c) => (
diff --git a/src/components/moodboards/create-moodboard.tsx b/src/components/moodboards/create-moodboard.tsx
index 5553b171..31d3a596 100644
--- a/src/components/moodboards/create-moodboard.tsx
+++ b/src/components/moodboards/create-moodboard.tsx
@@ -16,6 +16,7 @@ import { toastError } from "@/lib/refusals";
import { useMoodboardActions } from "./hooks";
import { loadImage, pixelsOf, renderCollages } from "./images";
import { colorFeature, COPY, imageProblem, moodboardError, MOODBOARD_LIMITS, representativeOrder, suggestMoodboardName, type Moodboard } from "./logic";
+import { placeholdersOn } from "@/lib/demo-mode";
interface Item {
id: string;
@@ -147,7 +148,7 @@ export function CreateMoodboardDialog({ open, onOpenChange, onCreated }: { open:
const n = Math.min(items.length, MOODBOARD_LIMITS.refs);
const st = status.data;
const fal = !!st?.providers.fal?.configured;
- const demo = st?.demoMode === "on" || (!fal && st?.demoMode !== "off");
+ const demo = placeholdersOn(st?.demoMode);
const how =
engine === "open"
? `Open source: collages for Qwen-Image-Edit from the ${n} most representative images`
diff --git a/src/components/settings-form.tsx b/src/components/settings-form.tsx
index 50ebb92c..5fed27c0 100644
--- a/src/components/settings-form.tsx
+++ b/src/components/settings-form.tsx
@@ -3,7 +3,6 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { CheckCircle2, CircleAlert, Cloud, Cpu, ExternalLink, Info, Layers, Link2, Loader2, RefreshCw, Scale } from "lucide-react";
import Link from "next/link";
-import { useRouter } from "next/navigation";
import { useEffect, useState, useSyncExternalStore } from "react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
@@ -12,6 +11,8 @@ import { usePagePlace } from "@/components/gpu/use-local-comfy";
import { Label } from "@/components/ui/label";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Skeleton } from "@/components/ui/skeleton";
+import { Switch } from "@/components/ui/switch";
+import { PLACEHOLDER_SETTING, placeholdersOn } from "@/lib/demo-mode";
import { AccountsChip } from "@/components/accounts-admin";
import { ConnectField, useSettings, type PublicSetting } from "@/components/connect-field";
import { GetStarted } from "@/components/get-started";
@@ -491,7 +492,6 @@ function LocalComfy({ get, onWhere }: { get: (n: string) => PublicSetting | unde
export function SettingsForm({ prices }: { prices?: string }) {
const qc = useQueryClient();
- const router = useRouter();
const settings = useSettings();
const status = useStatus().data;
const place = usePagePlace();
@@ -544,7 +544,6 @@ export function SettingsForm({ prices }: { prices?: string }) {
status={status}
prices={prices}
intents={false}
- onDemo={() => router.push("/")}
onHide={() => {
setGuide(false);
if (window.location.hash === "#get-started") history.replaceState(null, "", window.location.pathname);
@@ -729,18 +728,27 @@ export function SettingsForm({ prices }: { prices?: string }) {
<SecuritySettings />
</Section>
- <Section id="demo" title="Demo mode" description="Lets you click through everything without keys or a GPU. Demo runs return clearly-labelled placeholder media and cost nothing.">
- <ChoiceField
- id="setting-demo"
- label="Demo mode"
- value={get("demoMode")?.value || "auto"}
- onChange={set("demoMode")}
- options={[
- { value: "auto", label: "Automatic", hint: "A demo only when the model you picked isn't connected." },
- { value: "on", label: "Always demo", hint: "Every run is a free placeholder, even with keys or ComfyUI connected." },
- { value: "off", label: "Never", hint: "A model that isn't connected shows an error instead of a demo." },
- ]}
- />
+ <Section
+ id="demo"
+ title="Placeholder results"
+ description="Off unless you turn it on. For giving a tour of this studio without keys or a GPU: runs cost nothing and make stand-in media instead of the real thing."
+ >
+ <label htmlFor="setting-demo" className="flex cursor-pointer items-start justify-between gap-4 rounded-xl border bg-background p-4">
+ <span className="min-w-0 space-y-1">
+ <span className="block text-[14px] font-medium">{PLACEHOLDER_SETTING}</span>
+ <span className="block text-[13px] leading-relaxed text-muted-foreground">
+ While it&rsquo;s on, every run makes a placeholder labelled &ldquo;Placeholder&rdquo;, even with keys or ComfyUI connected, and the sidebar says
+ &ldquo;Placeholders on&rdquo;. While it&rsquo;s off, a run with nothing connected asks you to connect ComfyUI or add a key.
+ </span>
+ </span>
+ <Switch
+ id="setting-demo"
+ className="mt-0.5"
+ checked={placeholdersOn(get("demoMode")?.value)}
+ disabled={save.isPending}
+ onCheckedChange={(on) => set("demoMode")(on ? "on" : "off")}
+ />
+ </label>
</Section>
<Section
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index d7ea0248..e9252146 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -96,6 +96,7 @@ import { RECENT_MODELS, useStoredList } from "./stored-list";
import { usePresetUrl, useStartRequest, useStudio, type Draft } from "./studio-context";
import { useEdgeFade } from "./use-edge-fade";
import { useSignature } from "../palettes/use-signature";
+import { placeholdersOn } from "@/lib/demo-mode";
const EMPTY: StudioElement[] = [];
@@ -560,9 +561,9 @@ export function Composer({ docked }: { docked: boolean }) {
const missing = firstMissingSlot(askedSlots, draft.slots, anyOf);
const uploading = Object.values(draft.slots).some((v) => v?.uploading) || draft.refs.some((r) => r.uploading) || (framesOn && framesUploading(draft.frames));
// Export without a ComfyUI to write it (none connected, or the install runs cloud APIs only): say so and offer the cloud route.
- // A cloud-only install refuses open models, and with demo mode off nothing else runs it, so Generate says why.
+ // A cloud-only install refuses open models, and without placeholder results nothing else runs it, so Generate says why.
const comfyMissing = !!config.comfyOnly && !!status && (engineMode === "cloud" || !status.providers.comfyui?.configured);
- const comfyBlock = comfyMissing && model?.engine === "open" && (engineMode === "cloud" || status?.demoMode === "off") ? "Needs ComfyUI: see the note below" : null;
+ const comfyBlock = comfyMissing && model?.engine === "open" && (engineMode === "cloud" || !placeholdersOn(status?.demoMode)) ? "Needs ComfyUI: see the note below" : null;
const accessError = offModel && !presetFallback && (!fallback || lockedModel) ? `${offModel.name} is turned off in Settings → Models & licences` : null;
const engineError =
(lockedModel && preset && !appIds.length ? `${preset.name} has no ${engine === "open" ? "open-source" : "cloud"} version yet` : null) ?? accessError ?? comfyBlock;
@@ -743,7 +744,7 @@ export function Composer({ docked }: { docked: boolean }) {
const video = draft.slots.video?.ref;
const alternative = config.comfyOnly?.alternative;
const alternativeHref = alternative && `${alternative.href}${video?.startsWith("/api/files/") ? `&video=${encodeURIComponent(video)}` : ""}`;
- const demo = !!(model && status && status.demoMode !== "off" && !model.routes.some((r) => status.providers[r.provider]?.configured));
+ const demo = !!(model && placeholdersOn(status?.demoMode));
// On the open engine every run is free on the GPU: said even before the run can be planned (no voice sample, no clip yet).
const costText = costLabel({ demo, cost: cost ?? (engine === "open" && model ? 0 : null), unknown: loraPriceUnknown }, formatCost);
// An account's paid run is billed to its own provider account (Your keys), or still needs that key.
@@ -1268,7 +1269,7 @@ export function Composer({ docked }: { docked: boolean }) {
</TooltipTrigger>
<TooltipContent className="max-w-72">
{demo
- ? "Demo mode: no key connected for this model, so outputs are free placeholders"
+ ? "Placeholder results are on (Settings), so outputs are free stand-ins"
: cost === 0
? "Runs on your own GPU"
: missingKey
diff --git a/src/components/studio/feed.tsx b/src/components/studio/feed.tsx
index 3e83dcdf..9dfd7dde 100644
--- a/src/components/studio/feed.tsx
+++ b/src/components/studio/feed.tsx
@@ -27,6 +27,7 @@ import { toastError } from "@/lib/refusals";
import { ACTION_ICONS, TileActions, useCanHover, type RunnerOptions } from "./result-actions";
import { LayersStack, MediaThumb } from "./result-media";
import { useNow } from "./use-now";
+import { PlaceholderChip } from "@/components/demo-mode";
import { Viewer } from "./viewer";
export { MediaThumb } from "./result-media";
@@ -228,6 +229,12 @@ const OutputTile = memo(function OutputTile({ g, index, ratio, layered, count }:
className="pointer-events-none absolute inset-0 rounded-xl outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"
/>
{o.draftId && <DraftButton g={g} draftId={o.draftId} />}
+ {/* A placeholder says so on the picture itself, with the ways out (a text card keeps its header clear: the chip goes at the bottom). */}
+ <PlaceholderChip
+ g={g}
+ overlay
+ className={cn("absolute", o.kind === "text" ? "bottom-2" : o.draftId ? "top-11" : "top-2", audio && canHover && "group-focus-within/tile:opacity-0 group-hover/tile:opacity-0")}
+ />
{g.favorite && <Heart className={cn("absolute top-2 right-2 size-4 fill-highlight text-highlight drop-shadow", audio && canHover && "group-focus-within/tile:opacity-0 group-hover/tile:opacity-0")} />}
{canHover && hot === "bar" && (
<TileActions
diff --git a/src/components/studio/model-picker.tsx b/src/components/studio/model-picker.tsx
index b345dd02..fd4964d8 100644
--- a/src/components/studio/model-picker.tsx
+++ b/src/components/studio/model-picker.tsx
@@ -22,6 +22,7 @@ import { EngineSwitch } from "./engine-switch";
import { ResponsivePanel } from "./responsive-panel";
import { RECENT_MODELS, STARRED_MODELS, useStoredList } from "./stored-list";
import { VendorMark } from "./vendor-mark";
+import { placeholdersOn } from "@/lib/demo-mode";
const BADGE_LABEL: Record<string, string> = {
new: "New",
@@ -296,9 +297,7 @@ function PickerList({
return recipe && models.some((m) => m.id === recipe && m.engine === engine) ? [recipe, ...ranked.filter((id) => id !== recipe)] : ranked;
}, [models, engine, defaultModels, ops, recipe]);
const { groups, count } = useMemo(() => groupModels({ models, engine, engines, query: q, recent, starred, best, flat }), [models, engine, engines, q, recent, starred, best, flat]);
- const ready = (m: ModelDef) => m.routes.some((r) => status?.providers[r.provider]?.configured);
- const shown = groups.flatMap((g) => g.models);
- const demo = status && status.demoMode !== "off" && shown.some((m) => !ready(m));
+ const demo = placeholdersOn(status?.demoMode);
const otherEngine = engine === "cloud" ? "open" : "cloud";
const noneForEngine = !q && !models.some((m) => m.engine === engine);
@@ -364,9 +363,9 @@ function PickerList({
<>
<span aria-hidden>·</span>
<span className="min-w-0">
- Demo — no key connected, outputs are placeholders.{" "}
- <Link href="/settings" className="text-brand-text underline underline-offset-2">
- Connect
+ Placeholder results are on, so outputs are stand-ins.{" "}
+ <Link href="/settings#demo" className="text-brand-text underline underline-offset-2">
+ Settings
</Link>
</span>
</>
diff --git a/src/components/studio/viewer.tsx b/src/components/studio/viewer.tsx
index 5e5dc341..31d58f79 100644
--- a/src/components/studio/viewer.tsx
+++ b/src/components/studio/viewer.tsx
@@ -19,6 +19,7 @@ import { CompareSlider } from "./compare-slider";
import { ACTION_ICONS, downloadUrl, SaveElementForm, useActionRunner } from "./result-actions";
import { LayersStack, ModelViewer, TextReader, VideoFileCard } from "./result-media";
import { ReviewSelect } from "@/components/library/review";
+import { PlaceholderChip } from "@/components/demo-mode";
/** One line of the details; `center` lines the label up with a control (the Review picker) instead of a text value's first line. */
@@ -313,6 +314,8 @@ export function Viewer({
<div className="relative flex min-w-0 flex-1 flex-col bg-media">
<div className="relative flex min-h-0 flex-1 items-center justify-center p-0 md:p-2" onTouchStart={onTouchStart} onTouchEnd={onTouchEnd}>
{media}
+ {/* A placeholder says so here too, with the ways out (clear of the phone's close button on the right). */}
+ <PlaceholderChip g={g} overlay className="absolute top-3 left-3 right-16 md:right-3" />
{source && (
<button
onClick={() => setComparing((v) => !v)}
diff --git a/src/components/swap-studio/workbench.tsx b/src/components/swap-studio/workbench.tsx
index 85836566..d0941f31 100644
--- a/src/components/swap-studio/workbench.tsx
+++ b/src/components/swap-studio/workbench.tsx
@@ -242,7 +242,7 @@ function ProjectPanel({ project, estimate, edit }: { project: SwapProject; estim
<dd className="mt-0.5 font-medium">{project.engine === "open" ? "Your GPU (ComfyUI)" : "Cloud (fal)"}</dd>
</div>
</dl>
- {estimate?.demo && <Note className="mt-2">Demo mode: nothing is paid for and the takes are sample clips. Connect {project.engine === "open" ? "ComfyUI" : "fal"} in Settings to run it for real.</Note>}
+ {estimate?.demo && <Note className="mt-2">Placeholder results: nothing is paid for and the takes are sample clips. Connect {project.engine === "open" ? "ComfyUI" : "fal"} in Settings to run it for real.</Note>}
<Button asChild variant="outline" size="sm" className="mt-3 w-full rounded-full sm:hidden">
<a href={decisionsHref(project.id)} download>
<Download className="size-4" /> Export decisions
diff --git a/src/components/workflows-view.tsx b/src/components/workflows-view.tsx
index 191e7e11..727228e5 100644
--- a/src/components/workflows-view.tsx
+++ b/src/components/workflows-view.tsx
@@ -90,7 +90,7 @@ function OwnerBanner({ data }: { data: ComfyStatus }) {
<div className={cls(false)}>
<CircleAlert className="size-4 shrink-0 text-warning" />
<span className="min-w-0 flex-1 basis-56">
- {status?.demoMode === "off" ? "ComfyUI is not reachable, so open-source runs can’t start." : "ComfyUI is not reachable, so open-source runs fall back to demo output."}
+ {status?.demoMode === "on" ? "ComfyUI is not reachable. Placeholder results are on, so runs make stand-ins." : "ComfyUI is not reachable, so open-source runs can’t start."}
</span>
<Link href="/settings#comfyui" className={link}>
Server settings
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 2f85970c..c2ddecf5 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -5,7 +5,6 @@ import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from "r
import { toast } from "sonner";
import type { AssistThread, AssistThreadSummary, AssistThreadView } from "./assist";
import type { OwnerGpuView, TestProvider } from "./connections";
-import { pagePlace } from "./page-place";
import type { ElementKind, StudioElement } from "./catalog/elements";
import type { Engine, Generation, GenerationRequest, MediaKind, ReviewStatus } from "./catalog/types";
import {
@@ -1242,12 +1241,16 @@ export const CONNECT_GPU_EVENT = "fuobe:connect-gpu";
/**
* What opened "Connect your GPU": `action` a refusal (watchGuestRefusals, or a file chooser that asks first): a refused
* run's card keeps that run and starts it once connected; `reason` the runner's note; `look` a button that said "Use the
- * ComfyUI on this computer". With none of them, a button that only opens the card: no run waits.
+ * ComfyUI on this computer". With none of them, a button that only opens the card: no run waits. `needs`: what would
+ * run the owner's refused run (Demo mode off, nothing connected): a GPU, a fal.ai or Replicate key, or either.
*/
export interface ConnectGpuDetail extends RefusalDetail {
reason?: "setting" | "find" | "browser";
look?: boolean;
+ needs?: ConnectNeeds;
}
+export type ConnectNeeds = "gpu" | "key" | "any";
+const asNeeds = (v: string | null): ConnectNeeds | undefined => (v === "gpu" || v === "key" || v === "any" ? v : undefined);
/** A run started from this tab (components/gpu/computer-runtime.ts listens). */
export const COMPUTER_KICK_EVENT = "fuobe:computer-kick";
/** The guided fix (src/components/gpu/guided-fix.tsx): { ref, plan? }. */
@@ -1327,7 +1330,8 @@ export function watchGuestRefusals(): void {
const open = (res: Response, kind: RefusalCard["kind"], path: string) => {
if (!refusalCard(kind, window.location)) return;
markRefusalShown(res);
- const detail: RefusalDetail = { action: UPLOAD_PATHS.has(path) ? "upload" : "run" };
+ const needs = asNeeds(res.headers.get("x-fuobe-connect-needs"));
+ const detail: ConnectGpuDetail = { action: UPLOAD_PATHS.has(path) ? "upload" : "run", ...(needs && { needs }) };
window.dispatchEvent(new CustomEvent(kind === "guest" ? GUEST_PROMPT_EVENT : CONNECT_GPU_EVENT, { detail }));
};
window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
@@ -1335,9 +1339,9 @@ export function watchGuestRefusals(): void {
const method = (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
if (res.status === 401 && res.headers.get("x-fuobe-guest") === "1" && method !== "GET" && method !== "HEAD") open(res, "guest", requestPath(input));
if (res.status === 403 && res.headers.get("x-fuobe-connect-gpu") === "1") open(res, "gpu", requestPath(input));
- // The owner's run with nothing connected that runs it, on a hosted studio: "Connect your GPU" too (a page on the
- // server's own machine keeps its toast: its ComfyUI is in Settings).
- if (res.status === 422 && res.headers.get("x-fuobe-connect-gpu") === "1" && pagePlace(window.location.hostname) === "hosted") open(res, "gpu", requestPath(input));
+ // The owner's run with nothing connected that runs it (Demo mode off): the connect card too, never an error toast.
+ // On a hosted page it offers the ComfyUI on this computer first; on the server's own machine, the server's address.
+ if (res.status === 422 && res.headers.get("x-fuobe-connect-gpu") === "1") open(res, "gpu", requestPath(input));
// A run started here, on the ComfyUI on this computer: the tab that runs it asks for it at once.
if (res.status === 201 && method === "POST" && requestPath(input) === "/api/generations") {
window.dispatchEvent(new Event(COMPUTER_KICK_EVENT));
diff --git a/src/lib/connections.ts b/src/lib/connections.ts
index 2169e52d..dd3b346e 100644
--- a/src/lib/connections.ts
+++ b/src/lib/connections.ts
@@ -158,7 +158,7 @@ export interface ConnectionState {
engineMode: EngineModeName;
/** The first-run guide was put away, or something this engine mode uses was connected once (Settings → `onboarded`). */
onboarded?: boolean;
- /** Settings → Demo mode: auto (a demo when no provider hosts the model), on (always a demo), off (never). */
+ /** Settings → "Show placeholder results (for a tour)": "on" makes every run a placeholder; "off" (the default) never. */
demoMode?: string;
/** The owner's ComfyUI runs on the owner's computer: what its Fuobe tab last said (GET /api/status). */
ownerGpu?: OwnerGpuView;
@@ -189,7 +189,7 @@ export function connectedEngines(s: ConnectionState): { cloud: boolean; open: bo
return { cloud: CLOUD_PROVIDERS.some((p) => s.providers[p]?.configured), open: !!s.providers.comfyui?.configured };
}
-/** Nothing this install's engine mode uses is connected, so every run is a demo. */
+/** Nothing this install's engine mode uses is connected, so a run asks to connect one (or makes a placeholder, for a tour). */
export function nothingConnected(s: ConnectionState): boolean {
const c = connectedEngines(s);
return s.engineMode === "open" ? !c.open : s.engineMode === "cloud" ? !c.cloud : !c.cloud && !c.open;
@@ -210,13 +210,13 @@ const PROVIDER_LABEL: Record<string, string> = { fal: "fal.ai", replicate: "Repl
/**
* The line under Home's composer, before Start is pressed: the model it runs and its price, or why
- * it runs a free demo (no key for a provider that hosts that model, the same rule the composer's
- * "Demo" label follows), plus the other engine when that one would run it for real. Null when
- * nothing is connected: Home's demo notice says so instead.
+ * why it can't run yet (no key for a provider that hosts that model, the same rule the composer's
+ * label follows), plus the other engine when that one would run it for real. Null when
+ * nothing is connected: Home's notice says so instead.
*/
export function startLine(s: ConnectionState, quote: StartQuote | undefined, engine: "cloud" | "open", mode: "image" | "video" | "edit"): { text: string; other?: "cloud" | "open" } | null {
if (!quote || nothingConnected(s)) return null;
- if (s.demoMode === "on") return { text: "Demo mode is on (Settings), so Start runs a free demo" };
+ if (s.demoMode === "on") return { text: "Placeholder results are on (Settings), so Start makes a stand-in" };
const hosted = (q: { providers: string[] } | null) => !!q && q.providers.some((p) => s.providers[p]?.configured);
const otherEngine = engine === "open" ? "cloud" : "open";
const other = s.engineMode === "both" && hosted(quote[otherEngine]) ? otherEngine : undefined;
@@ -229,7 +229,7 @@ export function startLine(s: ConnectionState, quote: StartQuote | undefined, eng
let why: string;
if (!connected) why = engine === "open" ? "ComfyUI isn't connected" : "No paid API is connected";
else why = q ? `${q.name} needs ${engine === "open" ? hosts : `a ${hosts} key`}` : "No model is set for this";
- return { text: `${why}, so Start ${s.demoMode === "off" ? "can't run it yet" : "runs a free demo"}`, ...(other && { other }) };
+ return { text: `${why}, so Start can't run it yet`, ...(other && { other }) };
}
/**
diff --git a/src/lib/demo-mode.ts b/src/lib/demo-mode.ts
new file mode 100644
index 00000000..31343d2c
--- /dev/null
+++ b/src/lib/demo-mode.ts
@@ -0,0 +1,53 @@
+/**
+ * Placeholder results' words and ways out, for the sidebar's "Placeholders on" chip and the "Placeholder" chip on a
+ * result (src/components/demo-mode.tsx). Pure, so the rules are tested without a browser.
+ *
+ * Placeholder results are off by default on every install: a run with nothing connected opens the connect card. The
+ * owner can turn them on in Settings to give a tour of a self-hosted studio ("Show placeholder results (for a tour)",
+ * demoMode "on"): then every run makes a labelled placeholder. Guests and accounts never get them (accounts run with
+ * demoMode "off"), so only the owner is offered a way out.
+ */
+
+/** Settings' switch. */
+export const PLACEHOLDER_SETTING = "Show placeholder results (for a tour)";
+
+/** The chip on every result the demo provider made. */
+export const PLACEHOLDER_CHIP = "Placeholder";
+
+/** The sidebar's chip while the switch is on: a click turns it off. */
+export const PLACEHOLDERS_ON = "Placeholders on";
+
+export type PlaceholderAction = "computer" | "key" | "off";
+
+export const PLACEHOLDER_ACTION_LABELS: Record<PlaceholderAction, string> = {
+ computer: "Use the ComfyUI on this computer",
+ key: "Add an API key",
+ off: "Turn off placeholder results",
+};
+
+/** A result the demo provider made (a placeholder, not the real thing). */
+export const isPlaceholder = (g: { provider?: string | null } | null | undefined): boolean => g?.provider === "mock";
+
+/** Whether the owner's runs make placeholders now: only with the switch on ("on"; anything else is off). */
+export const placeholdersOn = (demoMode: string | undefined): boolean => demoMode === "on";
+
+/**
+ * The owner's ways out from a placeholder result, in order: the ComfyUI on this computer (not in Paid APIs only
+ * mode), a fal.ai or Replicate key (not in Open source only mode), and the switch off (while it's on). Nobody else
+ * gets any.
+ */
+export function placeholderActions(f: { owner: boolean; engineMode?: string; demoMode?: string }): PlaceholderAction[] {
+ if (!f.owner) return [];
+ const out: PlaceholderAction[] = [];
+ if (f.engineMode !== "cloud") out.push("computer");
+ if (f.engineMode !== "open") out.push("key");
+ if (placeholdersOn(f.demoMode)) out.push("off");
+ return out;
+}
+
+/** The one line a placeholder result's card says. */
+export function placeholderLine(demoMode: string | undefined): string {
+ return placeholdersOn(demoMode)
+ ? "Placeholder results are on in Settings (for a tour), so every run makes a labelled stand-in, not the real thing."
+ : "A stand-in made while placeholder results were on. Connect a model and run it again for the real thing.";
+}
diff --git a/src/lib/guest-access.ts b/src/lib/guest-access.ts
index de02d5af..c6b50f95 100644
--- a/src/lib/guest-access.ts
+++ b/src/lib/guest-access.ts
@@ -239,6 +239,8 @@ export const OWN_GPU_TOOL_MESSAGE = "This tool doesn't run on your own GPU yet.
/** Set on an account's refused run: the client shows "Connect your GPU to run this". */
export const CONNECT_GPU_HEADER = "x-fuobe-connect-gpu";
+/** Beside it on the owner's refused run (Demo mode off, nothing connected): what would run it, "gpu", "key" or "any". */
+export const CONNECT_NEEDS_HEADER = "x-fuobe-connect-needs";
export const CONNECT_GPU_MESSAGE = "Connect your GPU to run this. Free accounts run on their own ComfyUI.";
/** An account's upload with neither a GPU nor a key of its own: its files are kept for runs on its own ComfyUI or key. */
export const CONNECT_GPU_UPLOAD_MESSAGE = "Connect your GPU, or add your own fal.ai or Replicate key, to add your own files.";
diff --git a/src/server/db.ts b/src/server/db.ts
index 07a713aa..56acbe02 100644
--- a/src/server/db.ts
+++ b/src/server/db.ts
@@ -714,6 +714,9 @@ function open(): Database.Database {
db.prepare("INSERT INTO _migrations (id) VALUES (?)").run(i);
})();
});
+ // Placeholder results are opt-in (settings.ts, demoMode): a saved "auto", which made a placeholder whenever the model
+ // wasn't connected, is cleared, so the install runs with the default "off". A saved "on" stays. Safe on every start.
+ db.exec("DELETE FROM settings WHERE key = 'demo.mode' AND value NOT IN ('on', 'off')");
// Assist on hosted LLM providers (src/lib/catalog/llm-providers.ts): the provider of a chat's model ("openai",
// "openrouter"…); chats from before read agent "claude" as Anthropic. Added when it's missing rather than as a
// numbered migration, so branches that add migrations never clash over its place in the list.
diff --git a/src/server/generations.ts b/src/server/generations.ts
index ed10f7d9..8669cf96 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -477,7 +477,8 @@ export function deleteGeneration(id: string): void {
// Routing
/**
- * Pick the provider for a run: a configured real provider, else the demo provider (unless demo is off).
+ * Pick the provider for a run: a configured real provider, or the demo provider when placeholder results are on
+ * (Settings, demoMode "on") or the request asks for one. With neither and nothing connected, the run is refused.
* `images` is how many images the run sends: a route whose list takes fewer (FieldMap.maxImages: Grok
* Imagine Image takes 5 on fal) gives way to one that takes them all, or says so.
* `loras` and `seconds` (the clip length asked for) prefer a route that carries every LoRA and makes that
@@ -503,22 +504,35 @@ export function chooseRoute(candidates: ModelRoute[], images = 0, loras: LoraRef
const others = [...new Set(routes.filter((r) => takes(r) && r.provider !== short.provider).map((r) => provider(r.provider).label))];
throw new Error(`This model takes up to ${short.map!.maxImages} images on ${provider(short.provider).label} — remove some${others.length ? `, or connect ${others.join(" or ")} for more` : ""}`);
}
- if (demo === "off") {
- // An account's paid model with no key of its own for any of the model's providers: "Add your key" (fal.ai first).
- const cloud = tenantAccount() ? routes.map((r) => r.provider).find(isCloudProvider) : undefined;
- if (cloud) throw new AccountRunError(paidAllowed() ? { error: addKeyMessage(cloud), code: "add-key", provider: cloud } : { error: OPEN_ONLY_RUN, code: "open-only" });
- if (routes.every((r) => r.provider === "llm")) throw new Error(llmMissing(routes[0]));
- const names = [...new Set(routes.map((r) => provider(r.provider).label))].join(" or ");
- const message = `Connect ${names} in Settings to run this model`;
- // ComfyUI could run it: the owner's own browser opens "Connect your GPU" for it (generations/route.ts).
- throw routes.some((r) => r.provider === "comfyui") ? new ConnectComfyError(message) : new Error(message);
+ // "auto", which only code in this process sets (settings.ts): a placeholder where nothing connected runs the model.
+ if (demo === "auto") return { route: routes[0], demo: true };
+ // Nothing connected runs it, and placeholders are off (the default): never a silent placeholder.
+ // An account's paid model with no key of its own for any of the model's providers: "Add your key" (fal.ai first).
+ const cloud = tenantAccount() ? routes.map((r) => r.provider).find(isCloudProvider) : undefined;
+ if (cloud) throw new AccountRunError(paidAllowed() ? { error: addKeyMessage(cloud), code: "add-key", provider: cloud } : { error: OPEN_ONLY_RUN, code: "open-only" });
+ if (routes.every((r) => r.provider === "llm")) throw new Error(llmMissing(routes[0]));
+ const names = [...new Set(routes.map((r) => provider(r.provider).label))].join(" or ");
+ const message = `Connect ${names} in Settings to run this model`;
+ // ComfyUI, or a fal.ai or Replicate key, could run it: the owner's own browser opens the connect card for it
+ // (generations/route.ts), with the way or ways that would.
+ const gpu = routes.some((r) => r.provider === "comfyui");
+ const key = !tenantAccount() && routes.some((r) => isCloudProvider(r.provider));
+ throw gpu || key ? new ConnectComfyError(message, gpu && key ? "any" : gpu ? "gpu" : "key") : new Error(message);
+}
+
+/** What would run a refused model: a GPU (ComfyUI), a fal.ai or Replicate key, or either. */
+export type ConnectNeeds = "gpu" | "key" | "any";
+
+/** A run nothing connected can make, and ComfyUI or a key could: connecting one is the way (same words as before). */
+export class ConnectComfyError extends Error {
+ constructor(
+ message: string,
+ readonly needs: ConnectNeeds = "gpu",
+ ) {
+ super(message);
}
- return { route: routes[0], demo: true };
}
-/** A run nothing connected can make, and ComfyUI could: connecting a GPU is the way (same words as before). */
-export class ConnectComfyError extends Error {}
-
/** Text steps depend on which LLM the route may use (the open model never calls Claude). */
const routeReady = (r: ModelRoute) => (r.provider === "llm" ? llmBackends(r).length > 0 : provider(r.provider).isConfigured());
diff --git a/src/server/providers/mock.ts b/src/server/providers/mock.ts
index 88093fe3..b9c131a3 100644
--- a/src/server/providers/mock.ts
+++ b/src/server/providers/mock.ts
@@ -70,7 +70,7 @@ export function demoSvg(prompt: string, aspectRatio = "1:1", variant = 0): strin
<g filter="url(#b)">${blobs}</g>
<rect width="100%" height="100%" fill="url(#s)"/>
<rect x="56" y="48" rx="18" width="176" height="40" fill="white" fill-opacity="0.18"/>
-<text x="76" y="75" font-size="20" font-family="ui-sans-serif, system-ui" font-weight="600" fill="white">DEMO OUTPUT</text>
+<text x="76" y="75" font-size="20" font-family="ui-sans-serif, system-ui" font-weight="600" fill="white">PLACEHOLDER</text>
${text}
</svg>`;
}
@@ -131,7 +131,7 @@ function demoLayers(prompt: string, aspectRatio: string, n: number): DemoOutput[
const background: DemoOutput = {
url: svgUri(
layer(
- `<rect width="100%" height="100%" fill="oklch(0.32 0.07 ${hue})"/><rect x="40" y="${h - 76}" rx="14" width="300" height="40" fill="white" fill-opacity="0.18"/><text x="58" y="${h - 49}" font-size="20" font-family="ui-sans-serif, system-ui" font-weight="600" fill="white">DEMO OUTPUT · layers</text>`,
+ `<rect width="100%" height="100%" fill="oklch(0.32 0.07 ${hue})"/><rect x="40" y="${h - 76}" rx="14" width="300" height="40" fill="white" fill-opacity="0.18"/><text x="58" y="${h - 49}" font-size="20" font-family="ui-sans-serif, system-ui" font-weight="600" fill="white">PLACEHOLDER · layers</text>`,
),
),
kind: "image",
@@ -374,7 +374,7 @@ function demoOutputs(op: Operation | undefined, kind: MediaKind, prompt: string,
export const mockProvider: ProviderAdapter = {
id: "mock",
- label: "Demo",
+ label: "Placeholder",
isConfigured: () => true,
async prepareFile(data, contentType) {
@@ -425,7 +425,7 @@ export const mockProvider: ProviderAdapter = {
const elapsed = Date.now() - Number(meta.startedAt);
const total = DURATION_MS[kind] ?? DURATION_MS.image;
if (elapsed < 600) return { state: "queued", message: "Queued (demo)" };
- if (elapsed < total) return { state: "running", progress: elapsed / total, message: "Generating demo output" };
+ if (elapsed < total) return { state: "running", progress: elapsed / total, message: "Making a placeholder" };
return { state: "succeeded", outputs: demoOutputs(meta.op as Operation | undefined, kind, String(meta.prompt), String(meta.aspectRatio), meta) };
},
diff --git a/src/server/settings.ts b/src/server/settings.ts
index c7a09030..cf6b195d 100644
--- a/src/server/settings.ts
+++ b/src/server/settings.ts
@@ -88,8 +88,14 @@ export const SETTINGS = {
aiToolkitToken: { key: "aitk.token", env: "AI_TOOLKIT_AUTH", secret: true },
/** Where AI-Toolkit can read datasets Fuobe writes (defaults to Fuobe's data folder — same machine). */
aiToolkitDatasetDir: { key: "aitk.datasetDir", env: "AI_TOOLKIT_DATASET_DIR" },
- /** "auto" = demo outputs only when the chosen provider is not configured. */
- demoMode: { key: "demo.mode", env: "FUOBE_DEMO_MODE", default: "auto", options: ["auto", "on", "off"] },
+ /**
+ * Settings → "Show placeholder results (for a tour)": "on" makes every run a labelled placeholder, for someone giving a
+ * tour of a self-hosted studio. Off by default: a run with nothing connected opens the connect card instead.
+ * "auto" (the old default: a placeholder whenever the model wasn't connected) is no longer an install's: the Settings
+ * API refuses it (API_REFUSED), FUOBE_DEMO_MODE=auto reads as "off", and a saved one is cleared on every start
+ * (db.ts). Only code in the same process can still set it, as the test suite does to mix real and placeholder routes.
+ */
+ demoMode: { key: "demo.mode", env: "FUOBE_DEMO_MODE", default: "off", options: ["off", "on", "auto"] },
/** Settings → AI helper: Claude, a local model, or offline. "ollama" is the old name of "local" and still means it. */
enhanceProvider: { key: "enhance.provider", env: "FUOBE_ENHANCE_PROVIDER", default: "auto", options: ["auto", "anthropic", "local", "ollama", "none"] },
/** Which local model server: "auto" uses the first that answers (Ollama, LM Studio, Unsloth Studio, then the custom URL). */
@@ -158,9 +164,12 @@ export function getSetting(name: SettingName): string {
const def: SettingDef = SETTINGS[name];
const candidate = candidates.getStore()?.[name];
const row = candidate !== undefined ? { value: candidate.trim() } : (db().prepare("SELECT value FROM settings WHERE key = ?").get(def.key) as { value: string } | undefined);
- const value = row && row.value !== "" ? row.value : (envValue(def) ?? def.default ?? "");
- // An invalid env/db value falls back to the default instead of breaking routing.
+ const saved = row && row.value !== "" ? row.value : undefined;
+ const value = saved ?? envValue(def) ?? def.default ?? "";
+ // An invalid env/db value falls back to the default instead of breaking routing; so does an environment variable
+ // set to a value only this process may set (FUOBE_DEMO_MODE=auto, the old default, reads as "off").
if (def.options && !def.options.includes(value)) return def.default ?? "";
+ if (saved === undefined && API_REFUSED[name]?.includes(value)) return def.default ?? "";
return value;
}
@@ -181,11 +190,18 @@ export function parseContext(value: string): number | null {
return n === 0 ? 0 : n >= 2048 ? Math.min(n, 1_048_576) : null;
}
-/** Throws a user-facing message if the setting value isn't allowed. */
-export function validateSetting(name: SettingName, value: string): void {
+/** Values a setting keeps for code in this process only: the Settings API (PUT /api/settings) refuses them. */
+const API_REFUSED: Partial<Record<SettingName, string[]>> = { demoMode: ["auto"] };
+
+/**
+ * Throws a user-facing message if the setting value isn't allowed. `from: "api"`: a value sent to the Settings API,
+ * which may not be one of API_REFUSED's (only off or on reach demoMode from outside).
+ */
+export function validateSetting(name: SettingName, value: string, from: "api" | "server" = "server"): void {
const def: SettingDef = SETTINGS[name];
- if (value !== "" && def.options && !def.options.includes(value)) {
- throw new Error(`${name} must be one of: ${def.options.join(", ")}`);
+ const options = from === "api" ? def.options?.filter((o) => !API_REFUSED[name]?.includes(o)) : def.options;
+ if (value !== "" && options && !options.includes(value)) {
+ throw new Error(`${name} must be one of: ${options.join(", ")}`);
}
if (name === "llmContext" && value !== "" && parseContext(value) === null) {
throw new Error("llmContext must be a number of tokens of at least 2048 (such as 16384 or 16k), or 0 to leave it to the server");
diff --git a/tests/account-finish-limits.test.ts b/tests/account-finish-limits.test.ts
index 84707bd7..f665872d 100644
--- a/tests/account-finish-limits.test.ts
+++ b/tests/account-finish-limits.test.ts
@@ -22,6 +22,8 @@ const finish = await import("@/app/api/generations/[id]/finish/route");
let a = "";
let cookie = "";
let owner = "";
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
beforeAll(() => {
auth.setPassword("install password");
a = auth.createAccount("[email protected]", "long enough").id;
diff --git a/tests/account-run-fairness.test.ts b/tests/account-run-fairness.test.ts
index c9e46ed1..88793223 100644
--- a/tests/account-run-fairness.test.ts
+++ b/tests/account-run-fairness.test.ts
@@ -26,6 +26,8 @@ const { resetRates } = await import("@/server/rate");
let fake: FakeComfy;
let a = "";
let cookie = "";
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
beforeAll(async () => {
fake = await startFakeComfy({ loras: [], delayMs: 0 });
globalThis.__fuobeTestGpuPort = fake.port;
diff --git a/tests/cli-api.test.ts b/tests/cli-api.test.ts
index 19041810..bca6cc89 100644
--- a/tests/cli-api.test.ts
+++ b/tests/cli-api.test.ts
@@ -1,7 +1,7 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
-import { afterAll, describe, expect, it, vi } from "vitest";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { MODELS } from "@/lib/catalog";
import { findModels, toModelInfo } from "@/lib/model-list";
@@ -18,6 +18,8 @@ const { GET: listModels } = await import("@/app/api/models/route");
const { POST: postGeneration } = await import("@/app/api/generations/route");
const { listGenerations } = await import("@/server/generations");
const { setSetting } = await import("@/server/settings");
+// Placeholders where nothing is connected, as the studio once did by default ("auto": code in this process only).
+beforeAll(() => setSetting("demoMode", "auto"));
afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
type ModelsBody = {
@@ -89,20 +91,24 @@ describe("GET /api/models", () => {
expect(byId.get("elevenlabs-v4")).not.toHaveProperty("voiceClone");
});
- it("says how a run goes today, following Settings → Demo mode the way routing does", async () => {
+ it("says how a run goes today, following Settings → Placeholder results the way routing does", async () => {
const runs = async () => {
const { body } = await models("?q=nano-banana-pro");
const m = body.items.find((x) => x.id === "nano-banana-pro")!;
return { demoMode: body.demoMode, connected: m.connected, runs: m.runs };
};
- // auto, no key: a free demo.
+ // The default (placeholders off), no key: refused, the connect card's case.
+ setSetting("demoMode", "");
+ expect(await runs()).toEqual({ demoMode: "off", connected: false, runs: "refused" });
+ // auto (code in this process only), no key: a free demo.
+ setSetting("demoMode", "auto");
expect(await runs()).toEqual({ demoMode: "auto", connected: false, runs: "demo" });
try {
setSetting("demoMode", "off");
expect(await runs()).toEqual({ demoMode: "off", connected: false, runs: "refused" });
setSetting("falKey", "fal-test-key");
expect(await runs()).toEqual({ demoMode: "off", connected: true, runs: "real" });
- // Demo mode on sends every run to the demo provider, key or not.
+ // Placeholder results on send every run to the demo provider, key or not.
setSetting("demoMode", "on");
expect(await runs()).toEqual({ demoMode: "on", connected: true, runs: "demo" });
} finally {
diff --git a/tests/e2e/fixes-5.mjs b/tests/e2e/fixes-5.mjs
index 3049b699..080dd42b 100644
--- a/tests/e2e/fixes-5.mjs
+++ b/tests/e2e/fixes-5.mjs
@@ -124,7 +124,7 @@ try {
// Edit video: Happy Horse priced on the attached clip's seconds ($0.28 a second at 720p), a 40 s clip refused.
{
const before = Object.fromEntries((await (await fetch(`${app}/api/settings`)).json()).settings.map((s) => [s.name, s.value]));
- await settings({ falKey: "e2e_key_id:e2e_key_secret", demoMode: "auto" });
+ await settings({ falKey: "e2e_key_id:e2e_key_secret", demoMode: "off" });
const { context, page } = await contextFor();
try {
await page.goto(`${app}/video-edit?model=happy-horse-video-edit`, { waitUntil: "load" });
@@ -152,7 +152,7 @@ try {
if (shots) await page.screenshot({ path: path.join(shots, "video-edit-40s-1440-light.png") });
} finally {
await context.close();
- await settings({ falKey: before.falKey ?? "", demoMode: before.demoMode ?? "auto" });
+ await settings({ falKey: before.falKey ?? "", demoMode: before.demoMode ?? "off" });
}
}
diff --git a/tests/e2e/owner-computer.mjs b/tests/e2e/owner-computer.mjs
index ba2e0591..35ede3f1 100644
--- a/tests/e2e/owner-computer.mjs
+++ b/tests/e2e/owner-computer.mjs
@@ -422,7 +422,7 @@ async function hosted() {
await stopFake(SERVER_COMFY_PORT);
// A run that went through (a demo), then "Your GPU · Connect": the card never starts that run again.
- check("demo on for a moment", (await send(page, "/api/settings", { demoMode: "auto" }, "PUT")).status === 200);
+ check("placeholders on for a moment", (await send(page, "/api/settings", { demoMode: "on" }, "PUT")).status === 200);
await until(async () => !(await api(page, "/api/status")).body?.providers?.comfyui?.configured, 30_000, 1000);
await studio(page, "/image?model=oss-z-image-turbo");
const demoRun = await generate(page, "a demo first");
@@ -581,8 +581,8 @@ async function local() {
await sleep(12_000);
await studio(page, "/image?model=oss-z-image-turbo");
await generate(page, "another one");
- const toast = await until(() => page.locator("[data-sonner-toast]").filter({ hasText: "Connect ComfyUI in Settings" }).first().isVisible(), 20_000);
- check("local: ComfyUI gone, Generate shows today's toast, no dialog", !!toast && !(await page.getByRole("dialog").isVisible().catch(() => false)));
+ const card = await until(() => page.getByRole("dialog").filter({ hasText: "Connect your GPU to run this" }).isVisible(), 20_000);
+ check("local: ComfyUI gone, Generate opens the connect card, no error toast", !!card && !(await page.locator("[data-sonner-toast]").filter({ hasText: "Connect ComfyUI in Settings" }).first().isVisible().catch(() => false)));
check("the browser reached nothing on this computer but the studio", ctx.loopback.length === 0, ctx.loopback.join(", "));
await ctx.close();
}
diff --git a/tests/eval-api.test.ts b/tests/eval-api.test.ts
index f9c768db..cdafa0f1 100644
--- a/tests/eval-api.test.ts
+++ b/tests/eval-api.test.ts
@@ -1,7 +1,7 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
-import { afterAll, describe, expect, it, vi } from "vitest";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { getModel, getPreset } from "@/lib/catalog";
import { planGeneration, routeLoras } from "@/lib/catalog/plan";
@@ -14,6 +14,8 @@ process.env.FUOBE_DATA_DIR = dir;
process.env.COMFYUI_URL = "http://127.0.0.1:9";
process.env.OLLAMA_URL = "http://127.0.0.1:9";
const { POST } = await import("@/app/api/generations/route");
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
const post = async (body: unknown, preview = true) => {
diff --git a/tests/eval-harness.test.ts b/tests/eval-harness.test.ts
index 5edb89ea..db73e3f8 100644
--- a/tests/eval-harness.test.ts
+++ b/tests/eval-harness.test.ts
@@ -406,10 +406,10 @@ describe("the runner on the demo provider", () => {
const dry = await cli(["run", "--suite", "soul", "--engine", "cloud", "--looks", "v1-general", "--dry-run"]);
expect(dry.code, dry.stderr).toBe(0);
expect(dry.stdout).toMatch(/would run as a demo: Z-Image Turbo \(hosted\) has no cloud provider connected/);
- // With Demo mode On, that is the reason given (a connected engine wouldn't help).
+ // With placeholder results on, that is the reason given (a connected engine wouldn't help).
setSetting("demoMode", "on");
try {
- expect((await cli(["run", "--suite", "soul", "--engine", "open", "--looks", "v1-general", "--dry-run"])).stdout).toMatch(/Demo mode is On on that Fuobe/);
+ expect((await cli(["run", "--suite", "soul", "--engine", "open", "--looks", "v1-general", "--dry-run"])).stdout).toMatch(/placeholder results are on on that Fuobe/);
} finally {
setSetting("demoMode", "auto");
}
diff --git a/tests/guest-prompt.test.ts b/tests/guest-prompt.test.ts
index ab062eda..226d574f 100644
--- a/tests/guest-prompt.test.ts
+++ b/tests/guest-prompt.test.ts
@@ -33,7 +33,7 @@ import { fileToSlot, type SlotValue } from "@/components/studio/media-slot";
import { useCreateSwapProject } from "@/components/swap-studio/hooks";
import { runGpuCheck } from "@/hooks/use-gpu";
import { askToSignUp, assetUsage, CONNECT_GPU_EVENT, enhance, GUEST_PROMPT_EVENT, refusalCard, signInHref, watchGuestRefusals } from "@/lib/api";
-import { CONNECT_GPU_HEADER, CONNECT_GPU_MESSAGE, CONNECT_GPU_UPLOAD_MESSAGE, GUEST_HEADER, GUEST_LIBRARY_MESSAGE, GUEST_RUN_MESSAGE } from "@/lib/guest-access";
+import { CONNECT_GPU_HEADER, CONNECT_GPU_MESSAGE, CONNECT_GPU_UPLOAD_MESSAGE, CONNECT_NEEDS_HEADER, GUEST_HEADER, GUEST_LIBRARY_MESSAGE, GUEST_RUN_MESSAGE } from "@/lib/guest-access";
import { refusalShown, toastError } from "@/lib/refusals";
const answer = (status: number, body: Record<string, unknown>, headers: Record<string, string> = {}) =>
@@ -215,6 +215,20 @@ describe("each studio's own fetch helper", () => {
expect(refusalShown(e)).toBe(true);
});
+ it("the owner's run with nothing connected (placeholders off): the connect card on any page, with what would run it, no toast", async () => {
+ page("/canvas/abc");
+ server = () =>
+ answer(422, { error: "Connect fal.ai or Replicate in Settings to run this model", code: "connect-gpu", needs: "key" }, { [CONNECT_GPU_HEADER]: "1", [CONNECT_NEEDS_HEADER]: "key" });
+ const e = await useCanvasActions()
+ .create({ name: "Untitled canvas" })
+ .catch((err: unknown) => err);
+ expect(events).toEqual([CONNECT_GPU_EVENT]);
+ expect(details).toEqual([{ action: "run", needs: "key" }]);
+ expect(refusalShown(e)).toBe(true);
+ toastError(e);
+ expect(toasts.error).toEqual([]);
+ });
+
it("keeps each helper's own error: its class, status and body", async () => {
page("/studio");
server = () => guestRefusal();
diff --git a/tests/home-start.test.ts b/tests/home-start.test.ts
index d45ac6dc..cae88484 100644
--- a/tests/home-start.test.ts
+++ b/tests/home-start.test.ts
@@ -89,21 +89,21 @@ describe("the line under Home's composer", () => {
expect(startLine(state(["fal"]), q.edit, "cloud", "edit")?.text).toMatch(/^Start runs Nano Banana Pro after you add the photo · /);
});
- it("says it's a demo when the key set is for a provider that doesn't host the model", () => {
+ it("says why Start can't run it when the key set is for a provider that doesn't host the model", () => {
// Only Replicate: hosted MiniMax H3 is on fal.ai alone.
- expect(startLine(state(["replicate"]), q.video, "cloud", "video")).toEqual({ text: "MiniMax H3 needs a fal.ai key, so Start runs a free demo" });
- // Demo mode off: it won't run at all.
- expect(startLine(state(["replicate"], { demoMode: "off" }), q.video, "cloud", "video")?.text).toMatch(/so Start can't run it yet$/);
- expect(startLine(state(["fal"], { demoMode: "on" }), q.image, "cloud", "image")?.text).toMatch(/Demo mode is on/);
+ expect(startLine(state(["replicate"]), q.video, "cloud", "video")).toEqual({ text: "MiniMax H3 needs a fal.ai key, so Start can't run it yet" });
+ // Off is the default; an install from before with no saved value is the same.
+ expect(startLine(state(["replicate"], { demoMode: undefined }), q.video, "cloud", "video")?.text).toMatch(/so Start can't run it yet$/);
+ expect(startLine(state(["fal"], { demoMode: "on" }), q.image, "cloud", "image")?.text).toMatch(/Placeholder results are on/);
});
it("offers the other engine when that one would run it for real", () => {
- expect(startLine(state(["comfyui"]), q.image, "cloud", "image")).toEqual({ text: "No paid API is connected, so Start runs a free demo", other: "open" });
+ expect(startLine(state(["comfyui"]), q.image, "cloud", "image")).toEqual({ text: "No paid API is connected, so Start can't run it yet", other: "open" });
expect(startLine(state(["comfyui"]), q.image, "open", "image")?.text).toMatch(/^Start runs .+ on your GPU · Free$/);
- expect(startLine(state(["fal"]), q.image, "open", "image")).toEqual({ text: "ComfyUI isn't connected, so Start runs a free demo", other: "cloud" });
+ expect(startLine(state(["fal"]), q.image, "open", "image")).toEqual({ text: "ComfyUI isn't connected, so Start can't run it yet", other: "cloud" });
// A Replicate key doesn't run hosted MiniMax H3, so it isn't offered for Video.
- expect(startLine(state(["replicate"]), q.video, "open", "video")).toEqual({ text: "ComfyUI isn't connected, so Start runs a free demo" });
- // Nothing connected: Home's demo notice says it instead.
+ expect(startLine(state(["replicate"]), q.video, "open", "video")).toEqual({ text: "ComfyUI isn't connected, so Start can't run it yet" });
+ // Nothing connected: Home's notice says it instead.
expect(startLine(state([]), q.image, "cloud", "image")).toBeNull();
});
});
diff --git a/tests/mcp.test.ts b/tests/mcp.test.ts
index a6651e9e..0727728d 100644
--- a/tests/mcp.test.ts
+++ b/tests/mcp.test.ts
@@ -1,12 +1,14 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
-import { afterAll, describe, expect, it } from "vitest";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-mcp-"));
process.env.FUOBE_DATA_DIR = dir;
process.env.COMFYUI_URL = "http://127.0.0.1:9";
const { handleMcp } = await import("@/server/mcp");
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
const rpc = (method: string, params?: unknown) => handleMcp({ jsonrpc: "2.0", id: 1, method, params });
diff --git a/tests/no-higgsfield.test.ts b/tests/no-higgsfield.test.ts
index eb300f73..4664a1b1 100644
--- a/tests/no-higgsfield.test.ts
+++ b/tests/no-higgsfield.test.ts
@@ -1,7 +1,7 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
-import { afterAll, describe, expect, it } from "vitest";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
/**
* Build plan O7: Fuobe calls no Higgsfield API. This file fails when a code path names that provider again (its id,
@@ -34,6 +34,8 @@ const { planCaps, retryPhoto } = await import("@/server/photodump");
const assistTools = await import("@/server/assist/tools");
const { saveFile } = await import("@/server/storage");
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));
let rows = 0;
diff --git a/tests/owner-computer.test.ts b/tests/owner-computer.test.ts
index 84b36191..db40fc5b 100644
--- a/tests/owner-computer.test.ts
+++ b/tests/owner-computer.test.ts
@@ -50,7 +50,7 @@ const { writeSnapshot } = await import("@/server/gpu/snapshots");
const { relayFile, ISOLATED_ON_COMPUTER } = await import("@/server/providers/comfyui");
const { asAccount, getGeneration } = await import("@/server/generations");
const { RELAY_WORDS, RUNS_ON_COMPUTER_NOTE } = await import("@/lib/relay");
-const { CONNECT_GPU_HEADER } = await import("@/lib/guest-access");
+const { CONNECT_GPU_HEADER, CONNECT_NEEDS_HEADER } = await import("@/lib/guest-access");
let fake: LocalComfy;
let routes: ComputerRoutes;
@@ -283,15 +283,19 @@ describe("runs", () => {
});
it("nothing connected runs it: the owner's own page gets the Connect your GPU marker, a script's token never does", async () => {
+ // The default (placeholder results off), not only a saved "off".
+ setSetting("demoMode", "");
const page = await run({ feature: "image", modelId: "oss-z-image-turbo", prompt: "a lighthouse" });
expect(page.status).toBe(422);
expect(page.headers.get(CONNECT_GPU_HEADER)).toBe("1");
+ expect(page.headers.get(CONNECT_NEEDS_HEADER)).toBe("gpu");
expect(await page.json()).toMatchObject({ code: "connect-gpu", error: "Connect ComfyUI in Settings to run this model" });
const { token } = auth.createToken("script");
const script = await run({ feature: "image", modelId: "oss-z-image-turbo", prompt: "a lighthouse" }, { cookie: null as never, headers: { authorization: `Bearer ${token}` } });
expect(script.status).toBe(422);
expect(script.headers.get(CONNECT_GPU_HEADER)).toBeNull();
+ expect(script.headers.get(CONNECT_NEEDS_HEADER)).toBeNull();
expect((await script.json()).code).toBeUndefined();
// An account's refusal is its own (403), as before.
diff --git a/tests/placeholder-results.test.ts b/tests/placeholder-results.test.ts
new file mode 100644
index 00000000..a9973ba6
--- /dev/null
+++ b/tests/placeholder-results.test.ts
@@ -0,0 +1,156 @@
+import fs from "node:fs";
+import os from "node:os";
+import path from "node:path";
+import { afterAll, afterEach, describe, expect, it } from "vitest";
+
+/**
+ * Placeholder results are opt-in: off by default on every install, hosted or local, so a run with nothing connected is
+ * refused with the connect card's marker instead of silently making a placeholder. A saved "auto" (the old default)
+ * becomes off, a saved "on" stays. While on, every run makes a labelled placeholder.
+ */
+
+const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-placeholders-"));
+process.env.FUOBE_DATA_DIR = dir;
+process.env.COMFYUI_URL = "http://127.0.0.1:9"; // nothing listens here
+delete process.env.FUOBE_DEMO_MODE;
+delete process.env.FAL_KEY;
+delete process.env.REPLICATE_API_TOKEN;
+
+const { getSetting, setSetting, validateSetting, publicSettings } = await import("@/server/settings");
+const { db } = await import("@/server/db");
+const { chooseRoute, ConnectComfyError } = await import("@/server/generations");
+const { getModel, MODELS } = await import("@/lib/catalog");
+const { placeholderActions, placeholderLine, placeholdersOn, isPlaceholder, PLACEHOLDER_SETTING, PLACEHOLDER_CHIP, PLACEHOLDERS_ON } = await import("@/lib/demo-mode");
+const { startLine } = await import("@/lib/connections");
+const settingsRoute = await import("@/app/api/settings/route");
+
+const put = (body: Record<string, string>) =>
+ settingsRoute.PUT(new Request("http://localhost/api/settings", { method: "PUT", headers: { "content-type": "application/json" }, body: JSON.stringify(body) }));
+
+/** Open the database again, as a restart does (db.ts clears a saved "auto" on every open). */
+function restart() {
+ globalThis.__fuobeDb?.close();
+ globalThis.__fuobeDb = undefined;
+ db();
+}
+const saved = () => (db().prepare("SELECT value FROM settings WHERE key = 'demo.mode'").get() as { value: string } | undefined)?.value;
+
+afterEach(() => {
+ delete process.env.FUOBE_DEMO_MODE;
+ setSetting("demoMode", "");
+});
+afterAll(() => {
+ globalThis.__fuobeDb?.close();
+ globalThis.__fuobeDb = undefined;
+ fs.rmSync(dir, { recursive: true, force: true });
+});
+
+describe("the setting", () => {
+ it("is off on a fresh install, and only off or on can be saved", () => {
+ expect(getSetting("demoMode")).toBe("off");
+ expect(publicSettings().find((s) => s.name === "demoMode")).toMatchObject({ value: "off", isSet: false });
+ // The Settings API takes off or on only; "auto" stays for code in this process (the test suite mixes routes with it).
+ expect(() => validateSetting("demoMode", "auto", "api")).toThrow("demoMode must be one of: off, on");
+ expect(() => validateSetting("demoMode", "auto")).not.toThrow();
+ setSetting("demoMode", "on");
+ expect(getSetting("demoMode")).toBe("on");
+ });
+
+ it("a saved auto (the old default) is cleared on start, so the install runs with placeholders off", () => {
+ db().prepare("INSERT INTO settings (key, value) VALUES ('demo.mode', 'auto') ON CONFLICT(key) DO UPDATE SET value = excluded.value").run();
+ restart();
+ expect(saved()).toBeUndefined();
+ expect(getSetting("demoMode")).toBe("off");
+ });
+
+ it("Settings saves on or off, and refuses auto", async () => {
+ const refused = await put({ demoMode: "auto" });
+ expect(refused.status).toBe(400);
+ expect(saved()).toBeUndefined();
+ expect((await put({ demoMode: "on" })).status).toBe(200);
+ expect(getSetting("demoMode")).toBe("on");
+ expect((await put({ demoMode: "off" })).status).toBe(200);
+ expect(getSetting("demoMode")).toBe("off");
+ });
+
+ it("a saved on stays on through a restart", () => {
+ setSetting("demoMode", "on");
+ restart();
+ expect(saved()).toBe("on");
+ expect(getSetting("demoMode")).toBe("on");
+ });
+
+ it("FUOBE_DEMO_MODE=auto reads as off too; FUOBE_DEMO_MODE=on turns placeholders on", () => {
+ process.env.FUOBE_DEMO_MODE = "auto";
+ expect(getSetting("demoMode")).toBe("off");
+ process.env.FUOBE_DEMO_MODE = "on";
+ expect(getSetting("demoMode")).toBe("on");
+ });
+});
+
+describe("a run with nothing connected", () => {
+ const routesOf = (id: string) => getModel(id)!.routes;
+ const refusal = (id: string) => {
+ try {
+ chooseRoute(routesOf(id));
+ } catch (e) {
+ return e;
+ }
+ throw new Error(`${id} ran`);
+ };
+
+ it("is refused with what would run it, never a silent placeholder", () => {
+ const open = refusal("oss-z-image-turbo");
+ expect(open).toBeInstanceOf(ConnectComfyError);
+ expect(open).toMatchObject({ needs: "gpu", message: "Connect ComfyUI in Settings to run this model" });
+ const paid = refusal("nano-banana-pro");
+ expect(paid).toBeInstanceOf(ConnectComfyError);
+ expect((paid as InstanceType<typeof ConnectComfyError>).needs).toBe("key");
+ // A model on both engines: either way runs it.
+ const both = MODELS.find((m) => m.routes.some((r) => r.provider === "comfyui") && m.routes.some((r) => r.provider === "fal"));
+ if (both) expect((refusal(both.id) as InstanceType<typeof ConnectComfyError>).needs).toBe("any");
+ });
+
+ it("makes a placeholder only with the switch on, or when the request asks for a dry run", () => {
+ expect(chooseRoute(routesOf("oss-z-image-turbo"), 0, [], undefined, true).demo).toBe(true);
+ setSetting("demoMode", "on");
+ expect(chooseRoute(routesOf("oss-z-image-turbo")).demo).toBe(true);
+ expect(chooseRoute(routesOf("nano-banana-pro")).demo).toBe(true);
+ });
+});
+
+describe("words and ways out", () => {
+ it("names the switch, the sidebar chip and the result chip", () => {
+ expect(PLACEHOLDER_SETTING).toBe("Show placeholder results (for a tour)");
+ expect(PLACEHOLDERS_ON).toBe("Placeholders on");
+ expect(PLACEHOLDER_CHIP).toBe("Placeholder");
+ });
+
+ it("is on only for on", () => {
+ expect(placeholdersOn("on")).toBe(true);
+ for (const v of ["off", "auto", "", undefined]) expect(placeholdersOn(v)).toBe(false);
+ });
+
+ it("labels a result the demo provider made, and nothing else", () => {
+ expect(isPlaceholder({ provider: "mock" })).toBe(true);
+ expect(isPlaceholder({ provider: "comfyui" })).toBe(false);
+ expect(isPlaceholder(null)).toBe(false);
+ });
+
+ it("offers the owner the ComfyUI on this computer, a key, and the switch off while it's on; nobody else anything", () => {
+ expect(placeholderActions({ owner: true, engineMode: "both", demoMode: "on" })).toEqual(["computer", "key", "off"]);
+ expect(placeholderActions({ owner: true, engineMode: "both", demoMode: "off" })).toEqual(["computer", "key"]);
+ expect(placeholderActions({ owner: true, engineMode: "open", demoMode: "on" })).toEqual(["computer", "off"]);
+ expect(placeholderActions({ owner: true, engineMode: "cloud", demoMode: "on" })).toEqual(["key", "off"]);
+ expect(placeholderActions({ owner: false, engineMode: "both", demoMode: "on" })).toEqual([]);
+ expect(placeholderLine("on")).toMatch(/Placeholder results are on in Settings/);
+ expect(placeholderLine("off")).toMatch(/Connect a model and run it again/);
+ });
+
+ it("Home's Start line never promises a free demo while the switch is off", () => {
+ const quote = { cloud: { name: "Nano Banana Pro", price: "$0.15", providers: ["fal"] }, open: { name: "Z-Image Turbo", providers: ["comfyui"] } };
+ const state = (demoMode: string) => ({ providers: { replicate: { configured: true } }, engineMode: "both" as const, demoMode });
+ expect(startLine(state("off"), quote, "cloud", "image")?.text).toBe("Nano Banana Pro needs a fal.ai key, so Start can't run it yet");
+ expect(startLine(state("on"), quote, "cloud", "image")?.text).toBe("Placeholder results are on (Settings), so Start makes a stand-in");
+ });
+});
diff --git a/tests/price-check-reads.test.ts b/tests/price-check-reads.test.ts
index f420db79..6c7a5e1e 100644
--- a/tests/price-check-reads.test.ts
+++ b/tests/price-check-reads.test.ts
@@ -33,6 +33,8 @@ const MP4 = fs.readFileSync(path.join(import.meta.dirname, "fixtures", "shorts-1
let a = "";
let b = "";
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
beforeAll(() => {
auth.setPassword("install password");
a = auth.createAccount("[email protected]", "long enough").id;
diff --git a/tests/security-lows.test.ts b/tests/security-lows.test.ts
index 3489a019..6baf4d07 100644
--- a/tests/security-lows.test.ts
+++ b/tests/security-lows.test.ts
@@ -21,6 +21,8 @@ const remote = await import("@/server/remote-fetch");
const { gpuState } = await import("@/server/account-gpu");
const nextConfig = (await import("../next.config")).default;
+// Placeholders where nothing is connected, as these runs were written for ("auto": code in this process only).
+beforeAll(async () => (await import("@/server/settings")).setSetting("demoMode", "auto"));
beforeAll(() => auth.setPassword("install password"));
afterEach(() => {
delete process.env.FUOBE_ALLOW_PRIVATE_URLS;