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.

Turnaround and Canvas: QMA stills named by the person's sides, product angles keep their words

Claude3db8bfb43e28
diff --git a/src/components/cinema/soul-builders.tsx b/src/components/cinema/soul-builders.tsx
index f523a45a..f23fb3ff 100644
--- a/src/components/cinema/soul-builders.tsx
+++ b/src/components/cinema/soul-builders.tsx
@@ -470,6 +470,7 @@ function SoulLocation({ projectId, folderId, engine, settings, context, brief, o
QMA · 96 views
</label>
)}
+ {engine === "cloud" && <span className="mr-1 text-[11.5px] text-muted-foreground">(QMA · 96 views runs on your GPU)</span>}
{LOCATION_VIEWS.map((v) => (
<button key={v.id} type="button" onClick={() => run({ view: v.id, url: chosen[0] })} className="h-7 rounded-full bg-secondary px-2.5 text-[12px] font-medium hover:bg-accent">
{v.name}
diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsx
index 8ac7be2c..0670b9fa 100644
--- a/src/components/fashion/character-sheet.tsx
+++ b/src/components/fashion/character-sheet.tsx
@@ -2,7 +2,8 @@
import { AtSign, Check, Dices, ImagePlus, Loader2, RotateCcw, Shuffle, Sparkles, UserRoundPlus, X } from "lucide-react";
import Link from "next/link";
-import { useMemo, useRef, useState } from "react";
+import { Suspense, useMemo, useRef, useState, type ComponentProps } from "react";
+import { useSearchParams } from "next/navigation";
import { toast } from "sonner";
import { PageHeader, PageShell } from "@/components/page-shell";
import { SelfHostNote } from "@/components/self-host-note";
@@ -152,6 +153,22 @@ export function SaveCharacter({ item, extra, defaultName }: { item: Generation;
* reference photos, from a Soul Cast build, or from a description (the AI Influencer app) — saved as
* a character element.
*/
+type TurnaroundProps = ComponentProps<typeof TurnaroundButton>;
+
+/** ?stills=1 (the GPU pre-flight board's "Turnaround stills · 8 views"): the dialog starts on the 8-view still set. */
+function TurnaroundFromLink(props: TurnaroundProps) {
+ const stills = useSearchParams().get("stills") === "1";
+ return <TurnaroundButton {...props} {...(stills && { route: "stills" as const })} />;
+}
+
+function SheetTurnaround(props: TurnaroundProps) {
+ return (
+ <Suspense fallback={<TurnaroundButton {...props} />}>
+ <TurnaroundFromLink {...props} />
+ </Suspense>
+ );
+}
+
export function CharacterSheetView({ fields, defaults }: { fields: CastFieldData[]; defaults: CastAnswers }) {
const [engine, setEngine] = useEngine();
// A sheet doesn't run on an account's own GPU or key yet (only the studios' generations do): said up front, and the
@@ -318,7 +335,7 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldData
<>
<div className="flex flex-wrap items-center gap-x-3 gap-y-2 rounded-2xl border bg-background p-3">
<p className="min-w-0 flex-1 text-[13px] text-muted-foreground">Film the character all the way round: front, right side, back, left side.</p>
- <TurnaroundButton
+ <SheetTurnaround
key={latest.id}
pictures={sheetPictures(latest)}
name={mode === "cast" ? castNameFor(cast) : undefined}
diff --git a/src/components/turnaround/turnaround-dialog.tsx b/src/components/turnaround/turnaround-dialog.tsx
index ae3bea16..8e0f2608 100644
--- a/src/components/turnaround/turnaround-dialog.tsx
+++ b/src/components/turnaround/turnaround-dialog.tsx
@@ -71,6 +71,8 @@ interface Props {
flyAround?: boolean;
/** A person Fuobe made up (Soul Cast): no consent line to ask for. */
fictional?: boolean;
+ /** The route the dialog starts on, on your GPU (the pre-flight board's "Turnaround stills · 8 views" link). */
+ route?: TurnRoute;
}
async function post<T>(url: string, body: unknown): Promise<T> {
@@ -80,7 +82,8 @@ async function post<T>(url: string, body: unknown): Promise<T> {
return out;
}
-type Run = { ids: string[]; filmId: string };
+/** A started run; `front`: a still set's own front picture (shown first with the drawn views). */
+type Run = { ids: string[]; filmId: string; front?: string };
const runFeatures = (p: Pick<Props, "features" | "elementId">) => p.features ?? (p.elementId ? [`element:${p.elementId}`, "turnaround-step"] : ["turnaround", "turnaround-step"]);
@@ -144,7 +147,7 @@ export function TurnaroundButton({
(e.currentTarget as HTMLElement | null)?.focus();
}}
>
- {open && (run ? <RunView heading={headingOf(props)} state={state} elementId={props.elementId} onAgain={() => setRun(null)} /> : <TurnaroundForm {...props} onStarted={setRun} />)}
+ {open && (run ? <RunView heading={headingOf(props)} state={state} front={run.front} elementId={props.elementId} onAgain={() => setRun(null)} /> : <TurnaroundForm {...props} onStarted={setRun} />)}
</DialogContent>
</Dialog>
</>
@@ -161,7 +164,7 @@ function Thumb({ url, className }: { url?: string; className?: string }) {
return url ? <img src={url} alt="" className={cn("size-full object-cover", className)} /> : null;
}
-function TurnaroundForm({ pictures, name, realPerson: realDefault = false, elementId, engine: fixedEngine, onRun, title, flyAround, fictional, onStarted }: Props & { onStarted: (run: Run) => void }) {
+function TurnaroundForm({ pictures, name, realPerson: realDefault = false, elementId, engine: fixedEngine, onRun, title, flyAround, fictional, route: startRoute, onStarted }: Props & { onStarted: (run: Run) => void }) {
const [appEngine, setAppEngine] = useEngine();
const engine = fixedEngine ?? appEngine;
const start = useMemo(() => startingViews(pictures), [pictures]);
@@ -170,7 +173,7 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
const [fill, setFill] = useState<boolean | undefined>(undefined);
const [fillWith, setFillWith] = useState<TurnFill>("angles");
// The route and length picked hold for the engine they were picked on: another engine starts from its own defaults.
- const [picked, setPicked] = useState<{ engine: Engine; route?: TurnRoute; duration?: number }>({ engine });
+ const [picked, setPicked] = useState<{ engine: Engine; route?: TurnRoute; duration?: number }>({ engine, ...(engine === "open" && startRoute && { route: startRoute }) });
const route = picked.engine === engine ? picked.route : undefined;
const duration = picked.engine === engine ? picked.duration : undefined;
const setRoute = (r: TurnRoute) => setPicked({ engine, route: r });
@@ -209,7 +212,10 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
mutationFn: async ({ b, requestId }: { b: TurnaroundBody; requestId: string }): Promise<{ items: Generation[]; filmId?: string }> =>
onRun ? { items: await onRun(b) } : post<{ items: Generation[]; filmId: string }>("/api/turnaround", { ...b, requestId }),
// The film: the one the server names, else the joined clips, else the one video the run makes (drawn pictures are stills).
- onSuccess: ({ items, filmId }) => onStarted({ ids: items.map((g) => g.id), filmId: filmId ?? (items.find((g) => g.op === "concat") ?? items.find((g) => g.kind === "video") ?? items[0])?.id }),
+ onSuccess: ({ items, filmId }) => {
+ const front = (p?.route ?? route) === "stills" ? p?.frames.find((f) => f.side === "front")?.url : undefined;
+ onStarted({ ids: items.map((g) => g.id), filmId: filmId ?? (items.find((g) => g.op === "concat") ?? items.find((g) => g.kind === "video") ?? items[0])?.id, ...(front && { front }) });
+ },
onError: (e) => toastError(e),
});
const makeIt = () => void guard(JSON.stringify(body), (requestId) => make.mutateAsync({ b: body, requestId })).catch(() => {});
@@ -326,6 +332,7 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
<Chips label="Route" value={usedRoute} options={p.routes.map((r) => ({ value: r, label: TURN_ROUTES[r].name }))} onChange={(v) => setRoute(v as TurnRoute)} hint={usedRoute ? TURN_ROUTES[usedRoute].detail : undefined} />
)}
{p && p.routes.length === 1 && usedRoute && <p className="text-[12px] text-muted-foreground">{TURN_ROUTES[usedRoute].detail}.</p>}
+ {engine === "cloud" && <p className="text-[12px] text-muted-foreground">The 8-view still set, and sides drawn with QMA · 96 views, run on your GPU (open source).</p>}
{camera && <Chips label="Path" value={path ?? TURN_PATHS[0].id} options={TURN_PATHS.map((x) => ({ value: x.id, label: x.name }))} onChange={setPath} hint={TURN_PATHS.find((x) => x.id === (path ?? TURN_PATHS[0].id))?.description} />}
<div className="flex flex-wrap gap-x-6 gap-y-3">
{p && p.durations.length > 0 && <Chips label="Length" value={String(p.duration)} options={p.durations.map((d) => ({ value: String(d), label: `${d} s` }))} onChange={(v) => setDuration(Number(v))} />}
@@ -456,10 +463,16 @@ export function useCharacterPictures(urls: string[]): TurnPicture[] {
}
/** A run's progress, then the finished turnaround. */
-function RunView({ heading, state, elementId, onAgain }: { heading: string; state: ReturnType<typeof useRunState>; elementId?: string; onAgain: () => void }) {
+function RunView({ heading, state, front, elementId, onAgain }: { heading: string; state: ReturnType<typeof useRunState>; front?: string; elementId?: string; onAgain: () => void }) {
const { video, failed, done, total, working } = state;
- // A still set (Stills · 8 views): its pictures once every one is drawn.
- const pictures = !video && total > 0 && done === total ? state.rows.flatMap((g) => g.outputs.filter((o) => o.kind === "image")) : [];
+ // A still set (Stills · 8 views): once every one is drawn, the front first, then the views in the run's order, each named.
+ const drawn =
+ !video && total > 0 && done === total
+ ? [...state.rows]
+ .sort((a, b) => (a.request.step?.index ?? 0) - (b.request.step?.index ?? 0))
+ .flatMap((g) => g.outputs.filter((o) => o.kind === "image").map((o) => ({ url: o.url, label: g.request.step?.label?.startsWith("Front view") ? "Front" : (g.request.step?.label ?? "") })))
+ : [];
+ const pictures = drawn.length ? [...(front ? [{ url: front, label: "Front" }] : []), ...drawn] : [];
return (
<>
<DialogHeader>
@@ -469,9 +482,10 @@ function RunView({ heading, state, elementId, onAgain }: { heading: string; stat
{pictures.length > 0 ? (
<div className="grid grid-cols-3 gap-1.5 sm:grid-cols-4">
{pictures.map((o) => (
- <a key={o.url} href={o.url} target="_blank" rel="noreferrer" className="overflow-hidden rounded-lg bg-muted">
+ <a key={o.url} href={o.url} target="_blank" rel="noreferrer" className="group relative overflow-hidden rounded-lg bg-muted">
{/* eslint-disable-next-line @next/next/no-img-element */}
- <img src={o.url} alt="" className="aspect-[3/4] w-full object-cover" />
+ <img src={o.url} alt={o.label} className="aspect-[3/4] w-full object-cover" />
+ {o.label && <span className="absolute inset-x-0 bottom-0 bg-black/55 px-1.5 py-0.5 text-[11.5px] font-medium text-white">{o.label}</span>}
</a>
))}
</div>
diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.ts
index a83a31cd..5a803af9 100644
--- a/src/lib/catalog/canvas.ts
+++ b/src/lib/catalog/canvas.ts
@@ -1774,10 +1774,12 @@ export interface CanvasTemplate {
hue: number;
/** The picker's section ("Effects 2.0 chains"); none: the workflows. */
group?: string;
- build: (engine: Engine) => CanvasGraph;
+ /** `offered`: whether the install offers a model (Settings → Models & licences); a node falls back when it doesn't. */
+ build: (engine: Engine, offered?: (id: string) => boolean) => CanvasGraph;
}
-type ModelPair = { cloud: string; open: string };
+/** A node's model on each engine; `fallback`, the model it takes on an engine whose own isn't offered (without `on`). */
+type ModelPair = { cloud: string; open: string; fallback?: Partial<Record<Engine, string>> };
interface TplNode {
id: string;
@@ -1786,24 +1788,25 @@ interface TplNode {
y: number;
data?: CanvasNodeData;
models?: ModelPair;
- /** What changes on one engine (the product angles' QMA · 96 views on your GPU: its pose and shorter words). */
+ /** What changes on one engine (the product angles' QMA · 96 views on your GPU: its pose). */
on?: Partial<Record<Engine, CanvasNodeData>>;
width?: number;
}
-/** The product angles' words on QMA · 96 views, after its camera words. */
-const QMA_STUDIO = "on a seamless studio background, soft key light, sharp details";
-
-function tpl(nodes: TplNode[], edges: [string, string, string?][]): (engine: Engine) => CanvasGraph {
- return (engine) => {
+function tpl(nodes: TplNode[], edges: [string, string, string?][]): (engine: Engine, offered?: (id: string) => boolean) => CanvasGraph {
+ return (engine, offered) => {
const graph: CanvasGraph = {
- nodes: nodes.map((t) => ({
- id: t.id,
- type: t.type,
- position: { x: t.x, y: t.y },
- data: { ...t.data, ...t.on?.[engine], ...(t.models && { modelId: t.models[engine] }) },
- ...(t.width && { width: t.width }),
- })),
+ nodes: nodes.map((t) => {
+ const own = t.models?.[engine];
+ const fallback = own && offered && !offered(own) ? t.models?.fallback?.[engine] : undefined;
+ return {
+ id: t.id,
+ type: t.type,
+ position: { x: t.x, y: t.y },
+ data: { ...t.data, ...(!fallback && t.on?.[engine]), ...(own && { modelId: fallback ?? own }) },
+ ...(t.width && { width: t.width }),
+ };
+ }),
edges: [],
};
graph.edges = edges.map(([source, target, handle], i) => ({
@@ -1918,11 +1921,11 @@ export const CANVAS_TEMPLATES: CanvasTemplate[] = [
build: tpl(
[
{ id: "product", type: "image-input", x: 0, y: ROW, data: { label: "Product photo" } },
- // On your GPU the three angles are QMA · 96 views (qma-angles): the camera itself turns (its pose in params.extra), the
- // words only set the studio look.
- { id: "front", type: "model", x: COL, y: 0, data: { mediaKind: "image", label: "Front ¾ angle", op: "edit", prompt: "The same product from a three-quarter front angle on a seamless studio background, soft key light, sharp details" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL }, on: { open: { prompt: QMA_STUDIO, params: { extra: { horizontal_angle: 45, vertical_angle: 30, zoom: 5 } } } } },
- { id: "side", type: "model", x: COL, y: ROW, data: { mediaKind: "image", label: "Side profile", op: "edit", prompt: "The same product in a clean side profile on a seamless studio background, rim light, sharp details" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL }, on: { open: { prompt: QMA_STUDIO, params: { extra: { horizontal_angle: 90, vertical_angle: 0, zoom: 5 } } } } },
- { id: "top", type: "model", x: COL, y: ROW * 2, data: { mediaKind: "image", label: "Top-down", op: "edit", prompt: "The same product shot top-down as a flat lay on a seamless studio background, even light" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL }, on: { open: { prompt: QMA_STUDIO, params: { extra: { horizontal_angle: 0, vertical_angle: 60, zoom: 5 } } } } },
+ // On your GPU the three angles are QMA · 96 views (qma-angles): the camera itself turns (its pose in params.extra) and
+ // the words follow its camera words, so a board switched to the cloud keeps each angle. Without QMA offered: Qwen-Image 2.1.
+ { id: "front", type: "model", x: COL, y: 0, data: { mediaKind: "image", label: "Front ¾ angle", op: "edit", prompt: "The same product from a three-quarter front angle on a seamless studio background, soft key light, sharp details" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL, fallback: { open: "oss-qwen-image-21" } }, on: { open: { params: { extra: { horizontal_angle: 45, vertical_angle: 30, zoom: 5 } } } } },
+ { id: "side", type: "model", x: COL, y: ROW, data: { mediaKind: "image", label: "Side profile", op: "edit", prompt: "The same product in a clean side profile on a seamless studio background, rim light, sharp details" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL, fallback: { open: "oss-qwen-image-21" } }, on: { open: { params: { extra: { horizontal_angle: 90, vertical_angle: 0, zoom: 5 } } } } },
+ { id: "top", type: "model", x: COL, y: ROW * 2, data: { mediaKind: "image", label: "Top-down", op: "edit", prompt: "The same product shot top-down as a flat lay on a seamless studio background, even light" }, models: { cloud: "nano-banana-pro", open: QMA_MODEL, fallback: { open: "oss-qwen-image-21" } }, on: { open: { params: { extra: { horizontal_angle: 0, vertical_angle: 60, zoom: 5 } } } } },
{ id: "video", type: "model", x: COL * 2, y: ROW - 40, data: { mediaKind: "video", label: "Ad clip", op: "ref2v", prompt: "A premium product commercial: the camera orbits the product from the reference angles, studio lighting, slow and smooth", params: { aspectRatio: "16:9", duration: 5 } }, models: { cloud: "seedance-2-5", open: "oss-wan-vace" } },
{ id: "out", type: "output", x: COL * 3, y: ROW, data: { label: "Ad" } },
],
diff --git a/src/lib/catalog/turnaround.ts b/src/lib/catalog/turnaround.ts
index ff9624f7..69c2dadb 100644
--- a/src/lib/catalog/turnaround.ts
+++ b/src/lib/catalog/turnaround.ts
@@ -15,7 +15,7 @@
*/
import { DEFAULT_MOTION, PATH_PRESETS, presetKeys, type CameraKey } from "@/lib/camera-path";
import { poseWords } from "@/lib/scene3d";
-import { QMA_MODEL, QMA_TURN_SET, qmaLabel, qmaPose } from "@/lib/qma";
+import { QMA_AZIMUTH_LABELS, QMA_MODEL, qmaAzimuth } from "@/lib/qma";
import { getModel, getPreset } from "./index";
import { onEngine } from "./engines";
import { FRAMES_MODELS, chainGapProblem, chainTiming, frameTimes } from "./keyframes";
@@ -95,6 +95,17 @@ export function qmaHorizontal(side: TurnSide): number {
return (360 - viewAzimuth(side)) % 360;
}
+/**
+ * A still's name by the person's own side (Character Sheet's way), for QMA's camera angle `horizontal`: the camera at 90°
+ * (QMA's "right side view") shows the person's left side. The camera's words stay in the prompt only.
+ */
+export function qmaStillName(horizontal: number): string {
+ return QMA_AZIMUTH_LABELS[qmaAzimuth(360 - horizontal)];
+}
+
+/** The still set's camera angles, going round the person to their right: front right, right side, … front left. */
+export const QMA_STILL_ANGLES: readonly number[] = [1, 2, 3, 4, 5, 6, 7].map((i) => (360 - i * 45) % 360);
+
// ---------------------------------------------------------------------------
// Routes
@@ -516,19 +527,18 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
if (stills) {
// Eight eye-level pictures round the person, each drawn from the front view; the front's own picture stays the first.
const src = sourceOf("front");
- const turns = QMA_TURN_SET.filter((v) => v.azimuth !== "front view");
+ const turns = QMA_STILL_ANGLES;
frames = src ? [{ side: "front", from: fromOf(src, "front"), ...("url" in src && { url: src.url }) }] : [];
- for (const v of turns) {
- const pose = qmaPose(v);
+ for (const h of turns) {
const request: GenerationRequest = {
feature,
modelId: model.id,
op: "edit",
prompt: withWords(FILL_KEEP, input.prompt),
- title: `${title.replace(/^Turnaround/, "Turnaround stills")} · ${qmaLabel(v).split(" · ")[0]}`,
- params: { numOutputs: 1, extra: { horizontal_angle: pose.horizontal, vertical_angle: pose.vertical, zoom: pose.zoom }, ...seed },
+ title: `${title.replace(/^Turnaround/, "Turnaround stills")} · ${qmaStillName(h)}`,
+ params: { numOutputs: 1, extra: { horizontal_angle: h, vertical_angle: 0, zoom: 5 }, ...seed },
};
- const key = `still-${pose.horizontal}`;
+ const key = `still-${h}`;
if (src && "key" in src) steps.push({ key, request: { ...request, chain: [{ slot: "images" }] }, after: [src.key] });
else steps.push({ key, request: { ...request, ...(src && { inputs: { images: [src.url] } }) } });
}
@@ -637,7 +647,7 @@ export function planTurnaround(input: TurnaroundInput, ctx: TurnaroundContext =
k === "front"
? "Front view from the sheet"
: k.startsWith("still-")
- ? qmaLabel(QMA_TURN_SET[Number(k.slice(6)) / 45]).split(" · ")[0]
+ ? qmaStillName(Number(k.slice(6)))
: `${SIDE_NAMES[k.slice(5) as TurnSide]} (${byQma ? "QMA" : "Angles"})`;
const total = steps.length + (main ? 1 : 0);
steps.forEach((s, i) => (s.request.step = { label: stepLabel(s.key), index: i, of: total }));
diff --git a/src/lib/qma.ts b/src/lib/qma.ts
index 51be9cd8..cfbfb022 100644
--- a/src/lib/qma.ts
+++ b/src/lib/qma.ts
@@ -161,7 +161,20 @@ export function qmaPoseOf(extra: Record<string, unknown> | undefined): ScenePose
*/
export function qmaRunPrompt(words: string, extra: Record<string, unknown> | undefined): string {
if (parseQmaPrompt(words)) return words.trim();
- return qmaPrompt(qmaView(qmaPoseOf(extra)), words.replace(QMA_TRIGGER, "").trim());
+ const pose = qmaView(qmaPoseOf(extra));
+ const s = words.trim();
+ if (!s.startsWith(QMA_TRIGGER)) return qmaPrompt(pose, s.replaceAll(QMA_TRIGGER, "").trim());
+ // A partial QMA prompt ("<qma> back view …"): the camera words it gives hold, the pose fills only the missing ones.
+ let rest = s.slice(QMA_TRIGGER.length).trimStart();
+ const take = <T extends string>(list: readonly T[]): T | undefined => {
+ const hit = phrase(list, rest) as T | undefined;
+ if (hit) rest = rest.slice(hit.length).trimStart();
+ return hit;
+ };
+ const azimuth = take(QMA_AZIMUTHS) ?? pose.azimuth;
+ const elevation = take(QMA_ELEVATIONS) ?? pose.elevation;
+ const distance = take(QMA_DISTANCES) ?? pose.distance;
+ return qmaPrompt({ azimuth, elevation, distance }, rest.replaceAll(QMA_TRIGGER, "").replace(/^[\s.,;:]+/, "").trim());
}
/**
diff --git a/src/server/canvas.ts b/src/server/canvas.ts
index a9dc3520..1149de72 100644
--- a/src/server/canvas.ts
+++ b/src/server/canvas.ts
@@ -47,6 +47,7 @@ import type { Engine, Generation, GenerationRequest, MediaKind } from "@/lib/cat
import { createPipeline } from "./chains";
import { db } from "./db";
import { listElements } from "./elements";
+import { isOffered } from "./model-access";
import { createGenerations, getGeneration } from "./generations";
import { silentWav } from "./marketing";
import { engineMode } from "./settings";
@@ -377,7 +378,7 @@ export function createCanvas(input: CreateCanvasInput = {}): Canvas {
// A locked install only ever gets the variant it can run.
const mode = engineMode();
const engine: Engine = mode === "both" ? (input.engine ?? "cloud") : mode;
- const graph = template ? template.build(engine) : (input.graph ?? EMPTY_GRAPH);
+ const graph = template ? template.build(engine, (id) => isOffered(id, engine)) : (input.graph ?? EMPTY_GRAPH);
const pages = !template && input.pages?.length ? input.pages : [{ id: FIRST_PAGE_ID, name: pageName(0), graph: cleanGraph(graph) }];
const now = Date.now();
const row: Row = {
diff --git a/tests/e2e/qma-angles.mjs b/tests/e2e/qma-angles.mjs
index a9d2623e..dd37b01f 100644
--- a/tests/e2e/qma-angles.mjs
+++ b/tests/e2e/qma-angles.mjs
@@ -133,12 +133,28 @@ for (const [size, scheme] of [
const make = dialog.getByRole("button", { name: /Make 8 views/ });
await until(async () => !(await make.isDisabled()), "Make 8 views", 20_000);
await make.click();
- await until(async () => (await dialog.locator("img").count()) >= 7 && /Your views are ready/.test(await dialog.innerText()), "the still set", 120_000).then(
- () => check(`${tag}: the 7 drawn views show when they're done`, true),
- () => check(`${tag}: the 7 drawn views show when they're done`, false),
+ await until(async () => (await dialog.locator("a img").count()) >= 8 && /Your views are ready/.test(await dialog.innerText()), "the still set", 120_000).then(
+ () => check(`${tag}: all 8 views show when they're done, the front first`, true),
+ () => check(`${tag}: all 8 views show when they're done, the front first`, false),
);
+ const names = await dialog.locator("a img").evaluateAll((els) => els.map((e) => e.getAttribute("alt")));
+ check(`${tag}: each view is named by the person's side, going round`, names.join(",") === "Front,Front right,Right side,Back right,Back,Back left,Left side,Front left", names.join(","));
await shoot(page, "stills-done");
}
+ if (scheme === "light") {
+ // The pre-flight board's link starts the dialog on the still set.
+ await page.keyboard.press("Escape");
+ await page.goto(`${app}/character-sheet?stills=1`, { waitUntil: "load", timeout: 120_000 });
+ const again = page.getByRole("button", { name: /^Turnaround video/ });
+ await again.waitFor({ timeout: 60_000 });
+ await again.click();
+ const r2 = page.getByRole("dialog").getByRole("radiogroup", { name: "Route" });
+ await r2.waitFor({ timeout: 30_000 });
+ await until(async () => (await r2.getByRole("radio", { name: "Stills · 8 views" }).getAttribute("aria-checked")) === "true", "stills from the link", 20_000).then(
+ () => check(`${tag}: ?stills=1 opens the dialog on Stills · 8 views`, true),
+ () => check(`${tag}: ?stills=1 opens the dialog on Stills · 8 views`, false),
+ );
+ }
await page.keyboard.press("Escape");
check(`${tag}: no console errors`, errors.length === 0, errors.slice(0, 3).join(" | "));
await ctx.close();
diff --git a/tests/hosted-runs.test.ts b/tests/hosted-runs.test.ts
index 8080185c..491e31e7 100644
--- a/tests/hosted-runs.test.ts
+++ b/tests/hosted-runs.test.ts
@@ -128,6 +128,23 @@ describe("hosted runs on", () => {
expect((await visitorStatus(auth.accountById(a)!)).viewer.hosted).toBeUndefined();
});
+ it("QMA · 96 views (an edit with its own LoRA in the recipe) plans and prices on this install's GPU", async () => {
+ process.env.FUOBE_BILLING_URL = fake.url;
+ process.env.FUOBE_BILLING_TOKEN = "test-billing-token";
+ const up = (await (await upload(TINY_PNG, "image/png", "product.png")).json()) as { url: string };
+ const { decidePlace, poolQuote } = await import("@/server/hosted-run");
+ const { QMA_MODEL } = await import("@/lib/qma");
+ const req = { feature: "image", modelId: QMA_MODEL, op: "edit" as const, prompt: "studio light", inputs: { images: [up.url] }, params: { numOutputs: 1, extra: { horizontal_angle: 180, vertical_angle: 0, zoom: 5 } } };
+ const place = await decidePlace(auth.accountById(a)!, req, undefined);
+ expect(place.kind).toBe("pool");
+ if (place.kind !== "pool") return;
+ expect(place.planned.model.id).toBe(QMA_MODEL);
+ expect(place.planned.route.provider).toBe("comfyui");
+ const quoted = await poolQuote(auth.accountById(a)!, req, undefined);
+ expect(quoted?.planned.model.id).toBe(QMA_MODEL);
+ expect(quoted?.quote).toBeTruthy();
+ });
+
it("the pool's allow and deny lists, for models and apps", () => {
expect(poolAllows({ pool: {} }, "m")).toBe(true);
expect(poolAllows({ pool: { allow: ["m"] } }, "m")).toBe(true);
diff --git a/tests/qma-angles.test.ts b/tests/qma-angles.test.ts
index f22b8816..2b9c5c3f 100644
--- a/tests/qma-angles.test.ts
+++ b/tests/qma-angles.test.ts
@@ -18,7 +18,7 @@ const { appModels } = await import("@/lib/catalog/preset-recipe-routes");
const { libraryEntry } = await import("@/lib/catalog/loras");
const { planCinema, RECOMPOSE_MODELS } = await import("@/lib/catalog/cinema");
const { planTurnaround, qmaHorizontal, ROUTES_ON, TURN_ROUTES, anglesHorizontal } = await import("@/lib/catalog/turnaround");
-const { CANVAS_TEMPLATES } = await import("@/lib/catalog/canvas");
+const { CANVAS_TEMPLATES, convertEngine } = await import("@/lib/catalog/canvas");
const { QMA_MODEL, QMA_WORKFLOW, parseQmaPrompt } = await import("@/lib/qma");
const { STUDIO_ROWS, studioTool } = await import("@/server/gpu/tools");
const { modelLicence } = await import("@/server/model-access");
@@ -183,7 +183,11 @@ describe("the turnaround", () => {
expect(plan.route).toBe("stills");
expect(plan.blocker).toBeUndefined();
expect(plan.steps).toHaveLength(7);
- expect(plan.steps.map((s) => s.request.params?.extra?.horizontal_angle)).toEqual([45, 90, 135, 180, 225, 270, 315]);
+ // Named by the person's own sides, going round to their right; QMA's camera turns the other way (as the fill's qmaHorizontal).
+ expect(plan.steps.map((s) => s.request.params?.extra?.horizontal_angle)).toEqual([315, 270, 225, 180, 135, 90, 45]);
+ expect(plan.steps.find((s) => s.request.step?.label === "Right side")!.request.params?.extra?.horizontal_angle).toBe(qmaHorizontal("right"));
+ expect(plan.steps.find((s) => s.request.step?.label === "Left side")!.request.params?.extra?.horizontal_angle).toBe(qmaHorizontal("left"));
+ expect(plan.steps[1].request.title).toBe("Turnaround stills · Ada · Right side");
expect(plan.steps.every((s) => s.request.modelId === QMA_MODEL && s.request.inputs?.images?.[0] === "/api/files/front.png" && s.request.feature === "turnaround")).toBe(true);
expect(plan.steps.map((s) => s.request.step?.label)).toEqual(["Front right", "Right side", "Back right", "Back", "Back left", "Left side", "Front left"]);
expect(plan.steps[3].request.title).toBe("Turnaround stills · Ada · Back");
@@ -221,10 +225,27 @@ describe("the Canvas product angles and the GPU board", () => {
}
const top = open.nodes.find((n) => n.id === "top")!;
expect(planGeneration({ feature: "canvas", modelId: QMA_MODEL, prompt: top.data.prompt ?? "", inputs: { images: ["/api/files/p.png"] }, params: top.data.params }, getModel, getPreset).prompt).toBe(
- "<qma> front view high-angle shot medium shot on a seamless studio background, soft key light, sharp details",
+ "<qma> front view high-angle shot medium shot The same product shot top-down as a flat lay on a seamless studio background, even light",
);
});
+ it("keeps each angle's words when the board moves to the cloud, and falls back when QMA is switched off", () => {
+ const t = CANVAS_TEMPLATES.find((x) => x.id === "product-angles")!;
+ const moved = convertEngine(t.build("open"), "cloud").graph;
+ const prompts = ["front", "side", "top"].map((id) => moved.nodes.find((n) => n.id === id)!.data.prompt);
+ expect(new Set(prompts).size).toBe(3);
+ expect(prompts[0]).toMatch(/three-quarter front/);
+ expect(prompts[1]).toMatch(/side profile/);
+ expect(prompts[2]).toMatch(/top-down/);
+ const off = t.build("open", (id) => id !== QMA_MODEL);
+ for (const id of ["front", "side", "top"]) {
+ const n = off.nodes.find((x) => x.id === id)!;
+ expect(n.data.modelId).toBe("oss-qwen-image-21");
+ expect(n.data.params?.extra).toBeUndefined();
+ }
+ expect(t.build("open", () => true).nodes.find((n) => n.id === "side")!.data.modelId).toBe(QMA_MODEL);
+ });
+
it("gives the 8-view stills a row on the pre-flight board", () => {
const row = STUDIO_ROWS.find((r) => r.label === "Turnaround stills · 8 views")!;
expect(row).toBeDefined();
diff --git a/tests/qma-prompt.test.ts b/tests/qma-prompt.test.ts
index af98579e..f0be6718 100644
--- a/tests/qma-prompt.test.ts
+++ b/tests/qma-prompt.test.ts
@@ -92,6 +92,10 @@ describe("snapping a pose", () => {
expect(qmaRunPrompt("", {})).toBe("<qma> front-right quarter view eye-level shot medium shot");
// A trigger with no camera words after it isn't a QMA prompt: the pose's words go in, the stray trigger out.
expect(qmaRunPrompt("<qma> a red car", { horizontal_angle: 180 })).toBe("<qma> back view eye-level shot medium shot a red car");
+ // A partial QMA prompt keeps the camera words it gives; the pose fills only the missing ones.
+ expect(qmaRunPrompt("<qma> back view", {})).toBe("<qma> back view eye-level shot medium shot");
+ expect(qmaRunPrompt("<qma> left side view high-angle shot, at night", { horizontal_angle: 0, zoom: 10 })).toBe("<qma> left side view high-angle shot close-up at night");
+ expect(qmaRunPrompt("<qma> wide shot a red car", { horizontal_angle: 90 })).toBe("<qma> right side view eye-level shot wide shot a red car");
});
});