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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
AI Influencer builder: Save as character takes the run's face and name; rail orientation and copy
Claude497104375e30
diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsxindex 6059a21c..0d522567 100644--- a/src/components/fashion/character-sheet.tsx+++ b/src/components/fashion/character-sheet.tsx@@ -280,7 +280,7 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldDatahref="/influencer"className="inline-flex items-center gap-1.5 rounded-full bg-muted px-3 py-1 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none">- <Dices className="size-3.5" aria-hidden /> Build one game-style in the AI Influencer builder: 19 categories, creatures, Shuffle+ <Dices className="size-3.5" aria-hidden /> Build one game-style in the AI Influencer builder: 18 categories, creatures, Shuffle</Link>)}diff --git a/src/components/influencer/influencer-builder.tsx b/src/components/influencer/influencer-builder.tsxindex 31a46635..b71b8110 100644--- a/src/components/influencer/influencer-builder.tsx+++ b/src/components/influencer/influencer-builder.tsx@@ -2,7 +2,7 @@import { Dices, ImagePlus, Loader2, RotateCcw, Sparkles, TriangleAlert, Info, X } from "lucide-react";import Link from "next/link";-import { useEffect, useMemo, useRef, useState } from "react";+import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";import { toast } from "sonner";import { SaveCharacter } from "@/components/fashion/character-sheet";import { PageHeader, PageShell } from "@/components/page-shell";@@ -20,6 +20,7 @@ import {categoriesFor,CREATURE_TYPES,describeInfluencer,+ faceOfRun,FEATURE,HUMAN_TIERS,INFLUENCER_START,@@ -51,6 +52,19 @@ const CLOUD_MODELS: { id: string; label: string; note: string }[] = [{ id: "seedream-5-pro", label: "Seedream 5.0 Pro", note: "Photoreal, from the same picks" },];+/** The rail is a column from the lg breakpoint up and a sideways scroller below it: its tablist says which. */+const WIDE = "(min-width: 1024px)";+function useWide(): boolean {+ return useSyncExternalStore(+ (cb) => {+ const mql = window.matchMedia(WIDE);+ mql.addEventListener("change", cb);+ return () => mql.removeEventListener("change", cb);+ },+ () => window.matchMedia(WIDE).matches,+ () => true,+ );+}type Message = { kind: "conflict" | "note"; text: string } | null;@@ -94,13 +108,14 @@ function RunInfo({ preview, loading, blocker }: { preview?: RunPreview & { steps}/**- * /influencer: Higgsfield's AI Influencer builder, game-style. Pick a character type (three human- * tiers, six creature types), then options in 18 categories, or Shuffle; conflicts are refused in+ * /influencer: the AI Influencer builder, game-style (after Higgsfield's). Pick a character type (three+ * human tiers, six creature types), then options in 18 categories, or Shuffle; conflicts are refused in* Higgsfield's words. A live summary, a Direction, a face or reference photo and up to three* clothing references, then one character sheet to save as a character.*/export function InfluencerBuilder() {const [engine, setEngine] = useEngine();+ const wide = useWide();const [state, setState] = useState<InfluencerState>(INFLUENCER_START);const [active, setActive] = useState("tier");const [message, setMessage] = useState<Message>(null);@@ -175,7 +190,7 @@ export function InfluencerBuilder() {return (<PageShell wide>- <PageHeader title="AI Influencer" description="Build an original character, game-style: pick a look in up to 18 categories or Shuffle, then get a character sheet to save as a character.">+ <PageHeader title="AI Influencer" description="Build an original character, game-style: pick a character type, then a look in up to 18 categories or Shuffle, and get a character sheet to save as a character."><EngineSwitch value={engine} onChange={setEngine} /></PageHeader>@@ -184,7 +199,7 @@ export function InfluencerBuilder() {<divrole="tablist"aria-label="Categories"- aria-orientation="vertical"+ aria-orientation={wide ? "vertical" : "horizontal"}onKeyDown={tabKeys}className="scrollbar-none -mx-4 flex min-w-0 gap-1 overflow-x-auto px-4 lg:mx-0 lg:flex-col lg:overflow-visible lg:px-0">@@ -402,7 +417,8 @@ export function InfluencerBuilder() {className="grid-cols-1 sm:grid-cols-1 lg:grid-cols-2"onRetried={(from, to) => setIds((xs) => (xs.length ? xs.flatMap((id) => (id === from ? to : [id])) : xs))}/>- {latest && <SaveCharacter key={latest.id} item={latest} extra={start === "face" && photo && !photo.uploading ? [photo.ref] : []} defaultName={influencerName(state)} />}+ {/* The face and the name come from the run that made the sheet, not from what the page shows now. */}+ {latest && <SaveCharacter key={latest.id} item={latest} extra={[faceOfRun(latest.request)].filter((x): x is string => !!x)} defaultName={latest.request.title ?? influencerName(state)} />}</>) : (<div className="grid min-h-48 place-items-center rounded-2xl border border-dashed p-6 text-center">diff --git a/src/lib/influencer.ts b/src/lib/influencer.tsindex d805fcc1..d92a10e6 100644--- a/src/lib/influencer.ts+++ b/src/lib/influencer.ts@@ -684,6 +684,10 @@ export interface CompileInput {}const tidy = (s?: string) => s?.trim().replace(/\s+/g, " ").replace(/[.\s]+$/, "");++/** "Add your face" in each prompt: the cloud sheet takes the face as image 1, the open edit as image 2 (after the sheet). */+const FACE_ON_SHEET = "The character has the face of the person in image 1: keep their identity and facial features exactly";+const FACE_ON_EDIT = "Give the character in every view the face of the person in image 2: the same identity, facial features and skin tone";const imageList = (from: number, n: number) => (n === 1 ? `image ${from}` : `images ${list(Array.from({ length: n }, (_, i) => String(from + i)))}`);/**@@ -696,7 +700,7 @@ export function compileSheetPrompt({ state, direction, start = "scratch", clothi"Character sheet of an original AI influencer on a pure white background: a close-up portrait of the face, then full-body front, three-quarter, side profile and back views side by side",`The character: ${tidy(describeInfluencer(state))}`,tierStyle(state),- start === "face" && "The character has the face of the person in image 1: keep their identity and facial features exactly",+ start === "face" && FACE_ON_SHEET,start === "reference" && "Base the character on the one in image 1 (face and overall look), changed as described",clothing > 0 && `They wear the clothing shown in ${imageList(photo ? 2 : 1, clothing)}`,tidy(direction) && `Direction: ${tidy(direction)}`,@@ -717,7 +721,7 @@ export function compileDressPrompt({ start = "scratch", clothing = 0 }: CompileIconst photo = start !== "scratch";return ["Image 1 is a character turnaround sheet",- start === "face" && "Give the character in every view the face of the person in image 2: the same identity, facial features and skin tone",+ start === "face" && FACE_ON_EDIT,start === "reference" && "Redraw the character in every view to look like the character in image 2: their face, hair and overall look",clothing > 0 && `Dress the character in every view in the clothing shown in ${imageList(photo ? 3 : 2, clothing)}`,"Keep the poses, the layout, the number of views and the white background of image 1 unchanged",@@ -727,6 +731,17 @@ export function compileDressPrompt({ start = "scratch", clothing = 0 }: CompileI.concat(".");}+/**+ * The face an "Add your face" sheet was made with, read back from its finished request (null for From+ * scratch and From a reference): Save as character keeps it as a reference, whatever the page shows now.+ * The open engine's edit got the sheet as image 1 when it launched, so the face is image 2 there.+ */+export function faceOfRun(request: Pick<GenerationRequest, "prompt" | "inputs">): string | null {+ const images = request.inputs?.images ?? [];+ const face = request.prompt?.includes(FACE_ON_SHEET) ? images[0] : request.prompt?.includes(FACE_ON_EDIT) ? images[1] : undefined;+ return face?.startsWith("/api/files/") ? face : null;+}+/** The picks as chips for the summary: [Category label, "Option, Option"]. */export function summaryRows(state: InfluencerState): { category: string; label: string; options: string }[] {return categoriesFor(state.tier).flatMap((c) => {diff --git a/src/lib/studios.ts b/src/lib/studios.tsindex e0d5c705..f1a30cac 100644--- a/src/lib/studios.ts+++ b/src/lib/studios.ts@@ -343,7 +343,7 @@ export function appStudio(preset: Preset): StudioConfig {/** Apps whose job a studio does in more depth: linked under the hero. */const APP_RELATED: Record<string, { href: string; label: string }> = {- "app-ai-influencer": { href: "/influencer", label: "Build one game-style: 19 categories, creatures, Shuffle" },+ "app-ai-influencer": { href: "/influencer", label: "Build one game-style: 18 categories, creatures, Shuffle" },};export const MOTION_CONTROL_STUDIO: StudioConfig = {diff --git a/tests/influencer-comfy.test.ts b/tests/influencer-comfy.test.tsindex 75cd6916..46642f7b 100644--- a/tests/influencer-comfy.test.ts+++ b/tests/influencer-comfy.test.ts@@ -37,10 +37,10 @@ describe("the builder's open engine through the provider", () => {expect(at(wf, "170:151", "prompt")).toBe(compileDressPrompt({ state, start: "face", clothing: 1 }));});- it("with the face only, the third image slot is left out rather than refused", async () => {+ it("with the face only, image 3 repeats the face (the graph's third slot is always wired)", async () => {const plan = planInfluencer({ engine: "open", state, start: "face", photo: "face.png" }, {});const dress = plan.steps[1].request;const { workflow: wf } = await prepare("qwen-image-edit-2511-multi", { prompt: dress.prompt, images: ["sheet.png", ...(dress.inputs?.images ?? [])] }, "edit");- expect([at(wf, "41", "image"), at(wf, "83", "image")]).toEqual(["sheet.png", "face.png"]);+ expect([at(wf, "41", "image"), at(wf, "83", "image"), at(wf, "1201", "image")]).toEqual(["sheet.png", "face.png", "face.png"]);});});diff --git a/tests/influencer.test.ts b/tests/influencer.test.tsindex 132ed708..b98908df 100644--- a/tests/influencer.test.ts+++ b/tests/influencer.test.ts@@ -14,6 +14,7 @@ import {conflictFor,CREATURE_TYPES,describeInfluencer,+ faceOfRun,getOption,INFLUENCER_CATEGORIES,INFLUENCER_START,@@ -404,6 +405,20 @@ describe("the prompt compiler", () => {expect(compileDressPrompt({ state: s, clothing: 2 })).toContain("clothing shown in images 2 and 3");});+ it("reads the face back from a finished run, for Save as character", () => {+ const s = S("freak", { gender: ["female"] });+ const me = "/api/files/me.jpg";+ const coat = "/api/files/coat.png";+ // Cloud: the face is image 1, the clothing after it.+ expect(faceOfRun({ prompt: compileSheetPrompt({ state: s, start: "face", clothing: 1 }), inputs: { images: [me, coat] } })).toBe(me);+ // Open: the sheet went in first when the edit launched.+ expect(faceOfRun({ prompt: compileDressPrompt({ state: s, start: "face", clothing: 1 }), inputs: { images: ["/api/files/sheet.png", me, coat] } })).toBe(me);+ // A reference or clothing isn't the character's face.+ expect(faceOfRun({ prompt: compileSheetPrompt({ state: s, start: "reference" }), inputs: { images: [me] } })).toBeNull();+ expect(faceOfRun({ prompt: compileDressPrompt({ state: s, clothing: 1 }), inputs: { images: ["/api/files/sheet.png", coat] } })).toBeNull();+ expect(faceOfRun({ prompt: compileCastPrompt({ state: s }) })).toBeNull();+ });+it("summarises and names", () => {const s = S("normal", { gender: ["male"], aesthetic: ["suits"], hair: ["hair_mullet"], accessory: ["acc_glasses", "acc_hat"] });expect(summaryRows(s)).toEqual([