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.

N7-6 fixes: Soul Cast films the picked variant, request ids work on a LAN address, browser checks that can fail

Claudef2a22469d490
diff --git a/src/components/cinema/soul-builders.tsx b/src/components/cinema/soul-builders.tsx
index 7751f443..3caa232c 100644
--- a/src/components/cinema/soul-builders.tsx
+++ b/src/components/cinema/soul-builders.tsx
@@ -360,7 +360,8 @@ function CastTurnaround({ projectId, folderId, engine, name, results, picked }:
<p className="min-w-0 flex-1 text-[12px] text-muted-foreground">{picked ? "Film the picked variant all the way round, as a new take." : "Film the first variant all the way round, as a new take."}</p>
<TurnaroundButton
key={g.id}
- pictures={sheetPictures(g)}
+ // The picked variant is the sheet the dialog starts on (a cloud batch is one generation with every variant).
+ pictures={sheetPictures(g, picked)}
name={name}
engine={engine}
fictional
diff --git a/src/components/turnaround/turnaround-dialog.tsx b/src/components/turnaround/turnaround-dialog.tsx
index 8de9d51f..21246ed4 100644
--- a/src/components/turnaround/turnaround-dialog.tsx
+++ b/src/components/turnaround/turnaround-dialog.tsx
@@ -5,6 +5,7 @@ import { AlertTriangle, Check, ImageOff, Loader2, Rotate3d, Sparkles } from "luc
import Link from "next/link";
import { useEffect, useMemo, useState } from "react";
import { toast } from "sonner";
+import { useSubmitGuard } from "@/components/shorts/hooks";
import { EngineSwitch } from "@/components/studio/engine-switch";
import { radioKeys, radioTab } from "@/components/studio/radio-keys";
import { Button } from "@/components/ui/button";
@@ -170,8 +171,10 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
const setDuration = (d: number) => setPicked((x) => ({ ...(x.engine === engine ? x : { engine }), duration: d }));
const [path, setPath] = useState<string | undefined>(undefined);
const [aspectRatio, setAspect] = useState<"9:16" | "16:9">("9:16");
- const [realPerson, setReal] = useState(realDefault);
+ // A character is a person whatever the switch says: the server asks for its consent line (or has it on file).
+ const [realPerson, setReal] = useState(realDefault || !!elementId);
const [consent, setConsent] = useState(false);
+ const guard = useSubmitGuard();
const body: TurnaroundBody = {
engine,
@@ -194,11 +197,15 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
});
const p = preview.data;
const make = useMutation({
- mutationFn: async (b: TurnaroundBody) => (onRun ? onRun(b) : (await post<{ items: Generation[] }>("/api/turnaround", { ...b, requestId: crypto.randomUUID() })).items),
- // The film: the joined clips, else the one video the run makes (the pictures drawn first are stills).
- onSuccess: (items) => onStarted({ ids: items.map((g) => g.id), filmId: (items.find((g) => g.op === "concat") ?? items.find((g) => g.kind === "video") ?? items[0])?.id }),
+ // The request id stays the same for the same body until it succeeds, so a repeat (a lost answer, a second click)
+ // gets the first run. useSubmitGuard's id, not crypto.randomUUID: that is missing on a plain-http LAN address.
+ 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 }),
onError: (e) => toast.error((e as Error).message),
});
+ const makeIt = () => void guard(JSON.stringify(body), (requestId) => make.mutateAsync({ b: body, requestId })).catch(() => {});
const usedRoute = p?.route ?? route;
const camera = usedRoute === "camera";
@@ -318,11 +325,20 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
{!fictional && (
<section aria-label="Consent" className="space-y-2 rounded-xl border p-3">
- <label className="flex items-center justify-between gap-3">
- <span className="text-[13px] font-medium">A real person</span>
- <Switch checked={realPerson} onCheckedChange={setReal} aria-label="These pictures show a real person" />
- </label>
- {realPerson ? (
+ {elementId ? (
+ // A character always is a person, as for a Soul ID: no switch to turn it off.
+ <p className="text-[13px] font-medium">Consent</p>
+ ) : (
+ <label className="flex items-center justify-between gap-3">
+ <span className="text-[13px] font-medium">A real person</span>
+ <Switch checked={realPerson} onCheckedChange={setReal} aria-label="These pictures show a real person" />
+ </label>
+ )}
+ {p?.consent === "on-file" ? (
+ <p className="flex items-start gap-1.5 text-[12px] leading-snug text-muted-foreground">
+ <Check className="mt-0.5 size-3.5 shrink-0" aria-hidden /> Confirmed when {name ?? "this character"} was trained for Soul ID: {SOUL_ID_COPY.consent}
+ </p>
+ ) : realPerson ? (
<label className="flex items-start gap-2 text-[12px] leading-snug text-muted-foreground">
<Checkbox checked={consent} onCheckedChange={(v) => setConsent(v === true)} className="mt-0.5" aria-label="I confirm the consent line" />
<span>{SOUL_ID_COPY.consent}</span>
@@ -360,7 +376,7 @@ function TurnaroundForm({ pictures, name, realPerson: realDefault = false, eleme
<span className="font-mono text-[12px] whitespace-nowrap text-muted-foreground" aria-live="polite">
{preview.isFetching && !p ? "Pricing…" : price}
</span>
- <Button onClick={() => make.mutate(body)} disabled={!p || !!p.blocker || preview.isError || make.isPending || preview.isFetching}>
+ <Button onClick={makeIt} disabled={!p || !!p.blocker || preview.isError || make.isPending || preview.isFetching}>
{make.isPending ? <Loader2 className="animate-spin" /> : <Rotate3d />} {flyAround ? "Fly around" : "Make turnaround"}
</Button>
</div>
diff --git a/tests/e2e/turnaround.mjs b/tests/e2e/turnaround.mjs
index 4947e2a4..113d3268 100644
--- a/tests/e2e/turnaround.mjs
+++ b/tests/e2e/turnaround.mjs
@@ -129,7 +129,8 @@ for (const [size, scheme] of [
const text = await dialog.innerText();
check(`${tag}: the five slots (Front, Right side, Back, Left side, Sheet)`, ["Front", "Right side", "Back", "Left side", "Sheet"].every((s) => text.includes(s)), text.slice(0, 200));
check(`${tag}: the person's own left and right are explained`, /their right side is on your left/.test(text));
- check(`${tag}: the price or GPU line shows before running`, true, await price.innerText());
+ const priceText = await price.innerText();
+ check(`${tag}: the price or GPU line shows before running`, (engine === "open" ? /Free · on your GPU|Demo · free/ : /Demo · free|≈ \$\d/).test(priceText), priceText);
check(`${tag}: the consent line is asked for (photos someone brought)`, /I consent to this biometric data processing/.test(text));
const make = dialog.getByRole("button", { name: /Make turnaround/ });
check(`${tag}: Make turnaround waits for the consent line`, await make.isDisabled());
@@ -143,10 +144,21 @@ for (const [size, scheme] of [
);
if (phone) check(`${tag}: a finger drag scrolls the dialog`, await fingerScroll(page, dialog));
await shoot(page, `sheet-dialog-${size}-${scheme}`);
- // Switch the sides off: the film goes front → back → front; switch them back on.
- await dialog.getByRole("switch", { name: "Draw the missing sides" }).click();
- await until(async () => /Front view|left out|Drawn first/.test(await dialog.innerText()) || true, "the plan");
- await dialog.getByRole("switch", { name: "Draw the missing sides" }).click();
+ // Flip "Draw the missing sides": the right side's slot goes from drawn first to not used (or back), then returns.
+ const fillSwitch = dialog.getByRole("switch", { name: "Draw the missing sides" });
+ const rightSlot = dialog.getByRole("button", { name: /^Right side: / });
+ const slotState = async () => (await rightSlot.getAttribute("aria-label")).replace(/^Right side: | — change$/g, "");
+ const was = { on: await fillSwitch.getAttribute("aria-checked"), slot: await slotState() };
+ await fillSwitch.click();
+ const flipped = await until(
+ async () => ((await fillSwitch.getAttribute("aria-checked")) !== was.on && (await slotState()) !== was.slot ? await slotState() : null),
+ "the plan to change with Draw the missing sides",
+ 20_000,
+ ).catch(() => null);
+ check(`${tag}: Draw the missing sides changes the plan (right side: ${was.slot} → ${flipped ?? "unchanged"})`, !!flipped && /drawn first|not used/.test(`${was.slot} ${flipped}`));
+ await fillSwitch.click();
+ const back = await until(async () => ((await slotState()) === was.slot ? true : null), "the plan to return", 20_000).catch(() => false);
+ check(`${tag}: switching it back restores the plan`, back);
if (engine === "cloud") {
const routes = dialog.getByRole("radiogroup", { name: "Route" });
await routes.waitFor();
@@ -163,8 +175,10 @@ for (const [size, scheme] of [
await make.click();
await dialog.getByRole("status").first().waitFor();
check(`${tag}: progress shows while it renders`, /steps done/.test(await dialog.innerText()));
- await dialog.locator("video").waitFor({ timeout: 120_000 });
- check(`${tag}: the film plays in the dialog when it's done`, true);
+ const film = dialog.locator("video");
+ await film.waitFor({ timeout: 120_000 });
+ const filmSrc = await film.getAttribute("src");
+ check(`${tag}: the film is in the dialog when it's done`, !!filmSrc && filmSrc.startsWith("/api/files/"), filmSrc ?? "no src");
await shoot(page, "sheet-done");
const lib = (await call("/api/generations?features=turnaround&limit=10")).items ?? [];
check(`${tag}: the film is in the feed (Turnaround · in the Library's list)`, lib.some((g) => g.op === "concat" && g.status === "succeeded"), JSON.stringify(lib.map((g) => [g.op, g.status])));
@@ -190,6 +204,8 @@ for (const [size, scheme] of [
await flyDialog.getByRole("radio", { name: "Tilted ring" }).click();
check(`${tag}: a move is picked`, (await flyDialog.getByRole("radio", { name: "Tilted ring" }).getAttribute("aria-checked")) === "true");
}
+ const flyText = await flyDialog.innerText();
+ check(`${tag}: a character always asks the consent line (no "A real person" switch to turn it off)`, /I consent to this biometric data processing/.test(flyText) && !(await flyDialog.getByRole("switch", { name: "These pictures show a real person" }).count()));
check(`${tag}: no sideways scroll with Fly around open`, (await sideways(page)) <= 1);
if (phone) check(`${tag}: a finger drag scrolls Fly around`, await fingerScroll(page, flyDialog));
await shoot(page, `fly-${size}-${scheme}`);
@@ -204,6 +220,10 @@ for (const [size, scheme] of [
return items.find((g) => g.op === "camera-path") ?? null;
}, "the fly-around in the character's feed");
check(`${tag}: Fly around lands in the character's feed`, !!feed, feed?.modelId);
+ // The cloud run's film comes back to the dialog too (the demo provider stands in for fal).
+ const flyFilm = flyDialog.locator("video");
+ await flyFilm.waitFor({ timeout: 120_000 });
+ check(`${tag}: the cloud film shows in the dialog`, ((await flyFilm.getAttribute("src")) ?? "").startsWith("/api/files/"));
}
await page.keyboard.press("Escape");