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.

Runs on this install's GPUs: one place name, and plain words wherever visitors read them

Adarsh61a33a034baa
diff --git a/docs/SELF-HOSTING.md b/docs/SELF-HOSTING.md
index a26ba223..108615f4 100644
--- a/docs/SELF-HOSTING.md
+++ b/docs/SELF-HOSTING.md
@@ -136,6 +136,7 @@ A file that looks like the note but was changed (it has a password or a sign-in
| `WORLDCAST_URL`, `WORLDCAST_TOKEN` | The WorldCast worker's address (also a Settings field) and its shared secret, sent as a Bearer header on every call; set the same `WORLDCAST_TOKEN` where the worker runs. The token has no Settings field yet. Without one, keep the worker on `127.0.0.1` ([worldcast.md](workers/worldcast.md)) |
| `FUOBE_HOSTED_RUNS=1` | With public sign-up: accounts with no GPU of their own may run on this install's GPUs: its workers, or its own ComfyUI when that is on this machine ([Hosted runs](public-signup.md#hosted-runs)). Off by default. A billing service or `FUOBE_HOSTED_FREE=1` must answer for these runs |
| `FUOBE_HOSTED_FREE=1` | With no billing service: hosted runs are free for every account, within the install's own limits. Without it (and without a billing service) hosted runs stay closed |
+| `FUOBE_PLACE_NAME` | The name visitors read for this install's GPUs while hosted runs are on ("Runs on Ana's render box", "Made on: Ana's render box"), at most 40 characters. Also Settings → Workers → Name for your GPUs, which wins over it; a billing service's own name for them wins over both. Unset: "Our GPUs". Nothing reads it while hosted runs are off |
| `FUOBE_POOL_WAIT_MIN` | How long a hosted run may wait in line before a GPU first takes it, in minutes (default `30`) |
| `FUOBE_POOL_MEDIA_INPUTS` | The kinds of input file a run on the workers may send them, comma-separated: `image` (default) or `image,video,audio`. Clips and sound go only to workers that make each clip and sound again before their ComfyUI reads it (worker protocol 2 with ffmpeg set, [Clips and sound](gpu-workers.md#clips-and-sound)). A hosted run takes a kind only when this and the billing service's policy (`uploads`) both allow it, so set it together with `FUOBE_HOSTED_RUNS` and `FUOBE_BILLING_URL` when the policy opens clips and sound |
| `FUOBE_CATALOG_VERSION` | The catalog version accounts' job tickets are made for ([Job tickets and the PC's ceiling](gpu-workers.md#job-tickets-and-the-pcs-ceiling)), as 64 hex characters. Unset: the studio computes it from its own composer and catalog files, which is what a server running from its own checkout wants. Set it only when the server runs without those files |
diff --git a/docs/billing-hook.md b/docs/billing-hook.md
index 95b7e228..9643407f 100644
--- a/docs/billing-hook.md
+++ b/docs/billing-hook.md
@@ -65,6 +65,7 @@ type Policy = {
prefer?: "pool" | "own"; // the default place (absent: "own")
kinds?: { image?: boolean; video?: boolean; audio?: boolean; text?: boolean; model3d?: boolean }; // absent: all
cardText?: string; // preset cards' words for a run there (absent: none)
+ placeName?: string; // what visitors call these GPUs (absent: the install's name)
links?: Action[]; notice?: { id: string; text: string; url?: string }; ttlS: number;
};
```
@@ -73,6 +74,10 @@ type Policy = {
(at most 40 characters). With a service set, the cards say only these words, and nothing when the policy has none.
With no service, runs there are free (`FUOBE_HOSTED_FREE=1`), and the cards say "Try free".
+`placeName` is the name visitors read for this install's GPUs ("Runs on Studio North GPUs", "Made on: Studio North
+GPUs"), at most 40 characters. Absent: the install's own name for them (Settings → Workers → Name for your GPUs, else
+`FUOBE_PLACE_NAME`), else "Our GPUs". Fuobe writes every sentence so that no verb has to agree with the name.
+
`megapixels` is the size of each picture or frame the run makes, about, as its workflow makes it: the canvas the
workflow binds (a canvas the request names counts only there; else the aspect ratio and resolution, the model's
defaults where the request names none), or for a workflow sized by its input (an edit, an upscale, a face swap) the
diff --git a/docs/public-signup.md b/docs/public-signup.md
index d6bd505e..bf79706e 100644
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@ -649,8 +649,11 @@ With it on:
one price. The run goes to this install's GPUs: its workers, when Settings says ComfyUI runs on workers
([gpu-workers.md](gpu-workers.md)), or else its own ComfyUI server, only when that is on this machine. An install
whose ComfyUI runs on the owner's computer doesn't offer hosted runs.
-- An account whose own GPU is online runs there by default. The composer shows where a run goes ("Your GPU" or "This
- studio's GPUs"), and the person can pick either.
+- An account whose own GPU is online runs there by default. The composer shows where a run goes ("Your GPU", or the
+ place name of this install's GPUs), and the person can pick either.
+- Visitors read this install's GPUs by one place name: "Runs on our GPUs", "Made on: Our GPUs", "Run on Our GPUs".
+ The billing service's policy sets it (`placeName`); without one, Settings → Workers → Name for your GPUs, else
+ `FUOBE_PLACE_NAME`, else "Our GPUs". It is never sent while hosted runs are off.
- A model, mode or option that runs only on a person's own GPU or key keeps its label there ("Runs on your own GPU ·
48 GB", `src/lib/own-setup.ts`), and Run opens that setup. So does a run that no worker can take (none holds its
files or may run its lane). Extra LoRAs added to a request stay on the account's own GPU.
diff --git a/src/components/any-angle/any-angle-tool.tsx b/src/components/any-angle/any-angle-tool.tsx
index 4c783f47..e94b579c 100644
--- a/src/components/any-angle/any-angle-tool.tsx
+++ b/src/components/any-angle/any-angle-tool.tsx
@@ -13,7 +13,7 @@ import { ACCEPT, LibraryGrid } from "@/components/studio/media-slot";
import { RunPlaceChip, useOpenRunPlace } from "@/components/studio/run-place-chip";
import { getModel } from "@/lib/catalog";
import { loadModelViewer } from "@/components/model3d/model-viewer";
-import { askToSignUp, uploadFile, useAskBeforeUpload, useCreateGeneration, useEngine, useGenerations, useIsGuest, useIsOwner, useStatus } from "@/lib/api";
+import { askToSignUp, uploadFile, useAskBeforeUpload, useCreateGeneration, useEngine, useGenerations, useIsGuest, useIsOwner, usePlaceName, useStatus } from "@/lib/api";
import { ACTIVE_RUNS_CODE } from "@/lib/guest-access";
import {
ANY_ANGLE,
@@ -317,6 +317,7 @@ function DragView({ view, onUse }: { view: AnyAngleView; onUse: (a: CustomAngle)
function ShotCard({ g, original, onAgain }: { g: Generation; original: string; onAgain: (g: Generation) => void }) {
const [before, setBefore] = useState(false);
const placeholders = placeholdersOn(useStatus().data?.demoMode);
+ const sitePlace = usePlaceName();
const out = g.status === "succeeded" ? g.outputs.find((o) => o.kind === "image") : undefined;
const label = g.prompt || "New angle";
return (
@@ -350,7 +351,7 @@ function ShotCard({ g, original, onAgain }: { g: Generation; original: string; o
{(out || g.status === "failed") && (
<Button variant="outline" size="sm" className="rounded-full" onClick={() => onAgain(g)}>
<RefreshCw className="size-3.5" /> {out ? "Make another" : "Try again"}
- {againWhere(g, { placeholders }, againPrice([g]))}
+ {againWhere(g, { placeholders, place: sitePlace }, againPrice([g]))}
</Button>
)}
{out && (
diff --git a/src/components/genjutsu/genjutsu-studio.tsx b/src/components/genjutsu/genjutsu-studio.tsx
index e2b210dd..40fb07fc 100644
--- a/src/components/genjutsu/genjutsu-studio.tsx
+++ b/src/components/genjutsu/genjutsu-studio.tsx
@@ -28,7 +28,7 @@ import { openInStudio } from "@/components/swap-studio/hooks";
import { limitMb, useClipLimit } from "@/lib/clip-limit";
import { ExampleRow } from "@/components/studio/example-row";
import { onAttr, TAB_PILL, TabRow } from "@/components/ui/tab-row";
-import { useEngine, useGenerations, useIsOwner, useModelAccess, useSoundLive, useStatus } from "@/lib/api";
+import { useEngine, useGenerations, useIsOwner, useModelAccess, usePlaceName, useSoundLive, useStatus } from "@/lib/api";
import { CHARACTER_SWAP, cutsInPart, cutWarning, partWords, seedProblem, type CharacterChoice, type CharacterOptions } from "@/lib/catalog/character-swap";
import {
chooseMaker,
@@ -1505,6 +1505,7 @@ function RunPanel({ run, onAgain, finish = [], onFinish }: { run: Run; onAgain:
const byId = useMemo(() => new Map((list ?? []).map((g) => [g.id, g])), [list]);
const final = byId.get(run.final);
const placeholders = placeholdersOn(useStatus().data?.demoMode);
+ const sitePlace = usePlaceName();
// Run again sends the run's own request again (a new seed): on the cloud it says that request's price, from the same
// estimate the Generate button showed ("· paid" until it's known, or when it can't be priced).
const priced = !!final && final.engine !== "open" && final.place !== "pool" && !placeholders;
@@ -1541,7 +1542,7 @@ function RunPanel({ run, onAgain, finish = [], onFinish }: { run: Run; onAgain:
{(out || state.status === "failed") && (
<Button size="sm" variant="outline" className="rounded-full" onClick={onAgain}>
<RotateCcw className="size-3.5" /> {state.status === "failed" ? "Try again" : "Run again"}
- {againWhere(final, { placeholders }, againCost)}
+ {againWhere(final, { placeholders, place: sitePlace }, againCost)}
</Button>
)}
</div>
diff --git a/src/components/gpu/account-gpu-section.tsx b/src/components/gpu/account-gpu-section.tsx
index b39ed519..4aa514e9 100644
--- a/src/components/gpu/account-gpu-section.tsx
+++ b/src/components/gpu/account-gpu-section.tsx
@@ -2,7 +2,7 @@
import { ConnectChoice } from "@/components/gpu/connect-choice";
import { PairedComfyUIs } from "@/components/gpu/fuobe-connect";
-import { useHydrated, useViewer } from "@/lib/api";
+import { useHydrated, useStatus, useViewer } from "@/lib/api";
/**
* Settings for an account (public sign-up): "Your GPU", at the top of the page (signing out is in Account, below).
@@ -11,6 +11,8 @@ import { useHydrated, useViewer } from "@/lib/api";
export function AccountGpuSection() {
const hydrated = useHydrated();
const account = useViewer().data?.account;
+ // Hosted runs: runs already work without a GPU of one's own, so connecting one is optional.
+ const hosted = !!useStatus().data?.viewer?.hosted;
if (!hydrated || !account) return null;
return (
<section id="your-gpu" aria-labelledby="your-gpu-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]">
@@ -19,7 +21,7 @@ export function AccountGpuSection() {
Your GPU
</h2>
<p className="mt-1 text-[13px] text-muted-foreground">
- Run open models on your own graphics card, free and with no run limit.
+ {hosted ? "Optional. Run on your own graphics card whenever you like." : "Run open models on your own graphics card, free and with no run limit."}
</p>
</div>
<div className="min-w-0 space-y-4">
diff --git a/src/components/gpu/your-gpu.tsx b/src/components/gpu/your-gpu.tsx
index 9cdc19ca..4cd07d86 100644
--- a/src/components/gpu/your-gpu.tsx
+++ b/src/components/gpu/your-gpu.tsx
@@ -73,7 +73,10 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?
const qc = useQueryClient();
const id = useId();
const q = useQuery({ queryKey: ["account-gpu"], queryFn: () => call<GpuState>("GET") });
- const live = useStatus().data?.viewer?.gpu;
+ const viewer = useStatus().data?.viewer;
+ const live = viewer?.gpu;
+ // Hosted runs: runs go to this studio's GPUs too, so these words say what goes to Your GPU, not "your runs".
+ const hosted = !!viewer?.hosted;
const [url, setUrl] = useState("");
const [token, setToken] = useState("");
const [busy, setBusy] = useState<"test" | "save" | "anyway" | "remove" | null>(null);
@@ -103,8 +106,8 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?
if (mode !== "test") {
qc.setQueryData(["account-gpu"], { gpu: r.gpu });
linked();
- if (r.offline) toast("Your address is saved. Your runs start as soon as your GPU answers.");
- else toast.success("Your GPU is connected. Runs go to your ComfyUI now.");
+ if (r.offline) toast(hosted ? "Your address is saved. Runs on Your GPU start as soon as it answers." : "Your address is saved. Your runs start as soon as your GPU answers.");
+ else toast.success(hosted ? "Your GPU is connected." : "Your GPU is connected. Runs go to your ComfyUI now.");
setUrl("");
setToken("");
onLinked?.();
@@ -172,7 +175,11 @@ export function YourGpu({ className, onLinked }: { className?: string; onLinked?
return (
<div className={cn("w-full min-w-0 space-y-4 sm:max-w-[36rem]", className)}>
<p className="text-[13px] text-muted-foreground">
- {gpu ? "Your runs go to your ComfyUI through this web address." : "Your runs reach your ComfyUI through a web address. Here's how to give it one:"}
+ {gpu
+ ? hosted
+ ? "Runs on Your GPU reach your ComfyUI through this web address."
+ : "Your runs go to your ComfyUI through this web address."
+ : "Your runs reach your ComfyUI through a web address. Here's how to give it one:"}
</p>
{gpu ? (
<div className={cn("space-y-2 rounded-xl px-3 py-2.5 text-[13px]", offline ? "border border-dashed" : "bg-brand-faint")}>
diff --git a/src/components/guest-prompt.tsx b/src/components/guest-prompt.tsx
index af61e459..5872e900 100644
--- a/src/components/guest-prompt.tsx
+++ b/src/components/guest-prompt.tsx
@@ -24,6 +24,7 @@ import {
type RefusalAction,
type RefusalCard,
} from "@/lib/api";
+import { placeOf } from "@/lib/place-name";
import { ConnectField, useSettings } from "@/components/connect-field";
import { FAL_KEYS_URL } from "@/lib/connections";
import { CLOUD_KEY } from "@/lib/your-keys";
@@ -76,6 +77,9 @@ export function GuestPrompt() {
// 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";
+ // Hosted runs: opened from an item that runs on one's own GPU only (its label's requirement), while everything else
+ // runs on this studio's GPUs (said with their place name).
+ const ownOnly = viewer?.hosted && !!requirement && needs !== "key" && !keyOnly ? placeOf(viewer.placeName) : null;
const start = () => {
const r = retry;
close();
@@ -155,7 +159,7 @@ export function GuestPrompt() {
{keyOnly ? <KeyRound className="size-5" /> : <Cpu className="size-5" />}
</div>
<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]}
+ {reason ? TITLES[reason] : keyOnly ? "Add an API key to run this" : ownOnly ? "This one runs on your own GPU" : action === "upload" && !keysAllowed ? "Connect your GPU to add your own files" : TITLES[action]}
</DialogTitle>
<DialogDescription>
{keyOnly ? (
@@ -166,6 +170,8 @@ export function GuestPrompt() {
) : (
"Your files are kept for your own runs on your own ComfyUI."
)
+ ) : ownOnly && !reason ? (
+ `Connect yours, and this runs there. Everything else runs on ${ownOnly.text}.`
) : (
<>{action === "connect" && !reason ? "Your runs go to the ComfyUI on your computer. It's free and private." : "Fuobe runs this on the ComfyUI on your computer. It's free and private."}</>
)}
diff --git a/src/components/home/home-islands.tsx b/src/components/home/home-islands.tsx
index 3bd797a0..8371418b 100644
--- a/src/components/home/home-islands.tsx
+++ b/src/components/home/home-islands.tsx
@@ -7,6 +7,7 @@ import { useFadeEdges } from "@/components/use-fade-edges";
import { useRailStills } from "@/components/use-rail-stills";
import { PresetPreview, setPreviewsPaused, usePreviewPlayback, usePreviewsPaused } from "@/components/preset-preview";
import { CONNECT_GPU_EVENT, signInHref, useHydrated, useIsOwner, useStatus } from "@/lib/api";
+import { placeOf } from "@/lib/place-name";
import { copyWithToast } from "@/lib/clipboard";
import type { PresetCardData } from "@/lib/preset-cards";
import type { AutoPlay } from "@/lib/preview-playback";
@@ -238,6 +239,8 @@ export function StartSteps() {
const status = hydrated ? data : undefined;
const viewer = status?.viewer;
const owner = !!status && !viewer;
+ // Hosted runs: runs need nothing set up, so the third step is to make something (a GPU of one's own is optional).
+ const place = viewer?.hosted ? placeOf(viewer.placeName) : null;
const link = "inline-flex items-center gap-1 text-[13px] font-medium text-brand-text hover:underline underline-offset-2";
const done = (text: string) => (
<span className="inline-flex items-center gap-1 text-[13px] font-medium text-foreground">
@@ -256,7 +259,7 @@ export function StartSteps() {
},
{
title: "Sign up free.",
- text: viewer?.hosted ? "Runs on this studio's GPUs, or on your own." : "A free account runs every open model on your own GPU.",
+ text: place ? `Runs on ${place.text}, or on your own GPU.` : "A free account runs every open model on your own GPU.",
action:
viewer?.kind === "account" ? (
done("You’re signed in")
@@ -270,21 +273,31 @@ export function StartSteps() {
</a>
),
},
- {
- title: "Connect your ComfyUI.",
- text: "Use the ComfyUI on your computer, or one you reach by link. Fuobe shows you everything it can run.",
- action: viewer?.gpu.connected ? (
- done("Your GPU is connected")
- ) : viewer?.kind === "account" ? (
- <button type="button" onClick={() => window.dispatchEvent(new Event(CONNECT_GPU_EVENT))} className={link}>
- Connect your GPU <ArrowRight className="size-3.5" />
- </button>
- ) : (
- <IntentLink href="/connect" className={link}>
- Connect your GPU <ArrowRight className="size-3.5" />
- </IntentLink>
- ),
- },
+ place
+ ? {
+ title: "Make something.",
+ text: "Pick a studio and press Generate. Your own GPU or key is optional.",
+ action: (
+ <IntentLink href="/video" className={link}>
+ Open the Video studio <ArrowRight className="size-3.5" />
+ </IntentLink>
+ ),
+ }
+ : {
+ title: "Connect your ComfyUI.",
+ text: "Use the ComfyUI on your computer, or one you reach by link. Fuobe shows you everything it can run.",
+ action: viewer?.gpu.connected ? (
+ done("Your GPU is connected")
+ ) : viewer?.kind === "account" ? (
+ <button type="button" onClick={() => window.dispatchEvent(new Event(CONNECT_GPU_EVENT))} className={link}>
+ Connect your GPU <ArrowRight className="size-3.5" />
+ </button>
+ ) : (
+ <IntentLink href="/connect" className={link}>
+ Connect your GPU <ArrowRight className="size-3.5" />
+ </IntentLink>
+ ),
+ },
];
return (
<ol className="space-y-5">
diff --git a/src/components/katana/katana-studio.tsx b/src/components/katana/katana-studio.tsx
index 2abcc66a..44f4c464 100644
--- a/src/components/katana/katana-studio.tsx
+++ b/src/components/katana/katana-studio.tsx
@@ -19,7 +19,7 @@ import { MediaDrop } from "@/components/av/media-drop";
import { StepList, type StepRow } from "@/components/av/step-list";
import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";
import { ExampleRow } from "@/components/studio/example-row";
-import { useAskBeforeUpload, useEngine, useIsGuest, useModelAccess, useStatus } from "@/lib/api";
+import { useAskBeforeUpload, useEngine, useIsGuest, useModelAccess, usePlaceName, useStatus } from "@/lib/api";
import { againPrice, againWhere, placeholdersOn } from "@/lib/demo-mode";
import { formatCueTime } from "@/lib/av/cue-edit";
import { againKeys, detectCutIndices, KATANA_LIMITS, katanaProgress, katanaStage, motionModel, MOTION_MODELS, nearestAspect, OPEN_KEYFRAME_PHOTOS, planSegments, refineCut, refineTimes, type KatanaJobView, type Segment } from "@/lib/av/katana";
@@ -367,10 +367,11 @@ function Runs({ jobs, loading }: { jobs?: KatanaJobView[]; loading: boolean }) {
const { remove, retry } = useKatanaActions();
// A run again is a new run: where it runs (or that it's paid) is said on the button before the tap.
const placeholders = placeholdersOn(useStatus().data?.demoMode);
+ const sitePlace = usePlaceName();
// On the cloud it says the price: the estimates of the steps it makes again (all of them, or the failed ones and after).
const where = (j: KatanaJobView, all: boolean) => {
const keys = j.engine === "open" || placeholders ? null : againKeys(j, all);
- return againWhere(j, { placeholders }, keys && againPrice(keys.map((k) => j.generations[j.steps[k]])));
+ return againWhere(j, { placeholders, place: sitePlace }, keys && againPrice(keys.map((k) => j.generations[j.steps[k]])));
};
const again = (id: string, all: boolean) =>
retry.mutate(
diff --git a/src/components/keys/your-keys.tsx b/src/components/keys/your-keys.tsx
index eca55dbc..9aed24ce 100644
--- a/src/components/keys/your-keys.tsx
+++ b/src/components/keys/your-keys.tsx
@@ -276,7 +276,10 @@ export function AccountKeysSection({ prices }: { prices?: string }) {
const account = useViewer().data?.account;
const q = useYourKeys(!!account);
// A studio with paid models off takes no keys: the section isn't shown.
- const paidOff = useStatus().data?.viewer?.paidAllowed === false || q.data?.paidAllowed === false;
+ const viewer = useStatus().data?.viewer;
+ const paidOff = viewer?.paidAllowed === false || q.data?.paidAllowed === false;
+ // Hosted runs: the limits below are a key's own (runs on this studio's GPUs have theirs).
+ const hosted = !!viewer?.hosted;
if (!hydrated || !account || paidOff) return null;
return (
<section id="your-keys" aria-labelledby="your-keys-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]">
@@ -296,7 +299,7 @@ export function AccountKeysSection({ prices }: { prices?: string }) {
final word.
</li>
)}
- <li>Up to 4 runs at once and 60 an hour.</li>
+ <li>{hosted ? "On your key: up to 4 runs at once and 60 an hour." : "Up to 4 runs at once and 60 an hour."}</li>
</ul>
{q.isError ? (
<p className="text-[13px] text-muted-foreground">{q.error.message}</p>
@@ -325,8 +328,18 @@ export function KeyInstead({ onOpen, className }: { onOpen?: () => void; classNa
<div className={cn("flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-dashed px-3 py-2.5 text-[13px]", className)}>
<KeyRound aria-hidden className="mt-0.5 size-4 shrink-0 self-start text-brand-text" />
<p className="min-w-0 flex-1 basis-56 text-muted-foreground">
- <span className="font-medium text-foreground">No GPU?</span> Add your own fal.ai or Replicate key to use paid models like Nano Banana, Kling and Veo, billed to your
- account with them.
+ {v.hosted ? (
+ // Hosted runs: open models already run without a GPU of one's own, so a key is for the paid ones.
+ <>
+ <span className="font-medium text-foreground">Paid models:</span> add your own fal.ai or Replicate key to use Nano Banana, Kling and Veo, billed to your
+ account with them.
+ </>
+ ) : (
+ <>
+ <span className="font-medium text-foreground">No GPU?</span> Add your own fal.ai or Replicate key to use paid models like Nano Banana, Kling and Veo, billed to
+ your account with them.
+ </>
+ )}
</p>
<Button
size="sm"
diff --git a/src/components/library/asset-card.tsx b/src/components/library/asset-card.tsx
index 273943e9..47c7a499 100644
--- a/src/components/library/asset-card.tsx
+++ b/src/components/library/asset-card.tsx
@@ -9,6 +9,8 @@ import { OPERATION_LABELS, type Generation } from "@/lib/catalog/types";
import { elapsed, timeAgo } from "@/lib/format";
import { coverOf, trashDaysLeft, userTitle, type LibraryEntry } from "@/lib/library";
import { isLayered, shownOutputs } from "@/lib/output-actions";
+import { lineWords } from "@/lib/pool-line";
+import { POOL_WORDS } from "@/lib/relay";
import { cn } from "@/lib/utils";
import { PlaceholderChip } from "@/components/demo-mode";
import { TroubleActions, TroubleDetails } from "@/components/gpu/trouble";
@@ -43,14 +45,24 @@ const LIST_MENU ="grid size-8 shrink-0 place-items-center rounded-lg text-muted-
const idsOf = (e: LibraryEntry) => (e.type === "single" ? [e.g.id] : e.items.map((g) => g.id));
+/** A run's state in a Library list row: on this install's GPUs, the words its tile says. */
+export function listStatus(g: Pick<Generation, "status" | "place">): string {
+ if (g.status === "canceled") return "Canceled";
+ if (g.place === "pool") return g.status === "failed" ? "Couldn't be made" : g.status === "queued" ? POOL_WORDS.inLine : POOL_WORDS.working;
+ return g.status === "failed" ? "Failed" : g.status === "queued" ? "Queued" : "Rendering";
+}
+
export function StatusCover({ g }: { g: Generation }) {
+ // On this install's GPUs (hosted runs): the words of its tile, in line with its place and wait, then working.
+ const pool = g.place === "pool";
if (g.status === "queued" || g.status === "running") {
const pct = g.progress != null ? Math.round(g.progress * 100) : null;
+ const label = pool ? (g.status === "queued" ? (g.queue ? lineWords(g.queue) : POOL_WORDS.inLine) : (g.message ?? POOL_WORDS.working)) : (g.message ?? (g.status === "queued" ? "Queued" : "Generating…"));
return (
<div className="relative size-full bg-muted">
<div className="skeleton-sweep absolute inset-0 animate-skeleton" />
<div className="absolute inset-x-0 bottom-0 p-3">
- <p className="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">{g.message ?? (g.status === "queued" ? "Queued" : "Generating…")}</p>
+ <p className="shimmer-text animate-shimmer-text truncate text-[13px] font-medium">{label}</p>
<p className="font-mono text-[11px] text-muted-foreground">
{pct != null ? `${pct}% · ` : ""}
{elapsed(g.createdAt)}
@@ -62,8 +74,15 @@ export function StatusCover({ g }: { g: Generation }) {
return (
<div className="flex size-full flex-col justify-between border border-dashed bg-background p-3">
<div className="min-h-0 space-y-1 overflow-hidden">
- <p className="text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>
- {g.error && <p className="line-clamp-4 text-[12px] leading-snug break-words text-muted-foreground">{g.error}</p>}
+ {pool && g.status === "failed" ? (
+ // One plain sentence, as its tile says it.
+ <p className="line-clamp-5 text-[13px] leading-snug font-medium break-words">{g.error || POOL_WORDS.failed}</p>
+ ) : (
+ <>
+ <p className="text-[13px] font-medium">{g.status === "canceled" ? "Canceled" : "Couldn't generate this one"}</p>
+ {g.error && <p className="line-clamp-4 text-[12px] leading-snug break-words text-muted-foreground">{g.error}</p>}
+ </>
+ )}
{/* An account's own GPU or key: what came back (small), and the way out (Start your pod, Check my GPU, Replace key…). */}
{g.status === "failed" && g.trouble && (
<>
@@ -251,7 +270,7 @@ export const AssetCard = memo(function AssetCard({
{stack ? `${stack.label} · ` : `${g.modelName ?? g.modelId} · ${OPERATION_LABELS[g.op]} · `}
{trashed ? `${trashDaysLeft(g.deletedAt!)} days left in Trash` : timeAgo(g.createdAt)}
{/* "Rendering", as the Status filter calls it: "In progress" is a review status. */}
- {!stack && g.status !== "succeeded" && ` · ${g.status === "failed" ? "Failed" : g.status === "canceled" ? "Canceled" : g.status === "queued" ? "Queued" : "Rendering"}`}
+ {!stack && g.status !== "succeeded" && ` · ${listStatus(g)}`}
</p>
</div>
{g.favorite && !stack && <Heart className="size-4 shrink-0 fill-highlight text-highlight" />}
diff --git a/src/components/nav/status-chips.tsx b/src/components/nav/status-chips.tsx
index 7e3cff5f..d216ffe8 100644
--- a/src/components/nav/status-chips.tsx
+++ b/src/components/nav/status-chips.tsx
@@ -175,13 +175,19 @@ function BalanceItems({ viewer }: { viewer: Viewer }) {
})}
<NavMenuItem asChild className={MENU_ROW_1}>
<IntentLink href="/connect">
- <Cpu /> Use your own GPU or keys (free)
+ <Cpu /> Use your own GPU or key
</IntentLink>
</NavMenuItem>
</>
);
}
+/**
+ * The balance chip's dot is green while runs go: there is something to spend, or runs here are free (nothing counted:
+ * no renewal to wait for and nothing to ask for). Grey only when runs wait for more.
+ */
+export const balanceGoes = (b: Pick<NonNullable<Viewer["balance"]>, "amount" | "refillAt" | "offer" | "action">): boolean => b.amount > 0 || (!b.refillAt && !b.offer && !b.action);
+
function balanceLabel(viewer: Viewer): { chip: string; refill: string | null } {
const b = viewer.balance!;
return { chip: b.chip, refill: b.refillAt ? refillWords(b.refillAt) : null };
@@ -208,7 +214,7 @@ export function BalanceChip({ viewer, pill, className }: { viewer: Viewer; pill?
)}
>
<span className={cn("flex min-w-0 items-center", pill ? "gap-2" : "gap-3")}>
- {pill ? <StatusDot ok={b.amount > 0} /> : <DotSlot ok={b.amount > 0} />} <span className="truncate font-medium text-foreground">{chip}</span>
+ {pill ? <StatusDot ok={balanceGoes(b)} /> : <DotSlot ok={balanceGoes(b)} />} <span className="truncate font-medium text-foreground">{chip}</span>
{refill && <span className={cn("ml-auto shrink-0", pill && "hidden xl:inline")}>{refill}</span>}
</span>
{!pill && b.sub && <span className="truncate pl-7 text-[11px]">{b.sub}</span>}
@@ -229,7 +235,7 @@ export function BalanceSection({ viewer }: { viewer: Viewer }) {
<>
<DropdownMenuLabel className="flex flex-col gap-0.5 px-2.5 font-normal">
<span className="flex items-center gap-3 text-[12.5px]">
- <DotSlot ok={b.amount > 0} /> <span className="font-medium text-foreground">{chip}</span>
+ <DotSlot ok={balanceGoes(b)} /> <span className="font-medium text-foreground">{chip}</span>
{refill && <span className="ml-auto text-[12px] text-muted-foreground">{refill}</span>}
</span>
{b.sub && <span className="pl-7 text-[11px] text-muted-foreground">{b.sub}</span>}
diff --git a/src/components/preset-gallery.tsx b/src/components/preset-gallery.tsx
index 17737747..6a3fce31 100644
--- a/src/components/preset-gallery.tsx
+++ b/src/components/preset-gallery.tsx
@@ -15,7 +15,7 @@ import { usePoolRules, useTryFree } from "@/hooks/use-pool-rules";
import { presetOwnSetup } from "@/lib/pool-rules";
import { OwnSetupChip } from "@/components/own-setup";
import type { OwnSetup } from "@/lib/own-setup";
-import { useEngineMode, useViewer } from "@/lib/api";
+import { useEngineMode, useStatus, useViewer } from "@/lib/api";
import { categoryFrom, skippedInAll } from "@/lib/gallery-category";
import { matchesSearch, previewFlip, readMoreTap, searchText, TAP_TO_READ, type PresetCardData } from "@/lib/preset-cards";
import { cn } from "@/lib/utils";
@@ -306,6 +306,8 @@ export function PresetGallery({
const badges = useGpuBadges().data;
const viewer = useViewer().data;
const visitor = !!viewer && viewer.publicSignup && !viewer.owner;
+ // Hosted runs: everything here runs without a GPU of one's own, so there is no "Connect your GPU to see" line.
+ const hosted = !!useStatus().data?.viewer?.hosted;
return (
<div className="space-y-4">
@@ -340,7 +342,7 @@ export function PresetGallery({
</div>
</div>
{/* Its line is kept (unseen) until the viewer and its chips are known, so the strip and grid don't move when it comes. */}
- {(!viewer || (visitor && (!badges || (!badges.connected && !badges.off)))) && (
+ {!hosted && (!viewer || (visitor && (!badges || (!badges.connected && !badges.off)))) && (
<p className={cn("text-[13px] text-muted-foreground", !(visitor && badges) && "invisible", !viewer && "[html[data-viewer='owner']_&]:hidden")} aria-hidden={!(visitor && badges) || undefined}>
<Link href="/connect" tabIndex={visitor && badges ? undefined : -1} className="font-medium text-brand-text underline-offset-2 hover:underline">
Connect your GPU
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index d33da033..28ff24d0 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -32,6 +32,7 @@ import { useGuestDraft } from "./guest-draft";
import { ExactOrbitControls } from "@/components/exact-orbit-controls";
import { useFlyAround } from "@/components/fly-around-run";
import { exactDefaults, takesExact, type ExactOrbit } from "@/lib/exact-orbit";
+import { placeOf } from "@/lib/place-name";
import { askToSignUp, CONNECT_GPU_EVENT, enhance, useClipFacts, useCreateGeneration, useElements, useEngine, useHydrated, useIsOwner, useLikelyVisitor, useStatus } from "@/lib/api";
import { usePagePlace } from "@/components/gpu/use-page-place";
import { applyMentions, elementsNote, type StudioElement } from "@/lib/catalog/elements";
@@ -664,6 +665,8 @@ export function Composer({ docked }: { docked: boolean }) {
// (The place the run names: none when the default is the studio's GPUs only because the studio puts them first.)
const { runOn, place: runPlace } = composerPlace(runOnPick, ownOnline, viewerInfo?.prefer === "pool");
const hostedHere = !!viewerInfo?.hosted && model?.engine === "open";
+ // The name visitors read for this studio's GPUs ("Our GPUs"): said only while hosted runs are on.
+ const sitePlace = placeOf(viewerInfo?.placeName);
// The price check is asked with the place the run itself names: none while the studio puts its GPUs first and the
// account's own GPU is online, so it answers for where the server would really send the run.
const askPool = hostedHere && runOn === "pool";
@@ -1760,10 +1763,10 @@ export function Composer({ docked }: { docked: boolean }) {
type="button"
onMouseDown={(e) => e.preventDefault()}
onClick={() => setRunOn(shownOn === "own" ? "pool" : "own")}
- aria-label={`Runs on ${shownOn === "own" ? "your GPU" : "this studio's GPUs"}. Switch`}
+ aria-label={`Runs on ${shownOn === "own" ? "your GPU" : sitePlace.text}. Change where it runs`}
className="shrink-0 rounded-md px-1.5 py-0.5 text-[12px] text-muted-foreground underline decoration-border-strong underline-offset-2 hover:text-foreground"
>
- {shownOn === "own" ? "Your GPU" : "This studio's GPUs"}
+ {shownOn === "own" ? "Your GPU" : sitePlace.label}
</button>
)}
{costText && (
@@ -1781,7 +1784,7 @@ export function Composer({ docked }: { docked: boolean }) {
{poolPrice
? poolState?.refused
? (poolState.sub ?? poolState.text)
- : [hostedQuote?.sub ?? "Runs on this studio's GPUs", poolState?.wait].filter(Boolean).join(" · ")
+ : [hostedQuote?.sub ?? `Runs on ${sitePlace.text}`, poolState?.wait].filter(Boolean).join(" · ")
: demo
? "Placeholder results are on (Settings), so outputs are free stand-ins"
: keyOnly && cost == null
diff --git a/src/components/studio/engine-switch.tsx b/src/components/studio/engine-switch.tsx
index e227f36a..ffd6217f 100644
--- a/src/components/studio/engine-switch.tsx
+++ b/src/components/studio/engine-switch.tsx
@@ -6,6 +6,7 @@ import { openAddKey } from "@/components/keys/your-keys";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import type { Engine } from "@/lib/catalog/types";
import { useEngineMode, useHydrated, useStatus, useViewer } from "@/lib/api";
+import { placeOf, type Place } from "@/lib/place-name";
import { accountEngine } from "@/lib/your-keys";
import { cn } from "@/lib/utils";
import { radioKeys, radioTab } from "./radio-keys";
@@ -15,6 +16,16 @@ const OPTIONS: { value: Engine; label: string; icon: typeof Cloud; tip: string }
{ value: "open", label: "Open source", icon: Cpu, tip: "Open-weight models running on your ComfyUI server" },
];
+/**
+ * A side's tooltip words: an account's own (who pays, where it runs), else the side's own; with hosted runs on (`place`:
+ * their place name), open models run free there.
+ */
+export function engineTip(value: Engine, account: ReturnType<typeof accountEngine>, place: Place | null): string {
+ if (account && "tips" in account) return account.tips[value];
+ if (value === "open" && place) return `Open models, free on ${place.text}`;
+ return OPTIONS.find((o) => o.value === value)!.tip;
+}
+
/**
* Segmented control with a sliding white thumb (Liner-style). `md` (page headers) turns
* icon-only below the sm breakpoint so titles keep their line on phones (`compact` does the same
@@ -48,6 +59,8 @@ export function EngineSwitch({
// An account (public sign-up): locked on open source until it adds its own key, and why; with one, who pays.
const account = accountEngine(hydrated ? status : undefined);
const locked = account && "locked" in account ? account.locked : null;
+ // Hosted runs: open models run free on this studio's GPUs, said with their place name (a guest's tip too).
+ const place = hydrated && status?.viewer?.hosted ? placeOf(status.viewer.placeName) : null;
const idx = OPTIONS.findIndex((o) => o.value === value);
if (mode !== "both" || locked) {
// One engine and nothing to change: only the owner (Settings) or an account that can add a key gets a badge.
@@ -138,7 +151,7 @@ export function EngineSwitch({
<TooltipContent>
{/* One span: the tooltip lays its children out in a row. */}
<span>
- <span className="font-medium">{o.label}</span> · {account && "tips" in account ? account.tips[o.value] : o.tip}
+ <span className="font-medium">{o.label}</span> · {engineTip(o.value, account, place)}
</span>
</TooltipContent>
</Tooltip>
diff --git a/src/components/studio/feed.tsx b/src/components/studio/feed.tsx
index 6acb2fb4..5fc0c435 100644
--- a/src/components/studio/feed.tsx
+++ b/src/components/studio/feed.tsx
@@ -20,7 +20,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { OPERATION_LABELS, type Generation } from "@/lib/catalog/types";
import { onCloudKey } from "@/lib/before-run";
import { TroubleActions, TroubleDetails } from "@/components/gpu/trouble";
-import { useCreateGeneration, useGenerationActions, useMakingPoolRuns, useStatus } from "@/lib/api";
+import { useCreateGeneration, useGenerationActions, useMakingPoolRuns, usePlaceName, useStatus } from "@/lib/api";
+import { knownPlace } from "@/lib/place-name";
import { placeholdersOn } from "@/lib/demo-mode";
import { useSoulFinish } from "./soul-finish";
import { elapsed, formatCost, leftLabel, notePace, ratioValue, timeAgo, timeLeft } from "@/lib/format";
@@ -342,6 +343,8 @@ const OutputTile = memo(function OutputTile({ g, index, ratio, layered, count }:
export const GenerationGroup = memo(function GenerationGroup({ g, newest, first }: { g: Generation; newest?: boolean; /** The feed's top request (newest first). */ first?: boolean }) {
const feed = useFeed();
const { favorite, trash } = useGenerationActions();
+ // A run on this studio's GPUs is headed with their place name ("Our GPUs").
+ const site = (usePlaceName() ?? knownPlace()).label;
const ratio = tileRatio(g);
const active = g.status === "queued" || g.status === "running";
const placeholders = Math.max(1, g.request.params?.numOutputs ?? 1);
@@ -376,7 +379,7 @@ export const GenerationGroup = memo(function GenerationGroup({ g, newest, first
<p className="mt-0.5 flex flex-wrap items-center gap-x-1.5 text-[12px] text-muted-foreground">
<span className="inline-flex items-center gap-1">
{g.engine === "open" ? <Cpu className="size-3" /> : <Cloud className="size-3" />}
- {g.provider === "mock" ? "Placeholder" : g.provider === "local" ? "Browser" : g.engine === "open" ? "Open source" : "Cloud"}
+ {g.provider === "mock" ? "Placeholder" : g.provider === "local" ? "Browser" : g.place === "pool" ? site : g.engine === "open" ? "Open source" : "Cloud"}
</span>
{meta.map((m, i) => (
<span key={i} className="before:mr-1.5 before:content-['·']">
diff --git a/src/components/studio/run-place-chip.tsx b/src/components/studio/run-place-chip.tsx
index 8422d9eb..617524ac 100644
--- a/src/components/studio/run-place-chip.tsx
+++ b/src/components/studio/run-place-chip.tsx
@@ -11,6 +11,7 @@ import { useIsMobile } from "@/hooks/use-mobile";
import type { Engine, GenerationRequest } from "@/lib/catalog/types";
import { CONNECT_GPU_EVENT, signInHref, useHydrated, useStatus, useViewer } from "@/lib/api";
import { formatCost } from "@/lib/format";
+import { placeOf, type Place } from "@/lib/place-name";
import { quoteBody, useHostedQuote, useSettled } from "@/lib/hosted";
import { checkedPool, openCheckPlace, runPlace, type RunAudience, type RunPlace, type RunPlaceInput } from "@/lib/run-place";
import { cn } from "@/lib/utils";
@@ -25,7 +26,7 @@ const ICONS: Record<RunPlace["where"], typeof Cloud> = { cloud: Cloud, gpu: Cpu,
* before, so a chip never says "Not available here" to the owner and then takes it back. With it, the account's own GPU
* and its first key (who its paid runs are billed to).
*/
-export function useRunViewer(): { audience: RunAudience; gpu: boolean; hosted: boolean; preferPool: boolean; payer: RunPlaceInput["payer"] } | null {
+export function useRunViewer(): { audience: RunAudience; gpu: boolean; hosted: boolean; preferPool: boolean; payer: RunPlaceInput["payer"]; place: Place } | null {
const hydrated = useHydrated();
const viewer = useViewer().data;
const status = useStatus().data;
@@ -38,11 +39,12 @@ export function useRunViewer(): { audience: RunAudience; gpu: boolean; hosted: b
hosted: !!status?.viewer?.hosted,
preferPool: !!status?.viewer?.hosted && status.viewer.prefer === "pool",
payer: keys.includes("fal") ? "fal" : (keys[0] ?? null),
+ place: placeOf(status?.viewer?.hosted ? status.viewer.placeName : null),
};
}
/** The place and price for this viewer (null until the viewer is known). */
-export function useRunPlace(input: Omit<RunPlaceInput, "audience" | "format" | "gpu" | "hosted" | "preferPool" | "payer">): RunPlace | null {
+export function useRunPlace(input: Omit<RunPlaceInput, "audience" | "format" | "gpu" | "hosted" | "preferPool" | "payer" | "place">): RunPlace | null {
const who = useRunViewer();
return who ? runPlace({ ...input, ...who, format: formatCost }) : null;
}
diff --git a/src/components/studio/viewer.tsx b/src/components/studio/viewer.tsx
index b5bb923b..5aac1b7c 100644
--- a/src/components/studio/viewer.tsx
+++ b/src/components/studio/viewer.tsx
@@ -13,7 +13,8 @@ import { formatCost, timeAgo } from "@/lib/format";
import { PRESETS as GRADE_PRESETS } from "@/lib/grade";
import { trashDaysLeft, userTitle } from "@/lib/library";
import { editOnlyFormat, isLayered, layerInfo, outputActions, type OutputAction } from "@/lib/output-actions";
-import { useEngineMode, useIsAccount, useLikelyVisitor, useStatus } from "@/lib/api";
+import { useEngineMode, useIsAccount, useLikelyVisitor, usePlaceName, useStatus } from "@/lib/api";
+import { knownPlace } from "@/lib/place-name";
import { placeholdersOn } from "@/lib/demo-mode";
import { cn } from "@/lib/utils";
import { copyWithToast } from "@/lib/clipboard";
@@ -62,6 +63,8 @@ function Details({ g, index }: { g: Generation; index: number }) {
const p = g.request.params ?? {};
const title = userTitle(g);
const aiTag = useAiTag();
+ // A run on this studio's GPUs says their place name ("Made on: Our GPUs").
+ const site = (usePlaceName() ?? knownPlace()).label;
if (g.feature === "upload") {
return (
<div className="space-y-4">
@@ -91,7 +94,7 @@ function Details({ g, index }: { g: Generation; index: number }) {
</div>
<div className="divide-y rounded-lg border px-3">
<Row label="Model" value={g.modelName ?? g.modelId} />
- <Row label="Made on" value={g.provider === "mock" ? "Placeholder" : g.provider === "local" ? "In your browser" : g.place === "pool" ? "This studio" : g.engine === "open" ? "Your GPU" : "Cloud"} />
+ <Row label="Made on" value={g.provider === "mock" ? "Placeholder" : g.provider === "local" ? "In your browser" : g.place === "pool" ? site : g.engine === "open" ? "Your GPU" : "Cloud"} />
<Row label="Mode" value={OPERATION_LABELS[g.op]} />
<Row label={g.modelId.startsWith("fuobe-soul") ? "Look" : "Preset"} value={g.presetName} />
<Row label="Finish" value={finishText(g.outputs[index])} />
diff --git a/src/components/workers-admin.tsx b/src/components/workers-admin.tsx
index c7e246c5..2cc25502 100644
--- a/src/components/workers-admin.tsx
+++ b/src/components/workers-admin.tsx
@@ -13,6 +13,7 @@ import { Input } from "@/components/ui/input";
import { useHydrated, useViewer } from "@/lib/api";
import { copyWithToast } from "@/lib/clipboard";
import { deviceLabel } from "@/lib/gpu/readiness";
+import { PLACE_NAME_DEFAULT, PLACE_NAME_MAX } from "@/lib/place-name";
import { cn } from "@/lib/utils";
/**
@@ -294,6 +295,7 @@ export function WorkersAdmin() {
Run this studio&apos;s ComfyUI jobs on the workers
</label>
</div>
+ <PlaceNameField saved={where.data?.find((s) => s.name === "hostedPlaceName")} />
{token && <TokenOnce token={token} onDone={() => setToken(null)} />}
<form
className="flex flex-wrap items-center gap-2"
@@ -321,6 +323,48 @@ export function WorkersAdmin() {
);
}
+/**
+ * The name visitors read for this studio's GPUs while hosted runs are on ("Runs on Our GPUs", src/lib/place-name.ts).
+ * Empty: FUOBE_PLACE_NAME, else "Our GPUs". A billing service's own name for them wins over both.
+ */
+function PlaceNameField({ saved }: { saved?: { value: string; fromEnv: boolean } }) {
+ const qc = useQueryClient();
+ const [typed, setTyped] = useState<string | null>(null);
+ const value = typed ?? (saved && !saved.fromEnv ? saved.value : "");
+ const save = useMutation({
+ mutationFn: () => call("PUT", "/api/settings", { hostedPlaceName: value.trim() }),
+ onSuccess: () => {
+ setTyped(null);
+ toast.success("Saved");
+ void qc.invalidateQueries({ queryKey: ["settings"] });
+ void qc.invalidateQueries({ queryKey: ["status"] });
+ },
+ onError: (e) => toast.error((e as Error).message),
+ });
+ return (
+ <form
+ className="max-w-2xl space-y-1.5"
+ onSubmit={(e) => {
+ e.preventDefault();
+ save.mutate();
+ }}
+ >
+ <label htmlFor="place-name" className="text-[14px] font-medium">
+ Name for your GPUs
+ </label>
+ <div className="flex flex-wrap items-center gap-2">
+ <Input id="place-name" maxLength={PLACE_NAME_MAX} placeholder={saved?.fromEnv ? saved.value : PLACE_NAME_DEFAULT} value={value} onChange={(e) => setTyped(e.target.value)} className="h-9 w-64" />
+ <Button size="sm" variant="secondary" className="h-9" disabled={typed === null || save.isPending}>
+ Save
+ </Button>
+ </div>
+ <p className="text-[13px] text-muted-foreground">
+ Visitors read it where their runs go, as in &ldquo;Runs on {value.trim() || (saved?.fromEnv ? saved.value : PLACE_NAME_DEFAULT)}&rdquo;. Shown while runs on your GPUs are open to accounts.
+ </p>
+ </form>
+ );
+}
+
/** The Workers line in Settings: how many, and the way in. */
export function WorkersChip() {
const owner = useViewer().data?.owner;
diff --git a/src/lib/api.ts b/src/lib/api.ts
index d895ae56..bfe18072 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -37,6 +37,7 @@ import type { AccessSummary } from "./model-access";
import { ADD_KEY_HEADER, isCloudProvider, type CloudProvider } from "./your-keys";
import type { Diagnosis } from "./diagnose";
import { BILLING_EVENT, BILLING_HEADER, refreshPriceChecks, type BillingAction, type BillingRefusalDetail, type HostedBalance } from "./hosted";
+import { knownPlace, notePlaceName, placeOf, type Place } from "./place-name";
/** What the status strip says of a GPU that didn't answer (src/server/account-gpu.ts VisitorTrouble). */
export type GpuTroubleView = Pick<Diagnosis, "cause" | "words" | "actions" | "retryable" | "details">;
@@ -963,6 +964,8 @@ export interface StatusInfo {
hosted?: boolean;
/** "pool": runs go to this studio's GPUs first, even with its own GPU online (either can still be picked). */
prefer?: "pool";
+ /** The name visitors read for this install's GPUs ("Runs on Our GPUs", src/lib/place-name.ts). Only with `hosted`. */
+ placeName?: string;
/** The words a preset card shows when its run would go to this studio's GPUs ("Try free"), from the server. None: no words. */
cardText?: string;
/** What this studio's GPUs keep off, for a viewer with no GPU of its own: its pickers leave it out (src/lib/pool-rules.ts). */
@@ -1013,12 +1016,27 @@ export async function saveSettings(patch: Record<string, string>): Promise<void>
export function useStatus() {
return useQuery({
queryKey: ["status"],
- queryFn: async () => json<StatusInfo>(await fetchWithin("/api/status", READ_LIMIT_MS.status)),
+ queryFn: async () => {
+ const s = await json<StatusInfo>(await fetchWithin("/api/status", READ_LIMIT_MS.status));
+ // Kept for words made outside React (the toast that offers a run on this install's GPUs).
+ notePlaceName(s.viewer?.hosted ? s.viewer.placeName : null);
+ return s;
+ },
staleTime: 15_000,
refetchInterval: 30_000,
});
}
+/**
+ * The name this viewer reads for this install's GPUs (src/lib/place-name.ts): `label` as set ("Our GPUs"), `text` inside
+ * a sentence ("our GPUs"). Null while hosted runs are off for this viewer (the owner; any viewer of an install with them
+ * off): its pages keep their own words.
+ */
+export function usePlaceName(): Place | null {
+ const v = useStatus().data?.viewer;
+ return v?.hosted ? placeOf(v.placeName) : null;
+}
+
/** What an uploaded clip's header says: length, size, frame rate and sound (empty for formats the server can't read). */
export interface ClipFacts {
duration?: number;
@@ -1585,7 +1603,9 @@ export function watchGuestRefusals(): void {
res
.clone()
.json()
- .then((b: { error?: string }) => toast(b.error ?? "Your GPU isn't answering right now.", { action: { label: "Run on this studio's GPUs", onClick: again } }))
+ .then((b: { error?: string; placeName?: string }) =>
+ toast(b.error ?? "Your GPU isn't answering right now.", { action: { label: `Run on ${(b.placeName ? placeOf(b.placeName) : knownPlace()).label}`, onClick: again } }),
+ )
.catch(() => {});
}
// A run the GPU pre-flight stopped (something missing on the viewer's ComfyUI): the guided fix opens with its plan.
diff --git a/src/lib/comfy-compose.ts b/src/lib/comfy-compose.ts
index 03f91d78..162d53f3 100644
--- a/src/lib/comfy-compose.ts
+++ b/src/lib/comfy-compose.ts
@@ -105,6 +105,18 @@ export interface ComposeCatalog {
get(id: string): { manifest: ManifestWorkflow; workflow: ComfyWorkflow };
}
+/**
+ * A refusal's words where they are read: an account's run on this install's GPUs (`site`, ctx.accountOnInstall) gets
+ * plain words that name no engine, no ComfyUI and no "your GPU" (it isn't theirs); anywhere else, the words it always had.
+ */
+const onPlace = (site: boolean | undefined, own: string, onSite: string): string => (site ? onSite : own);
+
+/** Where open models run, inside a refusal: "on the open engine", or (an account's run on this install's GPUs) "with open models". */
+const openEngine = (site: boolean | undefined): string => onPlace(site, "on the open engine", "with open models");
+
+/** The one sentence for a run that can't be made (POOL_WORDS.failed in src/lib/relay.ts, kept equal by its test). */
+export const SITE_FAILED_WORDS = "Sorry, this one couldn't be made.";
+
/** A request the composer refuses, in words (status: the HTTP status the server answers with). */
export class ComposeError extends Error {
constructor(
@@ -351,7 +363,7 @@ const clipFacts = (clip: MediaInfo | undefined) => ({ width: clip?.width, height
* selection n and slow motion (src/lib/av/fps.ts), the chunked upscalers' short side and pass size.
* `holds` = frame-sized copies of the whole clip the graph keeps in memory (for the RAM check).
*/
-function videoFinishValues(manifest: ManifestWorkflow, input: GenInput, clip: MediaInfo | undefined, extra: Record<string, unknown>) {
+function videoFinishValues(manifest: ManifestWorkflow, input: GenInput, clip: MediaInfo | undefined, extra: Record<string, unknown>, site?: boolean) {
const b = manifest.bindings;
const d = manifest.defaults;
const facts = clipFacts(clip);
@@ -386,7 +398,7 @@ function videoFinishValues(manifest: ManifestWorkflow, input: GenInput, clip: Me
const sourceFps = clip?.fps && clip.fps > 0 ? clip.fps : input.sourceFps && input.sourceFps > 0 ? input.sourceFps : undefined;
if (!sourceFps) {
throw new ComposeError(
- `FPS Boost on the open engine works out its frames from the clip's frame rate, and this file doesn't say what it is, so ${target} fps can't be hit. Re-save it as MP4 (H.264) or WebM and try again`,
+ `FPS Boost ${openEngine(site)} works out its frames from the clip's frame rate, and this file doesn't say what it is, so ${target} fps can't be hit. Re-save it as MP4 (H.264) or WebM and try again`,
);
}
const plan = fpsPlan(sourceFps, target, slowdown, Number(manifest.limits?.maxMultiplier ?? 16));
@@ -425,10 +437,13 @@ function videoFinishValues(manifest: ManifestWorkflow, input: GenInput, clip: Me
}
/** Per-job length limits a graph enforces (manifest limits.maxDurationSec), in words. */
-const OVER_LIMIT: Record<string, (s: number) => string> = {
- "still-motion": (s) => `Ken Burns on the open engine makes up to ${s} s per clip — split a longer move into pieces`,
- "audio-loop": (s) => `Loops on the open engine run up to ${s / 60} minutes (${s} s)`,
- music: (s) => `This model writes songs up to ${s % 60 ? `${s} s` : `${s / 60} minutes`} on your GPU: pick a shorter length`,
+const OVER_LIMIT: Record<string, (s: number, site?: boolean) => string> = {
+ "still-motion": (s, site) => `Ken Burns ${openEngine(site)} makes up to ${s} s per clip — split a longer move into pieces`,
+ "audio-loop": (s, site) => `Loops ${openEngine(site)} run up to ${s / 60} minutes (${s} s)`,
+ music: (s, site) => {
+ const most = s % 60 ? `${s} s` : `${s / 60} minutes`;
+ return onPlace(site, `This model writes songs up to ${most} on your GPU: pick a shorter length`, `This model writes songs up to ${most}. Pick a shorter length.`);
+ },
};
/** Songs longer than this decode in tiles on your GPU (MiniMax Music 3's switch). */
@@ -444,7 +459,7 @@ export const TILED_SONG_SECONDS = 120;
export async function composeWorkflow(endpointTemplate: string, input: GenInput, ctx: ComposeContext): Promise<ComposedPrompt> {
// "video-concat-{n}": one workflow per clip count.
const clips = input.videos ?? [];
- if (endpointTemplate.includes("{n}") && clips.length > 4) throw new ComposeError("ComfyUI joins up to 4 clips at a time");
+ if (endpointTemplate.includes("{n}") && clips.length > 4) throw new ComposeError(onPlace(ctx.accountOnInstall, "ComfyUI joins up to 4 clips at a time", "Up to 4 clips can be joined at a time."));
const extra: Record<string, unknown> = { ...(input.extra ?? {}) };
// The second audio track (mux background): the canonical input when the runtime sends it, else params.extra.audio2.
const given2 = (input as GenInput & { audio2?: unknown }).audio2;
@@ -629,7 +644,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
const frames = Math.max(1, Math.floor((clipLength - start) * fps));
const cap = Number(manifest.limits?.maxFrames ?? Infinity);
if (frames > cap) {
- throw new ComposeError(`This model redraws up to ${cap} frames per job on the open engine (${seconds(cap / fps)} s at ${fps} fps; this clip is ${seconds(clipLength - start)} s) — trim the clip, or pick a range and a frame rate in the Mixed Media studio`);
+ throw new ComposeError(`This model redraws up to ${cap} frames per job ${openEngine(ctx.accountOnInstall)} (${seconds(cap / fps)} s at ${fps} fps; this clip is ${seconds(clipLength - start)} s) — trim the clip, or pick a range and a frame rate in the Mixed Media studio`);
}
values.frames = frames;
}
@@ -648,7 +663,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
const cap = Number(manifest.limits?.maxFrames ?? 0);
if (cap && frames > cap) {
const what = ctx.op === "avatar" ? "A talking avatar" : "Lip re-sync";
- throw new ComposeError(`${what} on the open engine takes up to ${seconds(cap / fps)} s of speech per job (this voice is ${seconds(voiceLength)} s) — split it into shorter parts`);
+ throw new ComposeError(`${what} ${openEngine(ctx.accountOnInstall)} takes up to ${seconds(cap / fps)} s of speech per job (this voice is ${seconds(voiceLength)} s) — split it into shorter parts`);
}
values.frames = frames;
}
@@ -661,7 +676,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
values.upscalerScale = k === 4 ? "4x" : "2x";
}
// Video finishing (Upscale hub): export formats, HDR curves, FPS Boost's m / n, chunked upscaling.
- const finish = videoFinishValues(manifest, input, clip, extra);
+ const finish = videoFinishValues(manifest, input, clip, extra, ctx.accountOnInstall);
Object.assign(values, finish.values);
// Open-H3 Regenerate (video-regenerate-h3): the output size and the draft preset as the pack's strings, and the frames
// this pass reads (its seconds at 24 fps, at most 15 s); the words are what it redraws from (regenerate.ts).
@@ -711,7 +726,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
if (b.easeInOut && input.easing) values.easeInOut = input.easing === "linear" ? 0 : 1;
const maxSeconds = Number(manifest.limits?.maxDurationSec ?? 0);
if (maxSeconds && b.duration && Number(values.duration ?? d.duration ?? 0) > maxSeconds + 0.001) {
- throw new ComposeError(OVER_LIMIT[manifest.capability]?.(maxSeconds) ?? `This workflow makes up to ${maxSeconds} s per job`);
+ throw new ComposeError(OVER_LIMIT[manifest.capability]?.(maxSeconds, ctx.accountOnInstall) ?? `This workflow makes up to ${maxSeconds} s per job`);
}
// Edit speech (speech-edit-auk): the edit windows the planner made, crossfaded back on a linear fade-in with a flat tail
// (src/lib/av/speech-edit-graph.ts says why; both sides of a seam are the same voice, so equal power would bump the level).
@@ -948,7 +963,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
if (ctx.op === "depth-video" && input.colormap) {
const want = input.colormap.toLowerCase() === "grayscale" ? "gray" : input.colormap.toLowerCase();
if (b.colormap && (want === "gray" || want === "inferno")) values.colormap = want;
- else if (want !== "gray") throw new ComposeError(b.colormap ? "The open engine's depth maps come in grayscale or inferno — turbo, magma and viridis are on the cloud" : "This depth model makes grayscale maps only — pick Video Depth Anything for inferno");
+ else if (want !== "gray") throw new ComposeError(b.colormap ? onPlace(ctx.accountOnInstall, "The open engine's depth maps come in grayscale or inferno — turbo, magma and viridis are on the cloud", "Open models make depth maps in grayscale or inferno — turbo, magma and viridis are on the cloud") : "This depth model makes grayscale maps only — pick Video Depth Anything for inferno");
}
if (b.sideBySide && input.sideBySide !== undefined) values.sideBySide = input.sideBySide;
// A wrapper graph that loads its LoRA itself (kijai's InfiniteTalk: WanVideoLoraSelect, no core model loader to attach
@@ -1151,7 +1166,15 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
const [maxW, maxH] = [Number(manifest.limits?.maxWidth ?? Infinity), Number(manifest.limits?.maxHeight ?? Infinity)];
const room = Math.min(maxW / src.width, maxH / src.height);
const asked = Number(values.scale ?? d.scale ?? 1);
- if (room < 1) throw new ComposeError(`SeedVR2 makes pictures up to ${maxW} × ${maxH} px on your GPU, and this one is already ${src.width} × ${src.height}: pick 4x ESRGAN for it`, 400);
+ if (room < 1)
+ throw new ComposeError(
+ onPlace(
+ ctx.accountOnInstall,
+ `SeedVR2 makes pictures up to ${maxW} × ${maxH} px on your GPU, and this one is already ${src.width} × ${src.height}: pick 4x ESRGAN for it`,
+ `SeedVR2 makes pictures up to ${maxW} × ${maxH} px, and this one is already bigger. Pick 4x ESRGAN for it.`,
+ ),
+ 400,
+ );
if (asked > room) values.scale = Math.floor(room * 100) / 100;
}
}
@@ -1219,9 +1242,15 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
const need = clip.width * clip.height * 12 * (clip.frames ?? clipLength * (clip.fps ?? 30)) * 2.5;
const budget = ((await ctx.serverRam?.()) ?? 16 * GB) / 2;
if (need > budget) {
+ // On this install's GPUs: how long a clip fits, in plain words.
+ const fits = Math.floor((clipLength * budget) / need);
throw new ComposeError(
- `Whisper captions hold the whole clip in memory: this one needs about ${Math.ceil(need / GB)} GB of RAM and this ComfyUI can spare ${Math.floor(budget / GB)} GB. ` +
- "Use Qwen3-ASR + Caption burn-in for long clips, or trim it first",
+ onPlace(
+ ctx.accountOnInstall,
+ `Whisper captions hold the whole clip in memory: this one needs about ${Math.ceil(need / GB)} GB of RAM and this ComfyUI can spare ${Math.floor(budget / GB)} GB. ` +
+ "Use Qwen3-ASR + Caption burn-in for long clips, or trim it first",
+ `This clip is too long to caption in one go. Trim it to under ${fits >= 60 ? `${Math.floor(fits / 60)} min` : `${Math.max(1, fits)} s`}.`,
+ ),
);
}
}
@@ -1235,7 +1264,7 @@ export async function composeWorkflow(endpointTemplate: string, input: GenInput,
const bound = applyBindings(graph, b, Object.fromEntries(Object.entries(values).filter(([k]) => !left.includes(k))));
// maxDimension targets for removed reference branches are expected: their scale nodes go with the loader.
const realMissing = bound.missing.filter((m) => !/^maxDimension\b/.test(m));
- if (realMissing.length) throw new ComposeError(`Workflow ${manifest.id} bindings point at missing nodes: ${realMissing.join(", ")}`);
+ if (realMissing.length) throw new ComposeError(onPlace(ctx.accountOnInstall, `Workflow ${manifest.id} bindings point at missing nodes: ${realMissing.join(", ")}`, SITE_FAILED_WORDS));
// A saved 3D view read without the browser (Any Angle): Load3D's picture entries point at the run's photo.
let wf = withLoad3dImages(bound.workflow, typeof values.image === "string" ? values.image : undefined);
// Qwen3-TTS's clone needs the sample's words unless it clones from the voice's timbre alone (x_vector_only):
diff --git a/src/lib/demo-mode.ts b/src/lib/demo-mode.ts
index 0226d23e..a67cea57 100644
--- a/src/lib/demo-mode.ts
+++ b/src/lib/demo-mode.ts
@@ -9,6 +9,7 @@
*/
import { formatCost } from "@/lib/format";
+import { knownPlace, type Place } from "@/lib/place-name";
/** Settings' switch. */
export const PLACEHOLDER_SETTING = "Show placeholder results (for a tour)";
@@ -31,8 +32,8 @@ export const PLACEHOLDER_ACTION_LABELS: Record<PlaceholderAction, string> = {
export const isPlaceholder = (g: { provider?: string | null } | null | undefined): boolean => g?.provider === "mock";
/**
- * What a one-tap "Run again" adds to its label, so a new run never starts unannounced: " on your GPU", " on the
- * studio's GPUs" (a hosted run) or, for a cloud run (billed), its price (" · ≈ $0.42") when `price` says it, else
+ * What a one-tap "Run again" adds to its label, so a new run never starts unannounced: " on your GPU", " on our GPUs"
+ * (a hosted run, said with the place name `now.place`) or, for a cloud run (billed), its price (" · ≈ $0.42") when `price` says it, else
* " · paid"; nothing before the run is known. The new run follows the placeholder switch as it is now
* (`now.placeholders`, from the status), not the old result: nothing while placeholders are on, even after a real
* result, and a real run's words after an old placeholder once they're off.
@@ -40,9 +41,9 @@ export const isPlaceholder = (g: { provider?: string | null } | null | undefined
* `price`: what the new run costs in US dollars, from the estimate the original run was priced at (againPrice or the
* studio's own estimate), or null when that isn't known.
*/
-export function againWhere(g: { engine: string; place?: "pool" } | null | undefined, now: { placeholders: boolean }, price?: number | null): string {
+export function againWhere(g: { engine: string; place?: "pool" } | null | undefined, now: { placeholders: boolean; place?: Place | null }, price?: number | null): string {
if (!g || now.placeholders) return "";
- if (g.place === "pool") return " on the studio's GPUs";
+ if (g.place === "pool") return ` on ${(now.place ?? knownPlace()).text}`;
if (g.engine === "open") return " on your GPU";
return paidSuffix(price);
}
diff --git a/src/lib/place-name.ts b/src/lib/place-name.ts
new file mode 100644
index 00000000..9b908eed
--- /dev/null
+++ b/src/lib/place-name.ts
@@ -0,0 +1,51 @@
+/**
+ * The name visitors read for this install's GPUs (hosted runs): "Runs on {place}", "Made on: {Place}", "Run on {Place}".
+ * The code never names them: the name comes from the billing service's policy (`placeName`), else the install's own
+ * setting (Settings → Workers → Name for your GPUs, or FUOBE_PLACE_NAME), else PLACE_NAME_DEFAULT
+ * (src/server/place-name.ts reads them in that order; the browser gets it as `viewer.placeName`, only while hosted runs
+ * are on).
+ *
+ * Every sentence is written so that no verb has to agree with the name ("Runs on {place}", never "{place} are…"), so any
+ * name reads right.
+ */
+
+/** The name when nothing sets one. */
+export const PLACE_NAME_DEFAULT = "Our GPUs";
+
+/** The longest name kept (characters); a longer one is cut there. */
+export const PLACE_NAME_MAX = 40;
+
+/** The place name two ways: `label` as set ("Our GPUs", a heading or a button), `text` inside a sentence ("our GPUs"). */
+export interface Place {
+ label: string;
+ text: string;
+}
+
+/**
+ * A name as it is kept: control characters out, spaces folded, trimmed, at most PLACE_NAME_MAX characters (an emoji is
+ * never cut in half). Null when nothing is left, or it isn't text.
+ */
+export function cleanPlaceName(raw: unknown): string | null {
+ if (typeof raw !== "string") return null;
+ const s = raw.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim();
+ if (!s) return null;
+ const chars = Array.from(s);
+ return chars.length <= PLACE_NAME_MAX ? s : chars.slice(0, PLACE_NAME_MAX).join("").trimEnd();
+}
+
+/** The place for a name (PLACE_NAME_DEFAULT when none): a leading "Our " reads "our " inside a sentence. */
+export function placeOf(name?: string | null): Place {
+ const label = cleanPlaceName(name) ?? PLACE_NAME_DEFAULT;
+ return { label, text: label.replace(/^Our /, "our ") };
+}
+
+/** The last name the status gave this browser, for words made outside React (a toast's button). */
+let known: string | null = null;
+
+/** Note the name the status gave (GET /api/status `viewer.placeName`). */
+export function notePlaceName(name: unknown): void {
+ known = cleanPlaceName(name);
+}
+
+/** The place as this browser last heard it (the default before it heard one). */
+export const knownPlace = (): Place => placeOf(known);
diff --git a/src/lib/relay.ts b/src/lib/relay.ts
index 5b55ec31..79c3ef5f 100644
--- a/src/lib/relay.ts
+++ b/src/lib/relay.ts
@@ -469,7 +469,16 @@ export const RELAY_WORDS = {
export const POOL_WORDS = {
inLine: "In line",
working: "Working",
- failed: "This one couldn't be made.",
+ failed: "Sorry, this one couldn't be made.",
+} as const;
+
+/**
+ * What a run says about the person's own files when a GPU couldn't use them (tabFailureWords): kept as they are on a run
+ * on this install's GPUs too, since they say what to change.
+ */
+export const FILE_TROUBLE_WORDS = {
+ crashed: "This run couldn't finish with these files or settings.",
+ unreadable: "A clip or sound in this run couldn't be read.",
} as const;
/** A script's open-source run (an API token) while the owner's ComfyUI is on the owner's computer. */
@@ -495,9 +504,9 @@ export function tabFailureWords(reason: TabFailure, status?: number): string {
case "model-unverified":
return "The GPU that took this run refused it: it needs a model file that GPU couldn't verify.";
case "input-crashed":
- return "This run couldn't finish with these files or settings.";
+ return FILE_TROUBLE_WORDS.crashed;
case "input-unreadable":
- return "A clip or sound in this run couldn't be read.";
+ return FILE_TROUBLE_WORDS.unreadable;
case "bad-ticket":
return "This run couldn't be made with these settings.";
case "unsafe-model":
diff --git a/src/lib/run-place.ts b/src/lib/run-place.ts
index d6e501b7..85f279a2 100644
--- a/src/lib/run-place.ts
+++ b/src/lib/run-place.ts
@@ -1,5 +1,6 @@
import { RUN_SHOWN_HEADER, shownHeader } from "./guest-access";
import { ownSetupDetail, ownSetupLabel, type OwnSetup } from "./own-setup";
+import { placeOf, type Place } from "./place-name";
import { lineWords } from "./pool-line";
import { billedTo, CLOUD_KEY, type CloudProvider } from "./your-keys";
@@ -35,6 +36,8 @@ export interface RunPlaceInput {
hosted?: boolean;
/** Runs go to this studio's GPUs first, even when the viewer has a GPU of its own (the studio's policy). */
preferPool?: boolean;
+ /** The name visitors read for this studio's GPUs (usePlaceName; absent: "Our GPUs"). */
+ place?: Place;
/**
* The price of a run on this studio's GPUs (the billing service's words; empty text: free), undefined while pricing.
* `refused`: the price check refused the run (its words are `text`), so it can't start now. `wait`: where it would
@@ -51,7 +54,7 @@ export interface RunPlaceInput {
export interface RunPlace {
/** What the chip's icon shows. */
where: "cloud" | "gpu" | "pool" | "browser" | "unavailable";
- /** The chip's words: "Your GPU", "This studio's GPUs", the cloud model's name, "Your browser", "Not available here". */
+ /** The chip's words: "Your GPU", the place name of this studio's GPUs ("Our GPUs"), the cloud model's name, "Your browser", "Not available here". */
label: string;
/** "Free", "≈ $0.04", "Placeholder · free", "Price unknown", or "" (not priced yet, or nothing to price). */
price: string;
@@ -113,7 +116,7 @@ export function runPlace(input: RunPlaceInput): RunPlace {
const price = placePrice({ demo: input.demo, costUsd: input.costUsd, open }, input.format);
const withModels = models.length ? ` with ${list(models)}` : "";
// Hosted runs: an account (or a guest, once signed up) with no GPU of its own runs open models on this studio's GPUs,
- // at the billing service's price (the studio composer's "This studio's GPUs" chip).
+ // at the billing service's price, said with their place name ("Runs on our GPUs").
if (open && input.hosted && audience !== "owner" && (!input.gpu || input.preferPool)) {
const signup = audience === "guest";
// Runs on the visitor's own GPU or key only: said in the setup's own words, and the send button opens that setup.
@@ -131,20 +134,21 @@ export function runPlace(input: RunPlaceInput): RunPlace {
setup,
};
}
+ const place = input.place ?? placeOf(null);
const refused = !input.demo && input.pool?.refused ? input.pool.text : undefined;
const poolPrice = input.demo ? price : input.pool ? input.pool.text || "Free" : "";
const tip = input.demo
? "Placeholder results are on (Settings), so outputs are free stand-ins."
: refused
? (input.pool?.sub ?? refused)
- : `${input.pool?.sub ?? `Runs on this studio's GPUs${withModels}.`}${input.pool?.wait ? ` ${input.pool.wait}.` : ""}${signup ? " Create a free account to run it." : ""}`;
+ : `${input.pool?.sub ?? `Runs on ${place.text}${withModels}.`}${input.pool?.wait ? ` ${input.pool.wait}.` : ""}${signup ? " Free with an account." : ""}`;
return {
where: "pool",
- label: "This studio's GPUs",
+ label: place.label,
price: poolPrice,
- title: "Runs on this studio's GPUs",
+ title: `Runs on ${place.text}`,
tip,
- send: input.demo ? price : refused ?? [poolPrice, signup ? "this studio's GPUs, after sign-up" : "this studio's GPUs"].filter(Boolean).join(" · "),
+ send: input.demo ? price : refused ?? [poolPrice, signup && "sign up to run"].filter(Boolean).join(" · "),
...(signup && !refused && { needs: "signup" as const }),
...(refused && { refused }),
};
diff --git a/src/lib/your-keys.ts b/src/lib/your-keys.ts
index e7935c87..2e0226a8 100644
--- a/src/lib/your-keys.ts
+++ b/src/lib/your-keys.ts
@@ -1,4 +1,5 @@
import { FAL_KEYS_URL } from "./connections";
+import { placeOf } from "./place-name";
import { dualEngine } from "./catalog/engines";
import { presetRoutes } from "./catalog/preset-recipe-routes";
@@ -64,7 +65,7 @@ export const NOT_ACCOUNT_KEYS = "Log in to add your keys.";
/** The part of /api/status these read (StatusInfo in src/lib/api.ts). */
export interface KeyStatus {
- viewer?: { kind: "guest" | "account"; gpu?: { connected: boolean }; keys?: CloudProvider[]; paidAllowed?: boolean };
+ viewer?: { kind: "guest" | "account"; gpu?: { connected: boolean }; keys?: CloudProvider[]; paidAllowed?: boolean; hosted?: boolean; placeName?: string };
}
type Routed = { engine: string; routes: { provider: string }[] };
@@ -128,17 +129,26 @@ export function accountEngine(
): { locked: { text: string; tip: string; href: string; addKey?: true } } | { tips: { cloud: string; open: string } } | null {
const v = s?.viewer;
if (v?.kind !== "account") return null;
- if (v.paidAllowed === false) return { locked: { text: "Open source", tip: "Runs on your own GPU.", href: "/settings#your-gpu" } };
+ // Hosted runs: open models run free on this studio's GPUs (said with their place name), a GPU of one's own optional.
+ const place = v.hosted ? placeOf(v.placeName) : null;
+ const open = place ? `Free on ${place.text}.` : "Runs on your own GPU.";
+ if (v.paidAllowed === false) return { locked: { text: "Open source", tip: open, href: "/settings#your-gpu" } };
const keys = v.keys ?? [];
if (!keys.length) {
return {
- locked: { text: "Open source", tip: "Runs on your own GPU. Add a fal.ai or Replicate key to use paid models.", href: "/settings#your-keys", addKey: true },
+ locked: { text: "Open source", tip: `${open} Add a fal.ai or Replicate key to use paid models.`, href: "/settings#your-keys", addKey: true },
};
}
return {
tips: {
cloud: `Paid models, billed to your ${names(keys)} ${keys.length > 1 ? "accounts" : "account"}`,
- open: v.gpu?.connected ? "Open models on your own GPU" : "Open models on your own GPU. Connect it first",
+ open: place
+ ? v.gpu?.connected
+ ? `Open models, free on ${place.text} or your GPU`
+ : `Open models, free on ${place.text}`
+ : v.gpu?.connected
+ ? "Open models on your own GPU"
+ : "Open models on your own GPU. Connect it first",
},
};
}
diff --git a/src/server/account-gpu.ts b/src/server/account-gpu.ts
index a9bfaf87..60cc77d3 100644
--- a/src/server/account-gpu.ts
+++ b/src/server/account-gpu.ts
@@ -14,6 +14,7 @@ import { blockedForAccounts, fetchPublic, isLoopbackGpu, peekText } from "./remo
import { isInstallHost, REFUSED_ADDRESS } from "./gpu/hosts";
import { balance as billingBalance, policy as billingPolicy, type Action, type Balance } from "./billing";
import { poolReady } from "./hosted";
+import { placeName } from "./place-name";
import { poolOwnModels } from "./pool-own-setup";
import { poolRulesOf, type PoolRules, type PresetModel } from "@/lib/pool-rules";
import { diagnoseAddress, diagnoseGpu, gpuHostOf, type Diagnosis, type GpuFailure, type GpuPlace, type GpuStage } from "@/lib/diagnose";
@@ -327,6 +328,8 @@ export interface VisitorView {
* policy says so). Absent: its own GPU first, as before. Either can always be picked.
*/
prefer?: "pool";
+ /** The name visitors read for this install's GPUs ("Runs on Our GPUs"; src/server/place-name.ts). Only with `hosted`. */
+ placeName?: string;
/**
* The words a preset card shows when its run would go to this install's GPUs (the billing service's policy, such as
* "Try free"; with no service, "Try free": those runs are free). Absent: the cards show none.
@@ -392,6 +395,8 @@ export async function visitorStatus(account: Account | null) {
const p = await billingPolicy(account?.id ?? null);
if (p?.hosted) viewer.hosted = true;
if (p?.hosted && p.prefer === "pool") viewer.prefer = "pool";
+ // What the visitor reads for this install's GPUs ("Runs on {name}"): the policy's name, else the install's.
+ if (p?.hosted) viewer.placeName = placeName(p);
const card = p?.hosted && typeof p.cardText === "string" ? p.cardText.trim().slice(0, 40) : "";
if (card) viewer.cardText = card;
// What this studio's GPUs keep off, the open models they can't run right now among it: shown in the pickers with
diff --git a/src/server/billing.ts b/src/server/billing.ts
index 24636fea..06fc82a5 100644
--- a/src/server/billing.ts
+++ b/src/server/billing.ts
@@ -116,6 +116,11 @@ export interface Policy {
* show none). Fuobe has no price words of its own: with a service, only the service says a run there is free.
*/
cardText?: string;
+ /**
+ * The name visitors read for this install's GPUs ("Runs on {name}", at most 40 characters; src/server/place-name.ts).
+ * Absent: the install's own name for them (Settings → Workers, FUOBE_PLACE_NAME), else "Our GPUs".
+ */
+ placeName?: string;
links?: Action[];
notice?: { id: string; text: string; url?: string };
ttlS: number;
diff --git a/src/server/computer/pool.ts b/src/server/computer/pool.ts
index b6ac5be9..f4c082fa 100644
--- a/src/server/computer/pool.ts
+++ b/src/server/computer/pool.ts
@@ -619,7 +619,26 @@ export function lineOrder(rows: TaskRow[], fairShare: boolean): TaskRow[] {
* Only the task as `t` read it: one that has moved on since (another app process put it back in line, or a worker took
* it again with a new lease) stays as it is now, and no attempt is counted. Returns whether it changed.
*/
-export function backInLine(t: TaskRow, o: { blame: boolean; why?: string; last?: boolean; lostAt?: number }): boolean {
+/**
+ * Why a task was stopped for good after its tries, in the owner's words. With hosted runs on, the line retries by itself
+ * until then, so the words say how many tries it had instead of asking for Retry (the account reads one plain sentence
+ * either way); otherwise the words the owner's own jobs always had.
+ */
+export function stoppedWords(kind: "silent" | "down" | "stuck" | "other", tries: number): string {
+ if (!hostedRunsOn()) return OWNER_STOP_WORDS[kind];
+ const why = { silent: "the GPU stopped answering", down: "ComfyUI kept stopping on the GPUs", stuck: "the GPUs couldn't start it", other: "the GPUs couldn't finish it" }[kind];
+ return `Stopped after ${tries} ${tries === 1 ? "try" : "tries"}: ${why}.`;
+}
+
+/** The owner's words for a task stopped for good, with hosted runs off. */
+const OWNER_STOP_WORDS = {
+ silent: "The GPU running this stopped answering, three times. Press Retry.",
+ down: "ComfyUI kept stopping on the GPUs. Press Retry.",
+ stuck: "The GPUs couldn't start this run. Press Retry.",
+ other: "The GPUs couldn't finish this run. Press Retry.",
+};
+
+export function backInLine(t: TaskRow, o: { blame: boolean; why?: string; whyKind?: "silent" | "down" | "stuck"; last?: boolean; lostAt?: number }): boolean {
const d = db();
return d.transaction((): boolean => {
const now = taskById(t.id);
@@ -627,7 +646,7 @@ export function backInLine(t: TaskRow, o: { blame: boolean; why?: string; last?:
const tried = json<string[]>(t.tried_json, []);
const requeues = t.requeues + (o.blame ? 1 : 0);
if (o.blame && (requeues >= MAX_ATTEMPTS || o.last)) {
- endTask(t.id, "failed", { error: o.why ?? "The GPUs couldn't finish this run. Press Retry.", requeues, tried_json: JSON.stringify([...new Set([...tried, t.worker_id ?? ""])].filter(Boolean)) }, true);
+ endTask(t.id, "failed", { error: o.why ?? stoppedWords(o.whyKind ?? "other", requeues), requeues, tried_json: JSON.stringify([...new Set([...tried, t.worker_id ?? ""])].filter(Boolean)) }, true);
return true;
}
if (t.worker_id) logWorkerJob("requeued", t, t.worker_id);
@@ -684,7 +703,7 @@ function sweepLine(d: ReturnType<typeof db>, now: number): void {
const sendingSince = t.sending_since ?? t.claimed_at;
const stuck = t.state === "sending" && !!sendingSince && now - sendingSince > SENDING_MS;
if (silent || down || stuck) {
- backInLine(t, { blame: true, why: silent ? "The GPU running this stopped answering, three times. Press Retry." : down ? "ComfyUI kept stopping on the GPUs. Press Retry." : "The GPUs couldn't start this run. Press Retry.", ...(silent && !t.w_revoked && { lostAt: now }) });
+ backInLine(t, { blame: true, whyKind: silent ? "silent" : down ? "down" : "stuck", ...(silent && !t.w_revoked && { lostAt: now }) });
}
}
const late = d.prepare("SELECT id FROM relay_tasks WHERE pools IS NOT NULL AND state = 'waiting' AND claimed_at IS NULL AND not_after IS NOT NULL AND not_after < ?").all(now) as { id: string }[];
diff --git a/src/server/generations.ts b/src/server/generations.ts
index 0651467a..9bcf38dd 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -125,7 +125,7 @@ import { engineMode, getSetting, withCandidates, withoutCandidates } from "./set
import { blockedForAccounts, discardBody, fetchRemoteToFile, RemoteFetchError } from "./remote-fetch";
import { accountSend } from "./account-send";
import { stamped, stampOf, withoutStamp, withRunStamp } from "./run-stamp";
-import { POOL_WORDS, RELAY_WORDS } from "@/lib/relay";
+import { FILE_TROUBLE_WORDS, POOL_WORDS, RELAY_WORDS } from "@/lib/relay";
import { placeInLine, poolOnWorkers, poolRunsProvider, poolWaitMs, runOnPool } from "./hosted";
import { hostedRunsOn } from "./hosted-switch";
import { catalogVersion } from "./computer/catalog-version";
@@ -222,7 +222,7 @@ export function toGeneration(r: Row): Generation {
prompt: r.prompt,
request,
// Held for the moderation service's check: nothing of it is shown until it passes.
- outputs: checking ? [] : (JSON.parse(r.outputs_json) as OutputFile[]),
+ outputs: checking ? [] : shownOutputs(JSON.parse(r.outputs_json) as OutputFile[], pool),
error: pool ? poolError(r.id, r.error, charged) : r.error,
costUsd: r.cost_usd,
favorite: !!r.favorite,
@@ -272,6 +272,33 @@ function livePreview(id: string): { preview: string } | Record<string, never> {
return at ? { preview: `/api/generations/${encodeURIComponent(id)}/preview?at=${at}` } : {};
}
+/**
+ * A row's outputs as its viewer reads them. On this install's GPUs, a finish step's own trouble (the server's words about
+ * the web copy of a 3D model) stays on the server: the owner reads it in the log, the account gets the model as it is.
+ */
+function shownOutputs(outputs: OutputFile[], pool: boolean): OutputFile[] {
+ if (!pool) return outputs;
+ return outputs.map((o) => {
+ const finish = o.meta?.finish;
+ if (!finish || typeof finish !== "object" || !("error" in finish)) return o;
+ const { error: _error, ...rest } = finish as Record<string, unknown>;
+ void _error;
+ return { ...o, meta: { ...o.meta, finish: rest } };
+ });
+}
+
+/**
+ * A row's failure as its viewer reads it, by its id: a run on this install's GPUs in the words its tile says (poolError:
+ * one plain sentence for anything technical), any other as it was stored. For pages that read a step's failure from the
+ * table itself (a Mixed Media render's frames).
+ */
+export function shownError(id: string, raw: string | null): string | null {
+ const r = db().prepare("SELECT request_json FROM generations WHERE id = ?").get(id) as { request_json: string } | undefined;
+ if (!r) return raw;
+ const stored = JSON.parse(r.request_json) as GenerationRequest;
+ return stored.place === "pool" ? poolError(id, raw, !!stored.hold && !!stored.charged) : raw;
+}
+
/** A pool row's words while it goes: in line, or working on it. */
function poolMessage(r: Pick<Row, "status" | "message">): string | null {
if (r.status === "queued") return POOL_WORDS.inLine;
@@ -313,6 +340,9 @@ const PLAIN_POOL_ERRORS = (() => {
m.filesFull,
RELAY_WORDS.stopped,
POOL_WORDS.failed,
+ // About the person's own files: what to change, so kept (the GPU couldn't read or finish with them).
+ FILE_TROUBLE_WORDS.crashed,
+ FILE_TROUBLE_WORDS.unreadable,
BLOCKED_CARD_MESSAGE,
NO_SUBJECT_MESSAGE,
WATERMARK_COPY.rejected,
@@ -1842,7 +1872,7 @@ export const OWN_GPU_ONLY = "Pick an open-source model to run it on your GPU.";
export const OPEN_ONLY_RUN = "Pick an open-source model to run this on your GPU.";
export const SWITCHED_OFF_RUN = "This account is closed, so its runs stopped.";
/** A run on this install's GPUs that waited past its limit (hosted runs). */
-export const POOL_WAITED = "The studio's GPUs were busy, so it didn't run. Not charged.";
+export const POOL_WAITED = "The GPUs were busy, so it didn't run. Not charged.";
/**
* Everything an account's work runs inside: as the account (tenant.ts: only its own files and runs), on its own ComfyUI
diff --git a/src/server/hosted-run.ts b/src/server/hosted-run.ts
index 6d6b3727..1ba1ad32 100644
--- a/src/server/hosted-run.ts
+++ b/src/server/hosted-run.ts
@@ -31,7 +31,7 @@ import { loadIndex } from "./gpu/index-file";
import { attemptLimitMs, MAX_ATTEMPTS, poolLane } from "./computer/pool";
import { poolFinishes3d } from "./computer/finish";
import { holdTiming } from "./queue-settings";
-import { HOSTED_GUEST_WORDS, HOSTED_WORDS, inputCounts, outputsWords, poolAllows, poolAllowsRun, poolAway, poolOnWorkers, poolReady, poolRunsProvider, poolTakes, poolTicketsReady, poolUploads, POOL_LANE, queueFacts, runFacts, runOnPool, workflowPicks } from "./hosted";
+import { hostedGuestWords, hostedWords, inputCounts, outputsWords, poolAllows, poolAllowsRun, poolAway, poolOnWorkers, poolReady, poolRunsProvider, poolTakes, poolTicketsReady, poolUploads, POOL_LANE, queueFacts, runFacts, runOnPool, workflowPicks } from "./hosted";
import { withRunStamp } from "./run-stamp";
import { hostedRunsOn } from "./hosted-switch";
import { checkRun, moderationConfigured } from "./moderation";
@@ -44,6 +44,8 @@ import { poolLimitRefusal } from "./pool-limits";
import { runAsTenant } from "./tenant";
import { needsGpu, ownSetupHere, poolCardRefuses, requestOwnSetup } from "./pool-own-setup";
import { ADD_KEY_HEADER } from "@/lib/your-keys";
+import { placeOf, type Place } from "@/lib/place-name";
+import { placeFor, placeOfAccount } from "./place-name";
export { poolCardRefuses };
@@ -122,7 +124,7 @@ export type PlaceDecision =
const OWN = { kind: "own" } as const;
/** What an account whose own GPU didn't answer is asked, when its run named no place (never moved and charged unasked). */
-export const OWN_GPU_QUIET = "Your GPU isn't answering right now. Run this on this studio's GPUs instead, or try again when your GPU is back.";
+export const ownGpuQuiet = (place: Place): string => `Your GPU isn't answering right now. Run this on ${place.text} instead, or wait for your GPU.`;
/**
* Run pressed while every GPU here that could run it is away (it was there when the price check before Run asked): no
@@ -148,9 +150,9 @@ const ownSetupRefusal = (setup: OwnSetup): { kind: "refuse"; refusal: Refusal }
});
/** A gate's refusal as the run's answer: its words, with the own setup that would run it. */
-function gateRefusal(gate: GateRefusal): { kind: "refuse"; refusal: Refusal } {
+function gateRefusal(gate: GateRefusal, place: Place): { kind: "refuse"; refusal: Refusal } {
if (gate.reason === "ownSetup") return ownSetupRefusal(gate.setup ?? needsGpu());
- const error = gateText(gate, false);
+ const error = gateText(gate, false, place);
// Not right now (the GPUs that could run it are being updated): refused as a busy moment, with Run off until then.
if (gate.reason === "busy") return { kind: "refuse", refusal: billingRefusal("busy", error) };
if (gate.reason === "model3d") return { kind: "refuse", refusal: { status: 403, body: { error, code: "own-gpu-tool" }, headers: {} } };
@@ -159,7 +161,8 @@ function gateRefusal(gate: GateRefusal): { kind: "refuse"; refusal: Refusal } {
return r;
}
-const askPlace = (): Refusal => ({ status: 409, body: { error: OWN_GPU_QUIET, code: "own-gpu-offline" }, headers: { [PLACE_ASK_HEADER]: "1" } });
+/** The question for a run whose own GPU didn't answer, with the place name its "Run on …" button says. */
+const askPlace = (place: Place): Refusal => ({ status: 409, body: { error: ownGpuQuiet(place), code: "own-gpu-offline", placeName: place.label }, headers: { [PLACE_ASK_HEADER]: "1" } });
/** Does the policy put runs on this install's GPUs first, before the account's own GPU? */
const prefersPool = (p: Policy | null | undefined): boolean => !!p?.hosted && p.prefer === "pool";
@@ -215,18 +218,19 @@ export function poolSteps(accountId: string, req: GenerationRequest): PlannedSte
* other steps would finish and their join would wait for nothing.
*/
export function stepsProblem(p: Policy, steps: PlannedStep[]): string | null {
+ const words = hostedWords(placeFor(p));
for (const s of steps) {
const own = s.provider === "comfyui" ? ownSetupHere(s.modelId, "open") : null;
if (own) return ownSetupLabel(own);
- if (!poolRunsProvider(s.provider)) return HOSTED_WORDS.notOffered;
- if (s.provider === "comfyui" && poolCardRefuses(s.modelId)) return HOSTED_WORDS.rtxCard;
+ if (!poolRunsProvider(s.provider)) return words.notOffered;
+ if (s.provider === "comfyui" && poolCardRefuses(s.modelId)) return words.rtxCard;
if (freeStep(s)) {
- if (s.provider === "comfyui" && !poolTakes(stepEndpoint(s))) return HOSTED_WORDS.notOffered;
+ if (s.provider === "comfyui" && !poolTakes(stepEndpoint(s))) return words.notOffered;
continue;
}
- if (s.provider !== "comfyui" || (s.kind === "model3d" && !poolFinishes3d(s))) return HOSTED_WORDS.notOffered;
- if (!poolAllows(p, s.modelId, s.presetId) || !kindAllowed(p, s.kind as RunFacts["kind"])) return HOSTED_WORDS.notOffered;
- if (!poolTakes(stepEndpoint(s))) return HOSTED_WORDS.notOffered;
+ if (s.provider !== "comfyui" || (s.kind === "model3d" && !poolFinishes3d(s))) return words.notOffered;
+ if (!poolAllows(p, s.modelId, s.presetId) || !kindAllowed(p, s.kind as RunFacts["kind"])) return words.notOffered;
+ if (!poolTakes(stepEndpoint(s))) return words.notOffered;
}
return null;
}
@@ -256,11 +260,13 @@ export function madeRunProblem(run: { policy: Policy; steps: RunFacts["steps"];
const made = stepsOf(ids);
const problem = stepsProblem(run.policy, made);
if (problem) return problem;
- if (run.light) return lightRun(made) ? null : HOSTED_WORDS.notOffered;
+ const place = placeFor(run.policy);
+ const words = hostedWords(place);
+ if (run.light) return lightRun(made) ? null : words.notOffered;
const cap = poolOutputsCap(run.policy);
- if (rowOutputs(ids).some((n) => n > cap)) return outputsWords(cap, false);
+ if (rowOutputs(ids).some((n) => n > cap)) return outputsWords(cap, false, place);
const held = new Map((run.steps ?? []).map((s) => [`${s.model} ${s.op ?? ""}`, s.jobs]));
- for (const s of pricedSteps(made)) if (s.jobs > (held.get(`${s.model} ${s.op ?? ""}`) ?? 0)) return HOSTED_WORDS.notOffered;
+ for (const s of pricedSteps(made)) if (s.jobs > (held.get(`${s.model} ${s.op ?? ""}`) ?? 0)) return words.notOffered;
return null;
}
@@ -316,14 +322,14 @@ export type GateReason = "model3d" | "notOffered" | "rtxCard" | "loras" | "input
export type GateRefusal = { ok: false; reason: GateReason; setup?: OwnSetup; cap?: number };
/** The words for a gate's reason: an account may connect its own GPU in Settings, a guest has nowhere to do that yet. */
-export function gateWords(reason: Exclude<GateReason, "ownSetup" | "outputs">, guest: boolean): string {
+export function gateWords(reason: Exclude<GateReason, "ownSetup" | "outputs">, guest: boolean, place: Place): string {
if (reason === "model3d") return OWN_GPU_TOOL_MESSAGE;
- return (guest ? HOSTED_GUEST_WORDS : HOSTED_WORDS)[reason];
+ return (guest ? hostedGuestWords() : hostedWords(place))[reason];
}
/** A gate's refusal in words: the own setup's label (the same for a guest and an account), or the reason's words. */
-export const gateText = (gate: GateRefusal, guest: boolean): string =>
- gate.reason === "ownSetup" ? ownSetupLabel(gate.setup ?? needsGpu()) : gate.reason === "outputs" ? outputsWords(gate.cap ?? 1, guest) : gateWords(gate.reason, guest);
+export const gateText = (gate: GateRefusal, guest: boolean, place: Place): string =>
+ gate.reason === "ownSetup" ? ownSetupLabel(gate.setup ?? needsGpu()) : gate.reason === "outputs" ? outputsWords(gate.cap ?? 1, guest, place) : gateWords(gate.reason, guest, place);
/**
* The one check of whether this install's GPUs take a run, shared by the run itself (decidePlace) and the price check
@@ -367,7 +373,7 @@ export function poolGate(
if (later) return { ok: false, reason: "ownSetup", setup: later };
}
const problem = steps && p ? stepsProblem(p, steps) : null;
- if (problem) return { ok: false, reason: problem === HOSTED_WORDS.rtxCard ? "rtxCard" : "notOffered", setup: gpu };
+ if (problem) return { ok: false, reason: problem === hostedWords(placeFor(p)).rtxCard ? "rtxCard" : "notOffered", setup: gpu };
// A run its GPUs could take, but none of them can right now (every one that could is built from the catalog before
// this studio's update): Run is off until one is updated, never a run that waits in line for nothing.
const endpoints = [planned.route.endpoint, ...(steps ?? []).filter((s) => s.provider === "comfyui").map(stepEndpoint)];
@@ -428,7 +434,7 @@ export async function decidePlace(account: Account, asked: GenerationRequest, wi
} catch (e) {
// A mode that runs on the visitor's own setup only: its own GPU when it has one, else refused in its label's words.
const own = refusedForOwnSetup(e, asked);
- if (own && !accountGpu(account.id)) return gateRefusal({ ok: false, reason: "ownSetup", setup: own });
+ if (own && !accountGpu(account.id)) return gateRefusal({ ok: false, reason: "ownSetup", setup: own }, placeOfAccount(account.id));
// A paid model, a model switched off, a request with something wrong: today's path says what.
return OWN;
}
@@ -450,7 +456,7 @@ export async function decidePlace(account: Account, asked: GenerationRequest, wi
if (p === undefined) p = await billingPolicy(account.id);
if (!p) return ownFallback ? OWN : { kind: "refuse", refusal: billingRefusal("paused", BILLING_WAIT.run) };
// Closed to this account: its own GPU (or today's "Connect your GPU"); asked for by name, said so.
- if (!p.hosted) return wish === "pool" ? notOffered(HOSTED_WORDS.notHosted) : OWN;
+ if (!p.hosted) return wish === "pool" ? notOffered(hostedWords(placeFor(p)).notHosted) : OWN;
// Planned, checked and priced for the outputs it would make there (the policy's cap per run).
const { req, capped } = poolRequest(asked, p);
if (capped) {
@@ -465,14 +471,14 @@ export async function decidePlace(account: Account, asked: GenerationRequest, wi
const gate = poolGate(p, planned, req, () => stepsFor(account, req));
if (!gate.ok) {
if (ownFallback) return OWN;
- return gateRefusal(gate);
+ return gateRefusal(gate, placeFor(p));
}
// Every GPU here that could run it is off for now (paused, silent, outside its hours): a run made now would only wait
// until its wait limit ended it. It goes to the account's own GPU as any run these GPUs can't take now, else it isn't
// made (awayRefusal).
if (runAway(planned, gate.steps)) return ownFallback ? OWN : { kind: "refuse", refusal: awayRefusal() };
// Its own GPU didn't answer the check: asked, never moved to this install's GPUs (and charged) without a word.
- if (ownOffline) return { kind: "refuse", refusal: askPlace() };
+ if (ownOffline) return { kind: "refuse", refusal: askPlace(placeFor(p)) };
return { kind: "pool", planned, policy: p, steps: gate.steps ? pricedSteps(gate.steps) : undefined, req, capped, light: lightRun(gate.steps) };
}
@@ -608,7 +614,7 @@ export interface PoolLine {
}
/** A price check's answer while every GPU that could run it is off for now: Run is off, and the wait is said. */
-const startingSoonQuote = (): Quote => ({ allowed: false, amount: 0, priceVersion: "", text: HOSTED_WORDS.startingSoon, code: "busy", etaS: null });
+const startingSoonQuote = (): Quote => ({ allowed: false, amount: 0, priceVersion: "", text: hostedWords(placeOf(null)).startingSoon, code: "busy", etaS: null });
/** A price check's answer for a run this install's GPUs won't take, in the words the run itself would get. */
/**
@@ -621,8 +627,8 @@ const notOfferedQuote = (text: string, setup?: OwnSetup): Quote & { ownSetup?: O
* A gate's refusal as the price check's quote (gateText: the label's words for an own setup). Busy (the GPUs that could
* run it are being updated) is quoted as code "busy", shown like the other busy moments with Run off.
*/
-const gateQuote = (gate: GateRefusal, guest: boolean): Quote & { ownSetup?: OwnSetup } =>
- gate.reason === "busy" ? { ...notOfferedQuote(gateText(gate, guest)), code: "busy" } : notOfferedQuote(gateText(gate, guest), gate.reason === "model3d" ? undefined : gate.setup);
+const gateQuote = (gate: GateRefusal, guest: boolean, place: Place): Quote & { ownSetup?: OwnSetup } =>
+ gate.reason === "busy" ? { ...notOfferedQuote(gateText(gate, guest, place)), code: "busy" } : notOfferedQuote(gateText(gate, guest, place), gate.reason === "model3d" ? undefined : gate.setup);
/**
* A price check on this install's GPUs (hosted runs on): the plan there, the billing service's quote (no service: free,
@@ -654,7 +660,7 @@ export async function poolQuote(
// A mode that runs on the visitor's own setup only, for a viewer with no GPU of its own: Run says its label and opens
// that setup (no plan to show: it never runs here).
const own = refusedForOwnSetup(e, req);
- if (own && !(account && accountGpu(account.id)) && !(p && !p.hosted)) return { planned: null, quote: gateQuote({ ok: false, reason: "ownSetup", setup: own }, !account), line: { place: 1, etaSeconds: null } };
+ if (own && !(account && accountGpu(account.id)) && !(p && !p.hosted)) return { planned: null, quote: gateQuote({ ok: false, reason: "ownSetup", setup: own }, !account, placeFor(p)), line: { place: 1, etaSeconds: null } };
return null;
}
if (planned.route.provider !== "comfyui") return null;
@@ -667,7 +673,7 @@ export async function poolQuote(
const gate = poolGate(p, planned, req, () => stepsFor(account, req));
if (!gate.ok) {
if (hasGpu && wish !== "pool") return null;
- return { planned, quote: gateQuote(gate, !account), line: line(queueFacts(account?.id ?? null, planned.route.endpoint)) };
+ return { planned, quote: gateQuote(gate, !account, placeFor(p)), line: line(queueFacts(account?.id ?? null, planned.route.endpoint)) };
}
// Every GPU here that could run it is off for now: Run is off and says it starts soon (the price check asks again by
// itself, and Run comes back on once one is back), never a run that would wait for nothing.
@@ -791,14 +797,14 @@ export async function decideToolPlace(account: Account, steps: ToolRunStep[], wi
}
if (p === undefined) p = await billingPolicy(account.id);
if (!p) return ownFallback ? OWN : { kind: "refuse", refusal: billingRefusal("paused", BILLING_WAIT.run) };
- if (!p.hosted) return wish === "pool" ? notOffered(HOSTED_WORDS.notHosted) : OWN;
+ if (!p.hosted) return wish === "pool" ? notOffered(hostedWords(placeFor(p)).notHosted) : OWN;
const gate = toolGate(p, account.id, steps);
if (gate === "unplanned") return OWN;
if (!gate.ok) {
if (ownFallback) return OWN;
- return gateRefusal(gate);
+ return gateRefusal(gate, placeFor(p));
}
- if (ownOffline) return { kind: "refuse", refusal: askPlace() };
+ if (ownOffline) return { kind: "refuse", refusal: askPlace(placeFor(p)) };
return { kind: "pool", policy: p, main: gate.main, steps: pricedSteps(gate.rows), light: lightRun(gate.rows) };
}
@@ -826,7 +832,7 @@ export async function toolPoolQuote(
};
if (!gate.ok) {
if (hasGpu && wish !== "pool") return null;
- return { quote: gateQuote(gate, !account), line: lineOf(undefined) };
+ return { quote: gateQuote(gate, !account, placeFor(p)), line: lineOf(undefined) };
}
const endpoint = gate.main.planned.route.endpoint;
if (lightRun(gate.rows)) return { quote: FREE_QUOTE, line: lineOf(endpoint) };
diff --git a/src/server/hosted.ts b/src/server/hosted.ts
index cd98643a..57935278 100644
--- a/src/server/hosted.ts
+++ b/src/server/hosted.ts
@@ -4,6 +4,7 @@ import { computeDimensions, fitCanvas } from "@/lib/comfy";
import { h3Canvas, isH3Graph } from "@/lib/h3-prompt";
import { imageSize } from "@/lib/image-size";
import type { GenerationRequest } from "@/lib/catalog/types";
+import { placeOf, type Place } from "@/lib/place-name";
import { billingConfigured, type Policy, type QueueFacts, type RunFacts } from "./billing";
import { lineFacts, poolLane, queueOfGeneration, workersAway, workersCanRun } from "./computer/pool";
import { db } from "./db";
@@ -141,36 +142,45 @@ export function runOnPool<T>(accountId: string | null, fn: () => T): T {
return accountId ? runAsTenant({ kind: "account", id: accountId }, inside) : runAsTenant({ kind: "guest" }, inside);
}
-/** Words for runs on this install's GPUs (generic: they fit any install). */
-export const HOSTED_WORDS = {
- notOffered: "This one runs on your own GPU. Connect one in Settings, or pick another model.",
- loras: "Extra LoRAs run on your own GPU. Connect one in Settings, or run without them.",
- inputs: "This kind of file runs on your own GPU. Connect one in Settings, or use a picture.",
- rtxCard: "This one needs an NVIDIA RTX card, and this studio's GPUs can't run it right now. Connect your own GPU in Settings, or pick another choice.",
- notHosted: "Runs on this studio's GPUs aren't open to this account. Connect your own GPU in Settings.",
- waitedTooLong: "This studio's GPUs were busy, so it didn't run. Not charged.",
- busy: "Busy right now. Try again in a little while.",
- /** Every GPU that could run it is off for now: Run opens again by itself once one is back. */
- startingSoon: "Starting soon",
-};
-
-/** The same refusals for a guest, who has no Settings to connect a GPU in yet. */
-export const HOSTED_GUEST_WORDS = {
- busy: HOSTED_WORDS.busy,
- notOffered: "This one isn't offered here. Pick another model.",
- rtxCard: "This one isn't offered here right now. Pick another choice.",
- loras: "Extra LoRAs aren't offered here. Run without them.",
- inputs: "This kind of file can't be used here. Use a picture instead.",
-};
+/**
+ * Words for runs on this install's GPUs, with the name visitors read for them (`place`, src/server/place-name.ts). Every
+ * sentence fits any name: no verb agrees with it.
+ */
+export function hostedWords(place: Place) {
+ return {
+ notOffered: "This one runs on your own GPU. Connect one in Settings, or pick another model.",
+ loras: "Extra LoRAs run on your own GPU. Connect one in Settings, or run without them.",
+ inputs: "This kind of file runs on your own GPU. Connect one in Settings, or use a picture.",
+ rtxCard: "This one needs an NVIDIA RTX card. Connect your own RTX GPU in Settings, or pick another choice.",
+ notHosted: `Your account can't run on ${place.text} right now. Your own GPU or key still works.`,
+ busy: "Busy right now. Try again in a little while.",
+ /** Every GPU that could run it is off for now: Run opens again by itself once one is back. */
+ startingSoon: "Starting soon",
+ };
+}
+
+/** The reasons a run on this install's GPUs is refused, by name (the same for every place name). */
+export type HostedReason = keyof ReturnType<typeof hostedWords>;
+
+/** The same refusals for a guest, who has no Settings to connect a GPU in yet (no place name in them). */
+export function hostedGuestWords() {
+ return {
+ busy: hostedWords(placeOf(null)).busy,
+ notOffered: "This one isn't offered here. Pick another model.",
+ rtxCard: "This one isn't offered here right now. Pick another choice.",
+ loras: "Extra LoRAs aren't offered here. Run without them.",
+ inputs: "This kind of file can't be used here. Use a picture instead.",
+ };
+}
/**
* A tool's run that asks for more pictures or clips at once than a run on this install's GPUs makes (the policy's cap per
* run): pick fewer. An account may also connect its own GPU, which has no such cap.
*/
-export function outputsWords(cap: number, guest: boolean): string {
+export function outputsWords(cap: number, guest: boolean, place: Place): string {
const most = cap === 1 ? "one at a time" : `up to ${cap} at a time`;
const pick = cap === 1 ? "Pick one" : `Pick ${cap} or fewer`;
- return guest ? `Runs here make ${most}. ${pick}.` : `This studio's GPUs make ${most}. ${pick}, or connect your own GPU in Settings.`;
+ return guest ? `Makes ${most}. ${pick}.` : `Makes ${most} on ${place.text}. ${pick}, or connect your own GPU in Settings.`;
}
/** May this model (and app) run on this install's GPUs under this policy? */
diff --git a/src/server/mixed-media.ts b/src/server/mixed-media.ts
index 62ade55f..240b7e41 100644
--- a/src/server/mixed-media.ts
+++ b/src/server/mixed-media.ts
@@ -33,7 +33,7 @@ import type { Engine, Generation, GenerationRequest, ProviderId } from "@/lib/ca
import { generationAccount } from "./account-library";
import { createPipeline } from "./chains";
import { db } from "./db";
-import { ConnectComfyError, DROPPED_UNUSED, getGeneration, previewChained, unfilledRequest, waitedOnFailure } from "./generations";
+import { ConnectComfyError, DROPPED_UNUSED, getGeneration, previewChained, shownError, unfilledRequest, waitedOnFailure } from "./generations";
import { withoutMissingOnComfy, withoutUnreachableCivitai } from "./loras";
import { comfyLoraFiles, probeComfy } from "./providers/comfyui";
import { engineMode, getSetting } from "./settings";
@@ -426,7 +426,8 @@ export function framesProgress(finalId: string): FramesProgress | null {
};
const first = (list: StepRow[]) => list.map((r) => ({ r, step: at(r) })).sort((a, b) => (a.step?.index ?? 0) - (b.step?.index ?? 0))[0];
const bad = first(own) ?? first(stopped);
- if (bad) out.failed = { label: bad.step?.label ?? "A frame", error: bad.r.status === "canceled" ? "Canceled" : (bad.r.error ?? "Something went wrong") };
+ // A frame's failure in the words its tile would say (on this install's GPUs: one plain sentence, never the GPU's own).
+ if (bad) out.failed = { label: bad.step?.label ?? "A frame", error: bad.r.status === "canceled" ? "Canceled" : (shownError(bad.r.id, bad.r.error) ?? "Something went wrong") };
return out;
}
diff --git a/src/server/output-checks.ts b/src/server/output-checks.ts
index 4592ea0e..094e55ff 100644
--- a/src/server/output-checks.ts
+++ b/src/server/output-checks.ts
@@ -18,6 +18,8 @@ import { absolutePath, deleteAsset, getAsset } from "./storage";
*/
export const HIDDEN_WORDS = "This result was removed by the studio's checks. Not charged.";
+/** The same on a run on this install's GPUs ("Not charged." stays only where something was set aside: poolError). */
+export const SITE_HIDDEN_WORDS = "This result didn't pass the safety check, so it was removed. Not charged.";
export const UNCHECKED_WORDS = "This result couldn't be checked in time, so it was removed. Not charged.";
export const CHECKING_WORDS = "Checking";
@@ -65,12 +67,12 @@ function settleRuns(now: number): void {
const d = db();
const runs = d
.prepare(
- `SELECT g.id, g.outputs_json, g.status FROM generations g
+ `SELECT g.id, g.outputs_json, g.status, json_extract(g.request_json, '$.place') AS place FROM generations g
WHERE g.stage = 'checking' AND (
NOT EXISTS (SELECT 1 FROM output_checks c WHERE c.generation_id = g.id AND c.state = 'waiting')
OR EXISTS (SELECT 1 FROM output_checks c WHERE c.generation_id = g.id AND c.state = 'hidden'))`,
)
- .all() as { id: string; outputs_json: string; status: string }[];
+ .all() as { id: string; outputs_json: string; status: string; place: string | null }[];
for (const r of runs) {
const states = d.prepare("SELECT asset_id, state, text FROM output_checks WHERE generation_id = ?").all(r.id) as { asset_id: string; state: string; text: string | null }[];
const hidden = states.filter((s) => s.state === "hidden");
@@ -83,7 +85,7 @@ function settleRuns(now: number): void {
if (hidden.length || unchecked) {
// Hidden or never checked: every held file of the run goes, and the row fails.
for (const s of states) if (s.state !== "hidden") removeHeld(s.asset_id);
- const words = hidden.length ? hidden.find((h) => h.text)?.text || HIDDEN_WORDS : UNCHECKED_WORDS;
+ const words = hidden.length ? hidden.find((h) => h.text)?.text || (r.place === "pool" ? SITE_HIDDEN_WORDS : HIDDEN_WORDS) : UNCHECKED_WORDS;
d.prepare("UPDATE output_checks SET state = CASE WHEN state = 'waiting' THEN 'unchecked' ELSE state END, decided_at = COALESCE(decided_at, ?) WHERE generation_id = ?").run(now, r.id);
d.prepare("UPDATE generations SET status = 'failed', stage = NULL, error = ?, message = NULL, outputs_json = '[]', completed_at = ?, updated_at = ? WHERE id = ?").run(words, now, now, r.id);
continue;
diff --git a/src/server/place-name.ts b/src/server/place-name.ts
new file mode 100644
index 00000000..2a6f37d9
--- /dev/null
+++ b/src/server/place-name.ts
@@ -0,0 +1,21 @@
+import "server-only";
+import { cleanPlaceName, PLACE_NAME_DEFAULT, placeOf, type Place } from "@/lib/place-name";
+import { cachedPolicy, type Policy } from "./billing";
+import { getSetting } from "./settings";
+
+/**
+ * The name visitors read for this install's GPUs (src/lib/place-name.ts), first match wins:
+ * 1. the billing service's policy (`placeName`, its "place name" switch);
+ * 2. the install's own setting (Settings → Workers → Name for your GPUs), else FUOBE_PLACE_NAME;
+ * 3. PLACE_NAME_DEFAULT ("Our GPUs").
+ * Each is kept at most PLACE_NAME_MAX characters. Only words shown while hosted runs are on use it.
+ */
+export function placeName(p?: Pick<Policy, "placeName"> | null): string {
+ return cleanPlaceName(p?.placeName) ?? cleanPlaceName(getSetting("hostedPlaceName")) ?? PLACE_NAME_DEFAULT;
+}
+
+/** The place under this policy (none: the install's own name, else the default). */
+export const placeFor = (p?: Pick<Policy, "placeName"> | null): Place => placeOf(placeName(p));
+
+/** The place for an account (null: a guest) under its policy as last read, with no call to the billing service. */
+export const placeOfAccount = (accountId: string | null): Place => placeFor(cachedPolicy(accountId));
diff --git a/src/server/settings.ts b/src/server/settings.ts
index dbbf8345..f2856314 100644
--- a/src/server/settings.ts
+++ b/src/server/settings.ts
@@ -1,5 +1,6 @@
import "server-only";
import { AsyncLocalStorage } from "node:async_hooks";
+import { PLACE_NAME_MAX } from "@/lib/place-name";
import { db } from "./db";
/**
@@ -80,6 +81,11 @@ export const SETTINGS = {
* through the owner's own Fuobe tab (a studio on a server, a ComfyUI at home: src/server/computer).
*/
comfyWhere: { key: "comfyui.where", env: "COMFYUI_WHERE", default: "server", options: ["server", "computer", "workers"] },
+ /**
+ * The name visitors read for this install's GPUs while hosted runs are on ("Runs on Ana's render box"): Settings →
+ * Workers. A billing service's own name for them wins (src/server/place-name.ts); empty: "Our GPUs".
+ */
+ hostedPlaceName: { key: "hosted.placeName", env: "FUOBE_PLACE_NAME" },
/**
* ComfyUI's models/loras folder, when it's on this machine: trained LoRAs are copied there, and a recipe's
* LoRAs (looks, motions) are downloaded there before a run needs them (src/server/loras.ts).
@@ -221,6 +227,10 @@ export function validateSetting(name: SettingName, value: string, from: "api" |
if (name === "qwenWorkspace" && value !== "" && !/^[a-z0-9-]{1,64}$/.test(value)) {
throw new Error("qwenWorkspace must be the workspace id from Model Studio (lowercase letters, digits and hyphens)");
}
+ // A name visitors read in sentences: one line of at most PLACE_NAME_MAX characters.
+ if (name === "hostedPlaceName" && value !== "" && (Array.from(value.trim()).length > PLACE_NAME_MAX || /[\u0000-\u001f\u007f-\u009f]/.test(value))) {
+ throw new Error(`hostedPlaceName must be one line of at most ${PLACE_NAME_MAX} characters`);
+ }
if (name === "smartPlan" && value !== "" && value !== "auto" && !/^[a-z0-9-]{2,32}\|[\w.:/@+-]{1,200}$/.test(value)) {
throw new Error("smartPlan must be auto, or a provider and model as provider|model");
}
diff --git a/tests/again-where.test.ts b/tests/again-where.test.ts
index cca7cff0..9e769047 100644
--- a/tests/again-where.test.ts
+++ b/tests/again-where.test.ts
@@ -3,14 +3,16 @@ import { againKeys, katanaSteps, type KatanaJobView } from "@/lib/av/katana";
import type { Generation } from "@/lib/catalog/types";
import { againPrice, againWhere, paidSuffix } from "@/lib/demo-mode";
import { draftRenderPaid } from "@/lib/output-actions";
+import { placeOf } from "@/lib/place-name";
describe("a one-tap Run again says what it spends", () => {
const off = { placeholders: false };
const on = { placeholders: true };
- it("on your GPU, on the studio's GPUs, paid in the cloud", () => {
+ it("on your GPU, on this studio's GPUs by their place name, paid in the cloud", () => {
expect(againWhere({ engine: "open" }, off)).toBe(" on your GPU");
- expect(againWhere({ engine: "open", place: "pool" }, off)).toBe(" on the studio's GPUs");
+ expect(againWhere({ engine: "open", place: "pool" }, off)).toBe(" on our GPUs");
+ expect(againWhere({ engine: "open", place: "pool" }, { ...off, place: placeOf("Ana's render box") })).toBe(" on Ana's render box");
expect(againWhere({ engine: "cloud" }, off)).toBe(" · paid");
});
@@ -23,7 +25,7 @@ describe("a one-tap Run again says what it spends", () => {
expect(againWhere({ engine: "cloud" }, off, 0)).toBe(" · paid");
// A price never shows on your GPU, on a studio's GPUs, or while placeholders are on.
expect(againWhere({ engine: "open" }, off, 0.42)).toBe(" on your GPU");
- expect(againWhere({ engine: "cloud", place: "pool" }, off, 0.42)).toBe(" on the studio's GPUs");
+ expect(againWhere({ engine: "cloud", place: "pool" }, off, 0.42)).toBe(" on our GPUs");
expect(againWhere({ engine: "cloud" }, on, 0.42)).toBe("");
expect(paidSuffix(undefined)).toBe(" · paid");
expect(paidSuffix(0.04)).toBe(" · ≈ $0.04");
diff --git a/tests/helpers/run-watch.ts b/tests/helpers/run-watch.ts
index 4641f812..1eb24665 100644
--- a/tests/helpers/run-watch.ts
+++ b/tests/helpers/run-watch.ts
@@ -114,13 +114,14 @@ export class RunWatch {
}
/**
- * A run that truly can't finish: one plain sentence, nothing about the machines, and "Not charged" only when its hold
- * set something aside (`charged`). A free run says nothing about a charge.
+ * A run that truly can't finish: one plain sentence (`words`: the failure sentence, or one about the person's own files),
+ * nothing about the machines, and "Not charged" only when its hold set something aside (`charged`). A free run says
+ * nothing about a charge.
*/
-export function plainFailure(g: RunLike, o: { charged: boolean }): string[] {
+export function plainFailure(g: RunLike, o: { charged: boolean; words?: string }): string[] {
const out: string[] = [];
if (g.status !== "failed") out.push(`it is ${g.status}, not failed`);
- if (g.error !== POOL_WORDS.failed) out.push(`its words are ${JSON.stringify(g.error)}`);
+ if (g.error !== (o.words ?? POOL_WORDS.failed)) out.push(`its words are ${JSON.stringify(g.error)}`);
if (g.fix) out.push("it offers a fix");
if (o.charged && !g.notCharged) out.push("it doesn't say Not charged");
if (!o.charged && g.notCharged) out.push("it says Not charged, but nothing was set aside");
diff --git a/tests/hosted-app-runs.test.ts b/tests/hosted-app-runs.test.ts
index c5377eba..a6783717 100644
--- a/tests/hosted-app-runs.test.ts
+++ b/tests/hosted-app-runs.test.ts
@@ -40,7 +40,8 @@ const { db } = await import("@/server/db");
const { resetRates } = await import("@/server/rate");
const billing = await import("@/server/billing");
const { clearAccountLoras } = await import("@/server/account-loras");
-const { HOSTED_WORDS } = await import("@/server/hosted");
+const { hostedWords } = await import("@/server/hosted");
+const HOSTED_WORDS = hostedWords((await import("@/lib/place-name")).placeOf(null));
const { OWN_GPU_TOOL_MESSAGE } = await import("@/lib/guest-access");
let fake: FakeBilling;
diff --git a/tests/hosted-price-check.test.ts b/tests/hosted-price-check.test.ts
index fc1e40f5..ebc6960f 100644
--- a/tests/hosted-price-check.test.ts
+++ b/tests/hosted-price-check.test.ts
@@ -34,7 +34,8 @@ const { POOL_WORDS } = await import("@/lib/relay");
const { db } = await import("@/server/db");
const { resetRates } = await import("@/server/rate");
const billing = await import("@/server/billing");
-const { HOSTED_WORDS } = await import("@/server/hosted");
+const { hostedWords } = await import("@/server/hosted");
+const HOSTED_WORDS = hostedWords((await import("@/lib/place-name")).placeOf(null));
const { POOL_LIMIT_WORDS } = await import("@/server/pool-limits");
let fake: FakeBilling;
diff --git a/tests/hosted-run-button.test.ts b/tests/hosted-run-button.test.ts
index c5c92fb6..e2c906f5 100644
--- a/tests/hosted-run-button.test.ts
+++ b/tests/hosted-run-button.test.ts
@@ -65,7 +65,7 @@ describe("Run before it is pressed (the price check's answer)", () => {
expect(ok).toEqual({ text: "Free", wait: "Next in line · about 40 s" });
const on = runPlace({ audience: "account", engine: "open", hosted: true, models: ["Qwen Image"], pool: ok, format: String });
expect(on.refused).toBeUndefined();
- expect(on.tip).toBe("Runs on this studio's GPUs with Qwen Image. Next in line · about 40 s.");
+ expect(on.tip).toBe("Runs on our GPUs with Qwen Image. Next in line · about 40 s.");
});
it("the line under the toolbar: the wait before Run, or the refusal's words with its link and offer", () => {
const wait = render(createElement(PoolNote, { state: { refused: false, text: "Free", wait: "Next in line · about 40 s" } }));
diff --git a/tests/hosted-surface-runs.test.ts b/tests/hosted-surface-runs.test.ts
index c8129fec..40a579f1 100644
--- a/tests/hosted-surface-runs.test.ts
+++ b/tests/hosted-surface-runs.test.ts
@@ -3,6 +3,7 @@ import fs from "node:fs";
import http from "node:http";
import path from "node:path";
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { placeOf } from "@/lib/place-name";
import { NextRequest } from "next/server";
import { listenOnFreePort, startFakeBilling, type FakeBilling } from "./helpers/fake-billing";
import { startFakeComfy, TINY_PNG, type FakeComfy } from "./helpers/fake-comfy-runner";
@@ -229,7 +230,7 @@ describe("Cinema Studio for an account with no GPU of its own", () => {
fake.policy = { ...fake.policy, limits: { ...(fake.policy.limits as object), outputsPerRun: 1 } };
const id = await project("none");
const four = { ...STILL, batch: 4 };
- const words = hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false);
+ const words = hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false, placeOf(null));
const check = await generateRoute.POST(json(`/api/cinema/projects/${id}/generate?preview=1`, "POST", { input: four }, "none"), params({ id }));
expect(check.status, await check.clone().text()).toBe(200);
expect(((await check.json()) as { quote?: { allowed: boolean; text: string } }).quote).toMatchObject({ allowed: false, text: words });
diff --git a/tests/hosted-tool-runs.test.ts b/tests/hosted-tool-runs.test.ts
index 854eea4f..59337428 100644
--- a/tests/hosted-tool-runs.test.ts
+++ b/tests/hosted-tool-runs.test.ts
@@ -1,5 +1,6 @@
import http from "node:http";
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
+import { placeOf } from "@/lib/place-name";
import { NextRequest } from "next/server";
import { listenOnFreePort, startFakeBilling, type FakeBilling } from "./helpers/fake-billing";
import { startFakeComfy, TINY_PNG, type FakeComfy } from "./helpers/fake-comfy-runner";
@@ -259,7 +260,7 @@ describe("hosted runs on", () => {
start: () => createGenerations({ ...plan[0].request, params: { numOutputs: 2 } }),
});
expect(r.ok).toBe(false);
- if (!r.ok) expect(((await r.response.json()) as { error: string }).error).toBe(hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false));
+ if (!r.ok) expect(((await r.response.json()) as { error: string }).error).toBe(hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false, placeOf(null)));
expect(stored("none").length).toBe(rows);
await drainOutbox();
expect([...fake.holds.values()].at(-1)?.released).toBe(true);
@@ -288,7 +289,7 @@ describe("hosted runs on", () => {
useBilling();
fake.policy = { ...fake.policy, limits: { ...(fake.policy.limits as object), outputsPerRun: 1 } };
const steps = [{ request: { feature: "image", modelId: "oss-z-image-turbo", prompt: "a fox", params: { numOutputs: 4 } } }];
- const words = hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false);
+ const words = hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, false, placeOf(null));
const quotes = fake.calls_of("/v1/quote").length;
const check = await toolRun.toolPriceCheck(json("/api/x?preview=1", "POST", {}, "none"), () => steps);
expect(check?.quote).toMatchObject({ allowed: false, code: "not-offered", text: words });
@@ -297,7 +298,7 @@ describe("hosted runs on", () => {
expect(place.kind).toBe("refuse");
if (place.kind === "refuse") expect(place.refusal.body).toMatchObject({ error: words, code: "not-offered" });
// A guest's words name nothing it can't do yet; an account whose own GPU answers runs it there.
- expect(hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, true)).not.toMatch(/Settings/);
+ expect(hostedRun.gateText({ ok: false, reason: "outputs", cap: 1 }, true, placeOf(null))).not.toMatch(/Settings/);
expect(await toolRun.placeOf(auth.accountById(ids.gpu)!, steps)).toEqual({ kind: "own" });
});
diff --git a/tests/hosted-video-audio-tools.test.ts b/tests/hosted-video-audio-tools.test.ts
index e4cfc8d9..3404705c 100644
--- a/tests/hosted-video-audio-tools.test.ts
+++ b/tests/hosted-video-audio-tools.test.ts
@@ -56,7 +56,8 @@ const { db } = await import("@/server/db");
const { resetRates } = await import("@/server/rate");
const billing = await import("@/server/billing");
const { clearAccountLoras } = await import("@/server/account-loras");
-const { HOSTED_WORDS } = await import("@/server/hosted");
+const { hostedWords } = await import("@/server/hosted");
+const HOSTED_WORDS = hostedWords((await import("@/lib/place-name")).placeOf(null));
const CLIP = fs.readFileSync(path.join(__dirname, "fixtures/shorts-12s.mp4"));
const src = { duration: 12, fps: 16, width: 72, height: 128, hasAudio: true };
diff --git a/tests/hosted-words.test.ts b/tests/hosted-words.test.ts
new file mode 100644
index 00000000..36f69dd1
--- /dev/null
+++ b/tests/hosted-words.test.ts
@@ -0,0 +1,231 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { createElement, type ReactNode } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { StatusInfo, ViewerInfo } from "@/lib/api";
+import type { Generation } from "@/lib/catalog/types";
+
+/*
+ * What a guest or an account reads about runs on this install's GPUs (hosted runs on) says them by their place name and
+ * in plain words: never "this studio's GPUs", never the machinery (worker, lane, ticket, pool, hosted, queue, catalog),
+ * never "Press Retry" where the line retries by itself, never ComfyUI (it isn't theirs), and no verb that has to agree
+ * with the name. Scanned over the server's word tables, the place chip's words, the engine tips, Run again, and the
+ * rendered home steps, tiles, Library card and Settings → Your keys.
+ */
+
+const state = vi.hoisted(() => ({
+ hydrated: true,
+ viewer: undefined as ViewerInfo | undefined,
+ status: undefined as StatusInfo | undefined,
+}));
+
+vi.mock("next/navigation", () => ({
+ useRouter: () => ({ prefetch: () => {}, push: () => {}, replace: () => {}, back: () => {}, refresh: () => {} }),
+ usePathname: () => "/image",
+ useSearchParams: () => new URLSearchParams(),
+}));
+vi.mock("@/lib/api", async (load) => ({
+ ...(await load<typeof import("@/lib/api")>()),
+ useHydrated: () => state.hydrated,
+ useViewer: () => ({ data: state.viewer }),
+ useStatus: () => ({ data: state.status }),
+ useEngineMode: () => "both",
+}));
+
+const { hostedGuestWords, hostedWords, outputsWords } = await import("@/server/hosted");
+const { gateText, ownGpuQuiet } = await import("@/server/hosted-run");
+const { needsGpu } = await import("@/server/pool-own-setup");
+const { SITE_HIDDEN_WORDS } = await import("@/server/output-checks");
+const { SITE_FAILED_WORDS } = await import("@/lib/comfy-compose");
+const { FILE_TROUBLE_WORDS, POOL_WORDS } = await import("@/lib/relay");
+const { notePlaceName, placeOf } = await import("@/lib/place-name");
+const { runPlace } = await import("@/lib/run-place");
+const { accountEngine } = await import("@/lib/your-keys");
+const { againWhere } = await import("@/lib/demo-mode");
+const { PendingTile, FailedTile, Feed } = await import("@/components/studio/feed");
+const { listStatus, StatusCover } = await import("@/components/library/asset-card");
+const { StartSteps } = await import("@/components/home/home-islands");
+const { AccountKeysSection, KeyInstead } = await import("@/components/keys/your-keys");
+const { EngineSwitch, engineTip } = await import("@/components/studio/engine-switch");
+const { TooltipProvider } = await import("@/components/ui/tooltip");
+
+/** Words no visitor reads about runs on this install's GPUs (acceptance check A11). */
+const FORBIDDEN = /studio's GPUs|\bworkers?\b|\blanes?\b|\btickets?\b|\bpool\b|\bhosted\b|\bqueue|\bcatalog|Press Retry|Try again later|isn't available here|Not available here|not checked|unverified|ComfyUI/i;
+
+const NAMED = placeOf("Studio North GPUs");
+const DEFAULT = placeOf(null);
+
+/** The words in a page's markup, without its tags and attributes. */
+const textOf = (html: string) => html.replace(/<[^>]+>/g, " ").replace(/&#x27;/g, "'").replace(/&amp;/g, "&").replace(/\s+/g, " ").trim();
+
+const render = (node: ReactNode) => renderToStaticMarkup(createElement(QueryClientProvider, { client: new QueryClient() }, createElement(TooltipProvider, null, node)));
+
+const gen = (o: Partial<Generation> = {}): Generation =>
+ ({
+ id: "g1",
+ batchId: null,
+ feature: "image",
+ presetId: null,
+ modelId: "oss-z-image-turbo",
+ engine: "open",
+ provider: "comfyui",
+ op: "t2i",
+ kind: "image",
+ status: "queued",
+ progress: null,
+ message: null,
+ prompt: "a fox in the snow",
+ request: { feature: "image", modelId: "oss-z-image-turbo", prompt: "a fox in the snow" },
+ outputs: [],
+ error: null,
+ costUsd: null,
+ favorite: false,
+ createdAt: Date.now() - 60_000,
+ updatedAt: Date.now(),
+ completedAt: null,
+ place: "pool",
+ ...o,
+ }) as Generation;
+
+const accountViewer: ViewerInfo = { signedIn: true, owner: false, publicSignup: true, account: { email: "[email protected]" } };
+const guestViewer: ViewerInfo = { signedIn: false, owner: false, publicSignup: true };
+function hostedStatus(v: Partial<NonNullable<StatusInfo["viewer"]>> = {}): StatusInfo {
+ return {
+ providers: { comfyui: { label: "Your GPU", configured: true } },
+ demoMode: "off",
+ engineMode: "both",
+ cloudProvider: "auto",
+ onboarded: true,
+ viewer: { kind: "account", gpu: { connected: false }, keys: [], paidAllowed: true, hosted: true, placeName: NAMED.label, ...v },
+ } as StatusInfo;
+}
+
+beforeEach(() => {
+ state.hydrated = true;
+ state.viewer = accountViewer;
+ state.status = hostedStatus();
+});
+afterEach(() => notePlaceName(null));
+
+/** Every sentence a visitor reads from the server's word tables, for a place. */
+function serverWords(place: ReturnType<typeof placeOf>): string[] {
+ const reasons = ["notOffered", "rtxCard", "loras", "inputs", "busy"] as const;
+ return [
+ ...Object.values(hostedWords(place)),
+ ...Object.values(hostedGuestWords()),
+ ...[1, 3].flatMap((cap) => [outputsWords(cap, false, place), outputsWords(cap, true, place)]),
+ ...reasons.flatMap((reason) => [gateText({ ok: false, reason }, false, place), gateText({ ok: false, reason }, true, place)]),
+ gateText({ ok: false, reason: "ownSetup", setup: needsGpu() }, false, place),
+ gateText({ ok: false, reason: "outputs", cap: 2 }, false, place),
+ ownGpuQuiet(place),
+ ...Object.values(POOL_WORDS),
+ ...Object.values(FILE_TROUBLE_WORDS),
+ SITE_HIDDEN_WORDS,
+ SITE_FAILED_WORDS,
+ ];
+}
+
+/** Every word the place chip says for runs there, for a guest and an account, priced, free, waiting and refused. */
+function chipWords(place: ReturnType<typeof placeOf>): string[] {
+ const out: string[] = [];
+ for (const audience of ["account", "guest"] as const)
+ for (const pool of [undefined, { text: "" }, { text: "1 generation", wait: "Next in line · about 40 s" }, { text: "You have 2 runs going.", refused: true }])
+ for (const p of [runPlace({ audience, engine: "open", hosted: true, models: ["Z-Image Turbo"], pool, place, format: String })]) out.push(p.label, p.price, p.title, p.tip, p.send);
+ return out.filter(Boolean);
+}
+
+describe("the words for runs on this install's GPUs", () => {
+ it("never name the machinery, this studio's GPUs or ComfyUI, and never ask for Retry", () => {
+ for (const place of [DEFAULT, NAMED]) {
+ const words = [
+ ...serverWords(place),
+ ...chipWords(place),
+ againWhere({ engine: "open", place: "pool" }, { placeholders: false, place }),
+ ...(["queued", "running", "failed", "canceled"] as const).map((status) => listStatus({ status, place: "pool" })),
+ ];
+ for (const w of words) expect(w, w).not.toMatch(FORBIDDEN);
+ }
+ });
+
+ it("say the place by its name, as a label and inside a sentence, with no verb that agrees with it", () => {
+ expect(hostedWords(NAMED).notHosted).toBe("Your account can't run on Studio North GPUs right now. Your own GPU or key still works.");
+ expect(hostedWords(DEFAULT).notHosted).toBe("Your account can't run on our GPUs right now. Your own GPU or key still works.");
+ expect(outputsWords(3, false, NAMED)).toBe("Makes up to 3 at a time on Studio North GPUs. Pick 3 or fewer, or connect your own GPU in Settings.");
+ expect(outputsWords(1, true, NAMED)).toBe("Makes one at a time. Pick one.");
+ expect(runPlace({ audience: "account", engine: "open", hosted: true, pool: { text: "" }, place: NAMED, format: String })).toMatchObject({ label: "Studio North GPUs", title: "Runs on Studio North GPUs" });
+ const agrees = new RegExp(`(Studio North GPUs|our GPUs|Our GPUs)\\s+(is|are|was|were|make|makes|run|runs|has|have)\\b`);
+ for (const w of [...serverWords(NAMED), ...serverWords(DEFAULT), ...chipWords(NAMED), ...chipWords(DEFAULT)]) expect(w, w).not.toMatch(agrees);
+ });
+
+ it("one sentence for a run that can't be made, the same in the planner and the tile", () => {
+ expect(POOL_WORDS.failed).toBe("Sorry, this one couldn't be made.");
+ expect(SITE_FAILED_WORDS).toBe(POOL_WORDS.failed);
+ expect(SITE_HIDDEN_WORDS).toBe("This result didn't pass the safety check, so it was removed. Not charged.");
+ });
+
+ it("the engine tips say runs are free on the place, a GPU of one's own optional", () => {
+ const tips = [hostedStatus(), hostedStatus({ keys: ["fal"] }), hostedStatus({ keys: ["fal"], gpu: { connected: true, mode: "link", online: true } }), hostedStatus({ paidAllowed: false })].map((s) => accountEngine(s));
+ expect(tips[0]).toMatchObject({ locked: { tip: "Free on Studio North GPUs. Add a fal.ai or Replicate key to use paid models." } });
+ expect(tips[1]).toMatchObject({ tips: { open: "Open models, free on Studio North GPUs" } });
+ expect(tips[2]).toMatchObject({ tips: { open: "Open models, free on Studio North GPUs or your GPU" } });
+ expect(tips[3]).toMatchObject({ locked: { tip: "Free on Studio North GPUs." } });
+ for (const t of tips) expect(JSON.stringify(t)).not.toMatch(FORBIDDEN);
+ });
+});
+
+describe("the pages a visitor reads while hosted runs are on", () => {
+ it("the home steps: runs on the place, then make something", () => {
+ for (const viewer of [guestViewer, accountViewer]) {
+ state.viewer = viewer;
+ state.status = hostedStatus({ kind: viewer.account ? "account" : "guest" });
+ const text = textOf(render(createElement(StartSteps)));
+ expect(text).toContain("Runs on Studio North GPUs, or on your own GPU.");
+ expect(text).toContain("Make something.");
+ expect(text).toContain("Pick a studio and press Generate. Your own GPU or key is optional.");
+ expect(text).toContain("Open the Video studio");
+ expect(text).not.toMatch(FORBIDDEN);
+ }
+ });
+
+ it("a tile and a Library card: In line with its place, Working, then one sentence", () => {
+ const pages = [
+ render(createElement(PendingTile, { g: gen({ status: "queued", message: POOL_WORDS.inLine, queue: { place: 3, etaSeconds: 130 } }), ratio: 1 })),
+ render(createElement(PendingTile, { g: gen({ status: "running", message: POOL_WORDS.working, progress: 0.4 }), ratio: 1 })),
+ render(createElement(FailedTile, { g: gen({ status: "failed", error: POOL_WORDS.failed }), ratio: 1, onRetry: () => {} })),
+ render(createElement(StatusCover, { g: gen({ status: "queued", message: POOL_WORDS.inLine, queue: { place: 3, etaSeconds: 130 } }) })),
+ render(createElement(StatusCover, { g: gen({ status: "running", message: POOL_WORDS.working, progress: 0.4 }) })),
+ render(createElement(StatusCover, { g: gen({ status: "failed", error: POOL_WORDS.failed }) })),
+ ].map(textOf);
+ expect(pages[3]).toContain("In line · 3rd · about 2 min");
+ expect(pages[4]).toContain("Working");
+ expect(pages[5]).toContain("Sorry, this one couldn't be made.");
+ expect(pages[5]).not.toContain("Couldn't generate this one");
+ expect(listStatus({ status: "failed", place: "pool" })).toBe("Couldn't be made");
+ expect(listStatus({ status: "queued", place: "pool" })).toBe("In line");
+ expect(listStatus({ status: "running", place: "pool" })).toBe("Working");
+ for (const t of pages) expect(t).not.toMatch(FORBIDDEN);
+ });
+
+ it("the feed's header names the place a result was made on", () => {
+ notePlaceName(NAMED.label);
+ const out = { url: "/api/files/a1", kind: "image" as const, contentType: "image/png", width: 1024, height: 1024 };
+ const text = textOf(render(createElement(Feed, { items: [gen({ status: "succeeded", outputs: [out], completedAt: Date.now() })], empty: createElement("p", null, "Nothing yet") })));
+ expect(text).toContain("Studio North GPUs");
+ expect(text).not.toContain("Open source");
+ expect(text).not.toMatch(FORBIDDEN);
+ });
+
+ it("Settings → Your keys and the engine switch", () => {
+ const keys = textOf([render(createElement(AccountKeysSection, { prices: "about $0.04 a picture" })), render(createElement(KeyInstead))].join(" "));
+ expect(keys).toContain("On your key: up to 4 runs at once and 60 an hour.");
+ expect(keys).toContain("Paid models: add your own fal.ai or Replicate key to use Nano Banana, Kling and Veo, billed to your account with them.");
+ expect(keys).not.toContain("No GPU?");
+ // A guest's switch (no tips of an account's own): open models run free on the place; the owner's words stay.
+ expect(engineTip("open", null, NAMED)).toBe("Open models, free on Studio North GPUs");
+ expect(engineTip("open", null, null)).toBe("Open-weight models running on your ComfyUI server");
+ expect(engineTip("cloud", null, NAMED)).toBe("Frontier paid models via your fal.ai / Replicate key");
+ state.viewer = guestViewer;
+ state.status = hostedStatus({ kind: "guest" });
+ expect(textOf(render(createElement(EngineSwitch, { value: "open", onChange: () => {} })))).not.toMatch(FORBIDDEN);
+ });
+});
diff --git a/tests/own-setup-labels.test.ts b/tests/own-setup-labels.test.ts
index d47545be..5f658a72 100644
--- a/tests/own-setup-labels.test.ts
+++ b/tests/own-setup-labels.test.ts
@@ -2,6 +2,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createElement, type ReactNode } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { afterEach, describe, expect, it, vi } from "vitest";
+import { placeOf } from "@/lib/place-name";
/*
* What this install's GPUs don't run for a visitor with no GPU of its own shows in the pickers and galleries with its
@@ -169,7 +170,7 @@ describe("the reason never appears in a visitor's words", () => {
it("in the labels, the price check's words and the tools' place", () => {
for (const o of setups) {
- const words = [ownSetupLabel(o), ownSetupShort(o), ownSetupDetail(o), gateText({ ok: false, reason: "ownSetup", setup: o }, true), gateText({ ok: false, reason: "ownSetup", setup: o }, false)];
+ const words = [ownSetupLabel(o), ownSetupShort(o), ownSetupDetail(o), gateText({ ok: false, reason: "ownSetup", setup: o }, true, placeOf(null)), gateText({ ok: false, reason: "ownSetup", setup: o }, false, placeOf(null))];
for (const audience of ["account", "guest"] as const) {
const place = runPlace({ audience, engine: "open", hosted: true, pool: checkedPool(refusedCheck(o)), format: String });
words.push(place.label, place.title, place.tip, place.send);
diff --git a/tests/place-name.test.ts b/tests/place-name.test.ts
new file mode 100644
index 00000000..bc2e6d3f
--- /dev/null
+++ b/tests/place-name.test.ts
@@ -0,0 +1,147 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
+import { startFakeBilling, FAKE_POLICY, type FakeBilling } from "./helpers/fake-billing";
+import { tempDir } from "./helpers/temp-dir";
+
+/*
+ * The name visitors read for this install's GPUs while hosted runs are on ("Runs on our GPUs"): the billing service's
+ * policy first, then the install's own setting (Settings → Workers), then FUOBE_PLACE_NAME, then "Our GPUs". A leading
+ * "Our " reads "our " inside a sentence, a name is cut at 40 characters, and nothing of it reaches a visitor while
+ * hosted runs are off.
+ */
+
+process.env.FUOBE_DATA_DIR = tempDir("fuobe-place-name-");
+process.env.FUOBE_PUBLIC_SIGNUP = "1";
+for (const k of ["FUOBE_PASSWORD", "FUOBE_HOSTED_RUNS", "FUOBE_HOSTED_FREE", "FUOBE_BILLING_URL", "FUOBE_BILLING_TOKEN", "FUOBE_PLACE_NAME"]) delete process.env[k];
+
+const { cleanPlaceName, knownPlace, notePlaceName, PLACE_NAME_DEFAULT, PLACE_NAME_MAX, placeOf } = await import("@/lib/place-name");
+const { placeName } = await import("@/server/place-name");
+const settings = await import("@/server/settings");
+const billing = await import("@/server/billing");
+const auth = await import("@/server/auth");
+const { visitorStatus } = await import("@/server/account-gpu");
+const { ownGpuQuiet } = await import("@/server/hosted-run");
+const { usePlaceName } = await import("@/lib/api");
+
+let fake: FakeBilling;
+let accountId = "";
+beforeAll(async () => {
+ fake = await startFakeBilling();
+ auth.setPassword("install password");
+ accountId = auth.createAccount("[email protected]", "long enough").id;
+});
+afterAll(async () => {
+ for (const k of ["FUOBE_HOSTED_RUNS", "FUOBE_HOSTED_FREE", "FUOBE_BILLING_URL", "FUOBE_BILLING_TOKEN", "FUOBE_PLACE_NAME"]) delete process.env[k];
+ await fake.close();
+});
+beforeEach(() => {
+ for (const k of ["FUOBE_HOSTED_RUNS", "FUOBE_HOSTED_FREE", "FUOBE_BILLING_URL", "FUOBE_BILLING_TOKEN", "FUOBE_PLACE_NAME"]) delete process.env[k];
+ settings.setSetting("hostedPlaceName", "");
+ billing.resetBillingCache();
+ fake.policy = { ...FAKE_POLICY };
+});
+
+describe("a place name as it is kept", () => {
+ it("one line, spaces folded, at most 40 characters, never half an emoji", () => {
+ expect(cleanPlaceName(" Ana's render\nbox ")).toBe("Ana's render box");
+ expect(cleanPlaceName("")).toBeNull();
+ expect(cleanPlaceName(" ")).toBeNull();
+ expect(cleanPlaceName(42)).toBeNull();
+ expect(cleanPlaceName(undefined)).toBeNull();
+ const long = "A".repeat(39) + "🎬🎬";
+ expect(Array.from(cleanPlaceName(long)!)).toHaveLength(PLACE_NAME_MAX);
+ expect(cleanPlaceName(long)!.endsWith("🎬")).toBe(true);
+ expect(cleanPlaceName("x".repeat(60))).toHaveLength(PLACE_NAME_MAX);
+ });
+ it("as a label and inside a sentence: a leading Our reads our", () => {
+ expect(placeOf(null)).toEqual({ label: PLACE_NAME_DEFAULT, text: "our GPUs" });
+ expect(PLACE_NAME_DEFAULT).toBe("Our GPUs");
+ expect(placeOf("Our render farm")).toEqual({ label: "Our render farm", text: "our render farm" });
+ expect(placeOf("Ana's render box")).toEqual({ label: "Ana's render box", text: "Ana's render box" });
+ expect(placeOf("Ourselves")).toEqual({ label: "Ourselves", text: "Ourselves" });
+ });
+ it("words outside React use the name the status gave last", () => {
+ notePlaceName("Studio North GPUs");
+ expect(knownPlace().label).toBe("Studio North GPUs");
+ notePlaceName(null);
+ expect(knownPlace().label).toBe("Our GPUs");
+ });
+ it("the question for an own GPU that didn't answer names it, with no verb to agree", () => {
+ expect(ownGpuQuiet(placeOf("Studio North GPUs"))).toBe("Your GPU isn't answering right now. Run this on Studio North GPUs instead, or wait for your GPU.");
+ });
+});
+
+describe("where the name comes from (first match wins)", () => {
+ it("the default, then FUOBE_PLACE_NAME, then the install's setting, then the billing service's policy", () => {
+ expect(placeName()).toBe("Our GPUs");
+ process.env.FUOBE_PLACE_NAME = "Env box";
+ expect(placeName()).toBe("Env box");
+ settings.setSetting("hostedPlaceName", "Ana's render box");
+ expect(placeName()).toBe("Ana's render box");
+ expect(placeName({ placeName: "Studio North GPUs" })).toBe("Studio North GPUs");
+ // A policy with no name, or an empty or odd one, leaves the install's.
+ expect(placeName({})).toBe("Ana's render box");
+ expect(placeName({ placeName: " " })).toBe("Ana's render box");
+ expect(placeName({ placeName: 7 as unknown as string })).toBe("Ana's render box");
+ // A long policy name is cut at 40 characters.
+ expect(placeName({ placeName: "N".repeat(80) })).toHaveLength(PLACE_NAME_MAX);
+ });
+ it("the setting takes one line of at most 40 characters", () => {
+ expect(() => settings.validateSetting("hostedPlaceName", "x".repeat(PLACE_NAME_MAX), "api")).not.toThrow();
+ expect(() => settings.validateSetting("hostedPlaceName", "x".repeat(PLACE_NAME_MAX + 1), "api")).toThrow(/at most 40/);
+ expect(() => settings.validateSetting("hostedPlaceName", "two\nlines", "api")).toThrow(/one line/);
+ expect(() => settings.validateSetting("hostedPlaceName", "", "api")).not.toThrow();
+ });
+});
+
+describe("what a visitor's status says", () => {
+ it("nothing while hosted runs are off, whatever the install names its GPUs", async () => {
+ process.env.FUOBE_PLACE_NAME = "Env box";
+ settings.setSetting("hostedPlaceName", "Ana's render box");
+ for (const s of [await visitorStatus(auth.accountById(accountId)!), await visitorStatus(null)]) expect(s.viewer).not.toHaveProperty("placeName");
+ });
+ it("hosted runs on with no service: the install's name, else the default, to a guest and an account", async () => {
+ process.env.FUOBE_HOSTED_RUNS = "1";
+ process.env.FUOBE_HOSTED_FREE = "1";
+ expect((await visitorStatus(auth.accountById(accountId)!)).viewer.placeName).toBe("Our GPUs");
+ settings.setSetting("hostedPlaceName", "Ana's render box");
+ expect((await visitorStatus(auth.accountById(accountId)!)).viewer.placeName).toBe("Ana's render box");
+ expect((await visitorStatus(null)).viewer.placeName).toBe("Ana's render box");
+ });
+ it("with a billing service: its policy's name wins; none while its policy closes hosted runs", async () => {
+ process.env.FUOBE_HOSTED_RUNS = "1";
+ process.env.FUOBE_BILLING_URL = fake.url;
+ process.env.FUOBE_BILLING_TOKEN = "test-billing-token";
+ settings.setSetting("hostedPlaceName", "Ana's render box");
+ fake.policy = { ...FAKE_POLICY, placeName: "Studio North GPUs" };
+ expect((await visitorStatus(auth.accountById(accountId)!)).viewer.placeName).toBe("Studio North GPUs");
+ billing.resetBillingCache();
+ fake.policy = { ...FAKE_POLICY };
+ expect((await visitorStatus(auth.accountById(accountId)!)).viewer.placeName).toBe("Ana's render box");
+ billing.resetBillingCache();
+ fake.policy = { ...FAKE_POLICY, hosted: false, placeName: "Studio North GPUs" };
+ expect((await visitorStatus(auth.accountById(accountId)!)).viewer).not.toHaveProperty("placeName");
+ });
+});
+
+describe("the page's place name", () => {
+ const read = (viewer: object | undefined) => {
+ const client = new QueryClient();
+ if (viewer) client.setQueryData(["status"], { providers: {}, demoMode: "off", engineMode: "both", cloudProvider: "auto", viewer });
+ let seen: unknown = "unset";
+ const Probe = () => {
+ seen = usePlaceName();
+ return null;
+ };
+ renderToStaticMarkup(createElement(QueryClientProvider, { client }, createElement(Probe)));
+ return seen;
+ };
+ it("none for the owner and while hosted runs are off; the name (or Our GPUs) while they are on", () => {
+ expect(read(undefined)).toBeNull();
+ expect(read({ kind: "account", gpu: { connected: false }, placeName: "Ignored" })).toBeNull();
+ expect(read({ kind: "account", gpu: { connected: false }, hosted: true })).toEqual({ label: "Our GPUs", text: "our GPUs" });
+ expect(read({ kind: "guest", gpu: { connected: false }, hosted: true, placeName: "Ana's render box" })).toEqual({ label: "Ana's render box", text: "Ana's render box" });
+ });
+});
diff --git a/tests/pool-account-runs.test.ts b/tests/pool-account-runs.test.ts
index 282d293c..fb3b5a80 100644
--- a/tests/pool-account-runs.test.ts
+++ b/tests/pool-account-runs.test.ts
@@ -47,7 +47,7 @@ const generationsRoute = await import("@/app/api/generations/route");
const { db } = await import("@/server/db");
const { resetRates } = await import("@/server/rate");
const { setSetting } = await import("@/server/settings");
-const { getGeneration, toGeneration } = await import("@/server/generations");
+const { getGeneration, shownError, toGeneration } = await import("@/server/generations");
const tasks = await import("@/server/computer/tasks");
const pool = await import("@/server/computer/pool");
const hosted = await import("@/server/hosted");
@@ -59,7 +59,7 @@ const { loadIndex } = await import("@/server/gpu/index-file");
const { allLanes } = await import("@/lib/lanes");
const { getModel } = await import("@/lib/catalog");
const { ComputerRunner } = await import("@/lib/computer-runner");
-const { POOL_WORDS } = await import("@/lib/relay");
+const { FILE_TROUBLE_WORDS, POOL_WORDS } = await import("@/lib/relay");
const { ACCOUNT_MESSAGES } = await import("@/server/account-files");
const { catalogVersion } = await import("@/server/computer/catalog-version");
@@ -546,6 +546,56 @@ describe("what an account reads about its run", () => {
});
});
+describe("nothing raw reaches an account from a run on this install's GPUs", () => {
+ const put = (id: string, status: string, request: Record<string, unknown>, o: { error?: string; outputs?: unknown[] } = {}) => {
+ const now = Date.now();
+ db()
+ .prepare("INSERT INTO generations (id, feature, model_id, engine, provider, op, kind, status, request_json, outputs_json, error, created_at, updated_at) VALUES (?, 'image', 'm', 'open', 'comfyui', 't2i', 'image', ?, ?, ?, ?, ?, ?)")
+ .run(id, status, JSON.stringify({ account: accountId, ...request }), JSON.stringify(o.outputs ?? []), o.error ?? null, now, now);
+ };
+
+ it("a page that reads a step's failure from the table says the tile's sentence (a Mixed Media frame)", () => {
+ const raw = "ComfyUI kept stopping on the GPUs. Press Retry.";
+ put("shown-pool", "failed", { place: "pool" }, { error: raw });
+ put("shown-own", "failed", {}, { error: raw });
+ expect(shownError("shown-pool", raw)).toBe(POOL_WORDS.failed);
+ expect(shownError("shown-own", raw)).toBe(raw);
+ expect(shownError("shown-gone", raw)).toBe(raw);
+ });
+
+ it("words about the person's own files stay, so they know what to change", () => {
+ for (const words of Object.values(FILE_TROUBLE_WORDS)) {
+ const id = `files-${words.length}`;
+ put(id, "failed", { place: "pool" }, { error: words });
+ expect(getGeneration(id)!.error).toBe(words);
+ }
+ });
+
+ it("a 3D finish's own trouble stays on the server; the account's own GPU runs keep theirs", () => {
+ const model = { url: "/api/files/m1", kind: "model3d", meta: { finish: { turntable: "queued", error: "web GLB: exit 1" }, web: "/api/files/w1" } };
+ put("finish-pool", "succeeded", { place: "pool" }, { outputs: [model] });
+ put("finish-own", "succeeded", {}, { outputs: [model] });
+ const pooled = getGeneration("finish-pool")!.outputs[0].meta as { finish: Record<string, unknown>; web: string };
+ expect(pooled.finish).toEqual({ turntable: "queued" });
+ expect(pooled.web).toBe("/api/files/w1");
+ expect((getGeneration("finish-own")!.outputs[0].meta as { finish: Record<string, unknown> }).finish.error).toBe("web GLB: exit 1");
+ });
+
+ it("the owner's words for a task stopped after its tries: how many tries while hosted runs are on, as before otherwise", () => {
+ delete process.env.FUOBE_HOSTED_RUNS;
+ expect(pool.stoppedWords("silent", 3)).toBe("The GPU running this stopped answering, three times. Press Retry.");
+ expect(pool.stoppedWords("other", 3)).toBe("The GPUs couldn't finish this run. Press Retry.");
+ process.env.FUOBE_HOSTED_RUNS = "1";
+ try {
+ expect(pool.stoppedWords("silent", 3)).toBe("Stopped after 3 tries: the GPU stopped answering.");
+ expect(pool.stoppedWords("down", 1)).toBe("Stopped after 1 try: ComfyUI kept stopping on the GPUs.");
+ for (const kind of ["silent", "down", "stuck", "other"] as const) expect(pool.stoppedWords(kind, 3)).not.toMatch(/Press Retry/);
+ } finally {
+ delete process.env.FUOBE_HOSTED_RUNS;
+ }
+ });
+});
+
describe("an account's run that a worker can't finish", () => {
/** Words that must never reach an account's run on this install's GPUs. */
const JARGON = /ComfyUI|GPU|worker|lane|Press Retry|refused|stopped answering|busy|restart/i;
@@ -576,7 +626,8 @@ describe("an account's run that a worker can't finish", () => {
return g && g.status !== "queued" && g.status !== "running" ? g : null;
}, 400))!;
- const cases: [string, (w: ReturnType<typeof workerApi>, taskId: string) => Promise<void>][] = [
+ /** Each case, how it ends, and its words for the account (the failure sentence unless it is about the person's files). */
+ const cases: [string, (w: ReturnType<typeof workerApi>, taskId: string) => Promise<void>, string?][] = [
[
"given back three times (it stalled)",
async (w) => {
@@ -604,6 +655,8 @@ describe("an account's run that a worker can't finish", () => {
await w.report(t, { event: "sent", promptId: t.promptId });
await w.report(t, { event: "failed", reason: "input-crashed" });
},
+ // Its files or settings stopped it: said so, since the person can change them.
+ FILE_TROUBLE_WORDS.crashed,
],
[
"a file the worker refused",
@@ -627,7 +680,7 @@ describe("an account's run that a worker can't finish", () => {
],
];
- for (const [name, end] of cases) {
+ for (const [name, end, words] of cases) {
it(`${name}: one plain sentence for the account, the reason for the owner`, async () => {
const w = standInWorker();
beatAs(w);
@@ -636,11 +689,16 @@ describe("an account's run that a worker can't finish", () => {
expect(rowOf(taskId).state).toBe("failed");
const g = await ended(id);
expect(g.status).toBe("failed");
- expect(g.error).toBe(POOL_WORDS.failed);
+ expect(g.error).toBe(words ?? POOL_WORDS.failed);
expect(g.message ?? "").not.toMatch(JARGON);
expect(g.fix).toBeUndefined();
- // The owner reads what happened.
+ // The owner reads what happened (words about the person's files: the same words, nothing more behind them).
const owner = listAccountRuns({ account: accountId }).items.find((x) => x.id === id);
+ if (words) {
+ expect(owner?.error).toBe(words);
+ expect(owner?.detail).toBeUndefined();
+ return;
+ }
expect(owner?.detail).toBeTruthy();
expect(owner?.detail).not.toBe(POOL_WORDS.failed);
});
diff --git a/tests/pool-limits.test.ts b/tests/pool-limits.test.ts
index d1e95c15..7a7bd9bf 100644
--- a/tests/pool-limits.test.ts
+++ b/tests/pool-limits.test.ts
@@ -1,5 +1,6 @@
import crypto from "node:crypto";
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
+import { placeOf } from "@/lib/place-name";
import { startFakeBilling, FAKE_POLICY, type FakeBilling } from "./helpers/fake-billing";
import { tempDir } from "./helpers/temp-dir";
@@ -808,7 +809,7 @@ describe("a run's price facts", () => {
// way through. (A text step runs on the install's AI helper: hosted-tool-runs.test.ts.)
expect(hostedRun.stepsProblem(billing.OPEN_POLICY, steps([["oss-z-image-turbo", "comfyui"], ["fal-flux", "fal"]]))).not.toBeNull();
for (const provider of ["local", "mock"]) {
- expect(hostedRun.stepsProblem({ ...billing.OPEN_POLICY, pool: { allow: ["oss-z-image-turbo"] } }, steps([["oss-z-image-turbo", "comfyui"], ["some-step", provider]])), provider).toBe(hosted.HOSTED_WORDS.notOffered);
+ expect(hostedRun.stepsProblem({ ...billing.OPEN_POLICY, pool: { allow: ["oss-z-image-turbo"] } }, steps([["oss-z-image-turbo", "comfyui"], ["some-step", provider]])), provider).toBe(hosted.hostedWords(placeOf(null)).notOffered);
}
expect(hostedRun.pricedSteps(steps([["oss-z-image-turbo", "comfyui"], ["oss-z-image-turbo", "comfyui"]]))).toEqual([expect.objectContaining({ model: "oss-z-image-turbo", jobs: 2 })]);
});
@@ -816,7 +817,9 @@ describe("a run's price facts", () => {
describe("the price check before Run and the run itself", async () => {
const { PLACEHOLDER } = await import("@/lib/composer");
- const { HOSTED_GUEST_WORDS, HOSTED_WORDS } = await import("@/server/hosted");
+ const { hostedGuestWords, hostedWords } = await import("@/server/hosted");
+ const HOSTED_GUEST_WORDS = hostedGuestWords();
+ const HOSTED_WORDS = hostedWords(placeOf(null));
const { OWN_GPU_TOOL_MESSAGE } = await import("@/lib/guest-access");
/** A Fuobe DoP effect: its start frame is made first on another model, then animated. */
const EFFECT = { feature: "video", presetId: "effect-acid", modelId: "fuobe-dop", op: "i2v", prompt: "a dancer", inputs: { images: [PLACEHOLDER.image] } };
@@ -975,9 +978,9 @@ describe("the price check before Run and the run itself", async () => {
setSetting("comfyWhere", "workers");
expect(hostedRun.stepsProblem(billing.OPEN_POLICY, chain)).not.toBe(HOSTED_WORDS.rtxCard);
// A guest is told it isn't offered, with nowhere to connect a GPU named.
- expect(hostedRun.gateWords("rtxCard", true)).toBe(HOSTED_GUEST_WORDS.rtxCard);
- expect(hostedRun.gateWords("rtxCard", true)).not.toMatch(/Settings|your own GPU|NVIDIA/);
- expect(hostedRun.gateWords("rtxCard", false)).toBe(HOSTED_WORDS.rtxCard);
+ expect(hostedRun.gateWords("rtxCard", true, placeOf(null))).toBe(HOSTED_GUEST_WORDS.rtxCard);
+ expect(hostedRun.gateWords("rtxCard", true, placeOf(null))).not.toMatch(/Settings|your own GPU|NVIDIA/);
+ expect(hostedRun.gateWords("rtxCard", false, placeOf(null))).toBe(HOSTED_WORDS.rtxCard);
});
it("asks for the client's address only when the policy counts runs per address, and keeps its salt without writing again", async () => {
@@ -1023,10 +1026,10 @@ describe("the price check before Run and the run itself", async () => {
describe("a run on this install's GPUs that can't finish", async () => {
const { getGeneration } = await import("@/server/generations");
const { POOL_WORDS } = await import("@/lib/relay");
- const { HIDDEN_WORDS } = await import("@/server/output-checks");
+ const { SITE_HIDDEN_WORDS } = await import("@/server/output-checks");
const fail = (id: string, error: string) => db().prepare("UPDATE generations SET status = 'failed', error = ?, completed_at = ? WHERE id = ?").run(error, Date.now(), id);
const hide = (id: string) => {
- fail(id, HIDDEN_WORDS);
+ fail(id, SITE_HIDDEN_WORDS);
db().prepare("INSERT INTO output_checks (asset_id, generation_id, state, asked_at, tries, next_at) VALUES (?, ?, 'hidden', ?, 0, ?)").run(`asset-${id}`, id, Date.now(), Date.now());
};
const FREE = { shown: { amount: 0, priceVersion: "v0" } };
@@ -1047,7 +1050,7 @@ describe("a run on this install's GPUs that can't finish", async () => {
const hidden = await post({ ...IMAGE, ...FREE }, a.cookie);
const hiddenId = hidden.body.items![0].id;
hide(hiddenId);
- expect(getGeneration(hiddenId)!.error).toBe("This result was removed by the studio's checks.");
+ expect(getGeneration(hiddenId)!.error).toBe("This result didn't pass the safety check, so it was removed.");
expect(getGeneration(hiddenId)!.notCharged).toBeUndefined();
// Something set aside: it says so.
fake.price = { amount: 7, version: "v7" };
@@ -1055,7 +1058,7 @@ describe("a run on this install's GPUs that can't finish", async () => {
expect(paid.status, JSON.stringify(paid.body)).toBe(201);
const paidId = paid.body.items![0].id;
hide(paidId);
- expect(getGeneration(paidId)).toMatchObject({ notCharged: true, error: HIDDEN_WORDS });
+ expect(getGeneration(paidId)).toMatchObject({ notCharged: true, error: SITE_HIDDEN_WORDS });
// That the hold set something aside stays the server's: never sent with the request.
expect("charged" in getGeneration(paidId)!.request).toBe(false);
expect((JSON.parse((db().prepare("SELECT request_json FROM generations WHERE id = ?").get(paidId) as { request_json: string }).request_json) as { charged?: boolean }).charged).toBe(true);
diff --git a/tests/recovery-server.test.ts b/tests/recovery-server.test.ts
index 0c8973c4..2669f77b 100644
--- a/tests/recovery-server.test.ts
+++ b/tests/recovery-server.test.ts
@@ -73,7 +73,8 @@ const { loadIndex } = await import("@/server/gpu/index-file");
const { allLanes } = await import("@/lib/lanes");
const { getModel } = await import("@/lib/catalog");
const { POOL_WORDS } = await import("@/lib/relay");
-const { HOSTED_WORDS } = await import("@/server/hosted");
+const { hostedWords } = await import("@/server/hosted");
+const HOSTED_WORDS = hostedWords((await import("@/lib/place-name")).placeOf(null));
const { ACCOUNT_MESSAGES } = await import("@/server/account-files");
type TaskRow = import("@/server/computer/tasks").TaskRow;
diff --git a/tests/recovery-worker.test.ts b/tests/recovery-worker.test.ts
index 3ac3b55a..98a47752 100644
--- a/tests/recovery-worker.test.ts
+++ b/tests/recovery-worker.test.ts
@@ -5,6 +5,7 @@ import { pathToFileURL } from "node:url";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { runnerByHand, tick } from "./helpers/app-process";
import { apiAs, loadRoutes, type ComputerRoutes } from "./helpers/computer-tab";
+import { FILE_TROUBLE_WORDS } from "@/lib/relay";
import { FAKE_PNG } from "./helpers/fake-local-comfy";
import { plainFailure, RunWatch, type RunLike } from "./helpers/run-watch";
import { FREE_RUNS_POLICY, startStandInBilling, type StandInBilling } from "./helpers/standin-billing";
@@ -457,7 +458,8 @@ describe("the worker program's recovery (accounts' runs, end to end)", () => {
}, 50);
try {
await until(() => done(studio.getGeneration(bad.id)), 120_000);
- expect(plainFailure(studio.getGeneration(bad.id)!, { charged: false })).toEqual([]);
+ // Its words say it is these files or settings (the person can change them), never the machines.
+ expect(plainFailure(studio.getGeneration(bad.id)!, { charged: false, words: FILE_TROUBLE_WORDS.crashed })).toEqual([]);
await expectOnce(next.id, watch, { place: 2 });
expect(svc.reportsFor(bad.id).map((r) => r.kind)).toEqual(["refund"]);
} finally {
diff --git a/tests/run-again.test.ts b/tests/run-again.test.ts
index dabed93a..94006704 100644
--- a/tests/run-again.test.ts
+++ b/tests/run-again.test.ts
@@ -84,7 +84,7 @@ describe("an account's own GPU that didn't answer", () => {
await window.fetch("/api/turnaround", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
await settle();
const offer = toasts.shown.at(-1)!;
- expect(offer.action?.label).toBe("Run on this studio's GPUs");
+ expect(offer.action?.label).toBe("Run on Our GPUs");
offer.action!.onClick();
await settle();
await settle();
@@ -92,6 +92,14 @@ describe("an account's own GPU that didn't answer", () => {
expect(new Headers(sent.at(-1)!.init?.headers).get(RUN_PLACE_HEADER)).toBe("pool");
});
+ it("the offer says the place by the name the server gave", async () => {
+ page();
+ server = () => answer(409, { error: "Your GPU isn't answering right now.", placeName: "Ana's render box" }, { [PLACE_ASK_HEADER]: "1" });
+ await window.fetch("/api/turnaround", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
+ await settle();
+ expect(toasts.shown.at(-1)!.action?.label).toBe("Run on Ana's render box");
+ });
+
it("sendRunAgain says when the run still didn't start", async () => {
page();
server = () => answer(500, { error: "Something went wrong" });
diff --git a/tests/run-place.test.ts b/tests/run-place.test.ts
index 511fe54f..9c79dbca 100644
--- a/tests/run-place.test.ts
+++ b/tests/run-place.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
+import { placeOf } from "@/lib/place-name";
import { quoteBody } from "@/lib/hosted";
import { checkedPool, composerOnPool, composerPlace, IN_BROWSER, mainModel, openCheckPlace, placePrice, refusedBeforeRun, runPlace, toolPoolPrice, withPoolRefusal, type RunPlaceInput } from "@/lib/run-place";
import { RUN_SHOWN_HEADER, shownHeader } from "@/lib/guest-access";
@@ -97,13 +98,18 @@ describe("a guest", () => {
describe("hosted runs (this studio's GPUs)", () => {
it("an account with no GPU runs open models there, at the quoted price", () => {
const p = at({ audience: "account", engine: "open", hosted: true, gpu: false, models: ["Tap to Recolor"], pool: { text: "$0.02" } });
- expect(p).toMatchObject({ where: "pool", label: "This studio's GPUs", price: "$0.02", title: "Runs on this studio's GPUs", send: "$0.02 · this studio's GPUs" });
- expect(p.tip).toBe("Runs on this studio's GPUs with Tap to Recolor.");
+ expect(p).toMatchObject({ where: "pool", label: "Our GPUs", price: "$0.02", title: "Runs on our GPUs", send: "$0.02" });
+ expect(p.tip).toBe("Runs on our GPUs with Tap to Recolor.");
expect(p.needs).toBeUndefined();
});
+ it("says the place by the name it is given, with no verb that has to agree with it", () => {
+ const p = at({ audience: "account", engine: "open", hosted: true, models: ["Z-Image Turbo"], pool: { text: "" }, place: placeOf("Ana's render box") });
+ expect(p).toMatchObject({ label: "Ana's render box", title: "Runs on Ana's render box", price: "Free", send: "Free" });
+ expect(p.tip).toBe("Runs on Ana's render box with Z-Image Turbo.");
+ });
it("says the service's own words, free when it quotes no price, and nothing while pricing", () => {
expect(at({ audience: "account", engine: "open", hosted: true, pool: { text: "", sub: "Included in your plan" } })).toMatchObject({ price: "Free", tip: "Included in your plan" });
- expect(at({ audience: "account", engine: "open", hosted: true })).toMatchObject({ where: "pool", price: "", send: "this studio's GPUs" });
+ expect(at({ audience: "account", engine: "open", hosted: true })).toMatchObject({ where: "pool", price: "", send: "" });
});
it("an account with its own GPU still runs there, free; the owner always on its own", () => {
expect(at({ audience: "account", engine: "open", hosted: true, gpu: true }).where).toBe("gpu");
@@ -115,8 +121,9 @@ describe("hosted runs (this studio's GPUs)", () => {
});
it("a guest signs up first", () => {
const p = at({ audience: "guest", engine: "open", hosted: true });
- expect(p).toMatchObject({ where: "pool", needs: "signup", send: "this studio's GPUs, after sign-up" });
- expect(p.tip).toMatch(/Create a free account to run it.$/);
+ expect(p).toMatchObject({ where: "pool", needs: "signup", send: "sign up to run" });
+ expect(p.tip).toMatch(/ Free with an account\.$/);
+ expect(at({ audience: "guest", engine: "open", hosted: true, pool: { text: "" } }).send).toBe("Free · sign up to run");
});
it("leaves the cloud and the owner's tools as they are", () => {
expect(at({ audience: "account", engine: "cloud", hosted: true, payer: "fal", costUsd: 0.1 }).where).toBe("cloud");