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.

AI Influencer builder: the /influencer page, linked from Character Sheet and the app

Claude9856a05a78ec
diff --git a/src/app/(studio)/influencer/page.tsx b/src/app/(studio)/influencer/page.tsx
new file mode 100644
index 00000000..2f4695e0
--- /dev/null
+++ b/src/app/(studio)/influencer/page.tsx
@@ -0,0 +1,8 @@
+import type { Metadata } from "next";
+import { InfluencerBuilder } from "@/components/influencer/influencer-builder";
+
+export const metadata: Metadata = { title: "AI Influencer" };
+
+export default function Page() {
+ return <InfluencerBuilder />;
+}
diff --git a/src/components/fashion/character-sheet.tsx b/src/components/fashion/character-sheet.tsx
index f3ab8481..6059a21c 100644
--- a/src/components/fashion/character-sheet.tsx
+++ b/src/components/fashion/character-sheet.tsx
@@ -1,6 +1,6 @@
"use client";
-import { AtSign, Check, ImagePlus, Loader2, RotateCcw, Shuffle, Sparkles, UserRoundPlus, X } from "lucide-react";
+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 { toast } from "sonner";
@@ -94,7 +94,7 @@ function CastForm({ fields, values, set }: { fields: CastFieldData[]; values: Ca
* a sheet that is already a character (its image is one of the character's references) shows that
* character instead, also after a reload.
*/
-function SaveCharacter({ item, extra, defaultName }: { item: Generation; extra: string[]; defaultName: string }) {
+export function SaveCharacter({ item, extra, defaultName }: { item: Generation; extra: string[]; defaultName: string }) {
const [name, setName] = useState(defaultName);
const save = useSaveElement();
const elements = useElements();
@@ -275,6 +275,15 @@ export function CharacterSheetView({ fields, defaults }: { fields: CastFieldData
</div>
)}
+ {mode !== "reference" && (
+ <Link
+ href="/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
+ </Link>
+ )}
+
<div className="flex flex-wrap items-center gap-3 rounded-2xl border p-3">
<div className="min-w-0 flex-1">
<RunLine preview={body ? preview.data : undefined} loading={preview.isFetching} />
diff --git a/src/components/influencer/influencer-builder.tsx b/src/components/influencer/influencer-builder.tsx
new file mode 100644
index 00000000..39090126
--- /dev/null
+++ b/src/components/influencer/influencer-builder.tsx
@@ -0,0 +1,418 @@
+"use client";
+
+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 { toast } from "sonner";
+import { SaveCharacter } from "@/components/fashion/character-sheet";
+import { PageHeader, PageShell } from "@/components/page-shell";
+import { useRun, useRunPreview, type RunPreview } from "@/components/photodump/hooks";
+import { ResultsGrid } from "@/components/photodump/results";
+import { UploadBox } from "@/components/photodump/upload-box";
+import { EngineSwitch } from "@/components/studio/engine-switch";
+import { fileToList, type SlotValue } from "@/components/studio/media-slot";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
+import { Button } from "@/components/ui/button";
+import { Textarea } from "@/components/ui/textarea";
+import { useEngine, useGenerations, useStatus } from "@/lib/api";
+import {
+ categoriesFor,
+ CREATURE_TYPES,
+ describeInfluencer,
+ FEATURE,
+ HUMAN_TIERS,
+ INFLUENCER_START,
+ influencerBlocker,
+ influencerName,
+ MAX_CLOTHING,
+ MAX_DIRECTION,
+ resetPicks,
+ seededRandom,
+ setTier,
+ shuffleInfluencer,
+ summaryRows,
+ togglePick,
+ toggleLock,
+ type InfluencerStart,
+ type InfluencerState,
+} from "@/lib/influencer";
+import { cn } from "@/lib/utils";
+import { CATEGORY_ICON, LockButton, OptionTiles, pickRule, TierPanel } from "./option-panel";
+
+const STARTS: [InfluencerStart, string][] = [
+ ["scratch", "From scratch"],
+ ["reference", "From a reference"],
+ ["face", "Add your face"],
+];
+
+const CLOUD_MODELS: { id: string; label: string; note: string; higgsfield?: boolean }[] = [
+ { id: "auto", label: "Best available", note: "AI Influencer with a Higgsfield key, else Nano Banana Pro" },
+ { id: "ai-influencer", label: "AI Influencer · Higgsfield", note: "Higgsfield's own character sheet, from your picks", higgsfield: true },
+ { id: "nano-banana-pro", label: "Nano Banana Pro", note: "A wide sheet from the compiled description" },
+ { id: "seedream-5-pro", label: "Seedream 5.0 Pro", note: "Photoreal, from the compiled description" },
+];
+
+type Message = { kind: "conflict" | "note"; text: string } | null;
+
+/** Arrow keys move along the rail's tabs (and pick), Home / End jump to the ends. */
+function tabKeys(e: React.KeyboardEvent<HTMLElement>) {
+ const step = ({ ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 } as Record<string, number>)[e.key];
+ if (step === undefined && e.key !== "Home" && e.key !== "End") return;
+ const tabs = [...e.currentTarget.querySelectorAll<HTMLElement>('[role="tab"]')];
+ e.preventDefault();
+ const at = tabs.indexOf(document.activeElement as HTMLElement);
+ const next = e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : (Math.max(at, 0) + step + tabs.length) % tabs.length;
+ tabs[next].focus();
+ tabs[next].click();
+}
+
+/** The body priced on the server, settled for a moment so a run of clicks prices once. */
+function useSettled<T>(value: T, ms = 250): T {
+ const [settled, setSettled] = useState(value);
+ useEffect(() => {
+ const t = setTimeout(() => setSettled(value), ms);
+ return () => clearTimeout(t);
+ }, [value, ms]);
+ return settled;
+}
+
+function RunInfo({ preview, loading, blocker }: { preview?: RunPreview & { steps?: number }; loading: boolean; blocker: string | null }) {
+ if (blocker) return <p className="text-[12.5px] text-destructive">{blocker}</p>;
+ if (!preview) return <p className="h-5 text-[12.5px] text-muted-foreground">{loading ? "Pricing…" : ""}</p>;
+ if (preview.error) return <p className="text-[12.5px] text-destructive">{preview.error}</p>;
+ const cost = preview.demo ? "Demo · free" : preview.costUsd === 0 ? "Free · your GPU" : preview.costUsd == null ? "price unknown" : `≈ $${preview.costUsd.toFixed(2)}`;
+ return (
+ <div className="space-y-0.5 text-[12.5px] text-muted-foreground" aria-live="polite">
+ <p>
+ Runs on <span className="font-medium text-foreground">{preview.modelName}</span> · 1 character sheet · <span className="font-medium text-foreground tabular-nums">{cost}</span>
+ </p>
+ {preview.notes.map((n) => (
+ <p key={n}>{n}</p>
+ ))}
+ </div>
+ );
+}
+
+/**
+ * /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
+ * 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 status = useStatus().data;
+ const higgsfield = !!status?.providers?.higgsfield?.configured;
+ const [state, setState] = useState<InfluencerState>(INFLUENCER_START);
+ const [active, setActive] = useState("tier");
+ const [message, setMessage] = useState<Message>(null);
+ const [start, setStart] = useState<InfluencerStart>("scratch");
+ const [photo, setPhoto] = useState<SlotValue | null>(null);
+ const [clothing, setClothing] = useState<SlotValue[]>([]);
+ const [direction, setDirection] = useState("");
+ const [modelId, setModelId] = useState("auto");
+ const [ids, setIds] = useState<string[]>([]);
+ const clothingInput = useRef<HTMLInputElement>(null);
+
+ const categories = useMemo(() => categoriesFor(state.tier), [state.tier]);
+ const category = categories.find((c) => c.id === active);
+ const tab = category ? category.id : "tier";
+ const summary = describeInfluencer(state);
+ const rows = summaryRows(state);
+ const tierLabel = HUMAN_TIERS.find((t) => t.id === state.tier)?.label ?? CREATURE_TYPES.find((c) => c.id === state.tier)?.label ?? "";
+
+ const uploading = !!photo?.uploading || clothing.some((c) => c.uploading);
+ const photoRef = start === "scratch" ? undefined : photo?.ref;
+ const blocker = influencerBlocker({ state, direction, start, photo: photoRef, clothing: clothing.map((c) => c.ref) });
+ const body = useMemo(
+ () =>
+ uploading
+ ? null
+ : { engine, state, direction: direction.trim() || undefined, start, photo: photoRef, clothing: clothing.map((c) => c.ref), modelId: engine === "cloud" && modelId !== "auto" ? modelId : undefined },
+ [uploading, engine, state, direction, start, photoRef, clothing, modelId],
+ );
+ const settled = useSettled(body);
+ const preview = useRunPreview("/api/influencer", blocker ? null : settled);
+ const run = useRun<NonNullable<typeof body>>("/api/influencer");
+
+ const { data } = useGenerations({ features: [FEATURE], limit: 30 });
+ // This visit's sheets; after a reload, the most recent ones.
+ const mine = useMemo(() => (ids.length ? (data ?? []).filter((g) => ids.includes(g.id)) : (data ?? []).slice(0, 2)), [data, ids]);
+ const latest = mine.find((g) => g.status === "succeeded");
+
+ const pick = (cat: string, id: string) => {
+ const r = togglePick(state, cat, id);
+ setState(r.state);
+ setMessage(r.conflict ? { kind: "conflict", text: r.conflict } : r.note ? { kind: "note", text: r.note } : null);
+ };
+ const changeTier = (tier: InfluencerState["tier"]) => {
+ const r = setTier(state, tier);
+ setState(r.state);
+ setMessage(r.dropped.length ? { kind: "note", text: `Not in ${HUMAN_TIERS.find((t) => t.id === tier)?.label ?? CREATURE_TYPES.find((c) => c.id === tier)?.label}: ${r.dropped.join(", ")} — removed` } : null);
+ };
+ const shuffle = () => {
+ setState((s) => shuffleInfluencer(s, seededRandom(Math.floor(Math.random() * 2 ** 31)), { reference: start !== "scratch" && !!photo }));
+ setMessage(null);
+ };
+ const addClothing = (files: Iterable<File>) => {
+ const list = [...files].filter((f) => /^image\/(png|jpe?g|webp)$/.test(f.type));
+ if (clothing.length + list.length > MAX_CLOTHING) toast("You can add up to three clothing references");
+ list.slice(0, MAX_CLOTHING - clothing.length).forEach((f) => fileToList(f, setClothing, "image"));
+ };
+ const create = () => {
+ if (blocker) return toast(blocker);
+ if (!body) return toast("Wait for the uploads to finish");
+ run.mutate(body, {
+ onSuccess: (r) => setIds((xs) => [...r.items.map((g) => g.id), ...xs]),
+ onError: (e) => toast.error((e as Error).message || "Couldn't start the sheet"),
+ });
+ };
+
+ 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.">
+ <EngineSwitch value={engine} onChange={setEngine} />
+ </PageHeader>
+
+ <div className="grid gap-4 lg:grid-cols-[184px_minmax(0,1fr)] xl:grid-cols-[184px_minmax(0,1fr)_360px]">
+ {/* The rail: Character type, then the categories this type shows. Phones scroll it sideways inside itself. */}
+ <div
+ role="tablist"
+ aria-label="Categories"
+ aria-orientation="vertical"
+ 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"
+ >
+ {[{ id: "tier", label: "Character type" }, ...categories].map((c) => {
+ const Icon = CATEGORY_ICON[c.id];
+ const on = tab === c.id;
+ const count = c.id === "tier" ? 0 : (state.picks[c.id]?.length ?? 0);
+ return (
+ <button
+ key={c.id}
+ id={`ib-tab-${c.id}`}
+ type="button"
+ role="tab"
+ aria-selected={on}
+ aria-controls="ib-panel"
+ tabIndex={on ? 0 : -1}
+ onClick={() => setActive(c.id)}
+ className={cn(
+ "flex h-9 shrink-0 items-center gap-2 rounded-full px-3 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring lg:h-8 lg:rounded-lg lg:px-2.5",
+ on && "bg-brand-faint text-brand-text hover:bg-brand-faint-hover hover:text-brand-text",
+ )}
+ >
+ {Icon && <Icon className="size-3.5 shrink-0" aria-hidden />}
+ <span className="lg:min-w-0 lg:flex-1 lg:truncate lg:text-left">{c.label}</span>
+ {c.id === "tier" ? (
+ <span className="text-[11.5px] text-muted-foreground">{tierLabel}</span>
+ ) : count ? (
+ <span className="grid h-4.5 min-w-4.5 place-items-center rounded-full bg-primary px-1 text-[11px] text-primary-foreground tabular-nums" aria-label={`${count} picked`}>
+ {count}
+ </span>
+ ) : null}
+ {state.locked.includes(c.id) && <span className="sr-only">(kept on Shuffle)</span>}
+ </button>
+ );
+ })}
+ </div>
+
+ <section id="ib-panel" role="tabpanel" aria-labelledby={`ib-tab-${tab}`} className="min-w-0 space-y-4 rounded-2xl border bg-background p-4 sm:p-5">
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="mr-auto min-w-0">
+ <h2 className="font-heading text-[22px] leading-tight">{category?.label ?? "Character type"}</h2>
+ <p className="text-[12.5px] text-muted-foreground">{category ? pickRule(category) : "Human tiers or a creature, then everything else"}</p>
+ </div>
+ {category && <LockButton locked={state.locked.includes(category.id)} label={category.label} onToggle={() => setState((s) => toggleLock(s, category.id))} />}
+ <Button variant="outline" size="sm" onClick={shuffle}>
+ <Dices /> Shuffle
+ </Button>
+ <Button variant="ghost" size="sm" onClick={() => (setState(resetPicks), setMessage(null))}>
+ <RotateCcw /> Reset all
+ </Button>
+ </div>
+ <div aria-live="polite">
+ {message && (
+ <p className={cn("flex items-start gap-2 rounded-xl px-3 py-2 text-[13px]", message.kind === "conflict" ? "bg-destructive/10 text-destructive" : "bg-muted text-muted-foreground")}>
+ {message.kind === "conflict" ? <TriangleAlert className="mt-0.5 size-4 shrink-0" aria-hidden /> : <Info className="mt-0.5 size-4 shrink-0" aria-hidden />}
+ {message.text}
+ </p>
+ )}
+ </div>
+ {category ? (
+ <OptionTiles category={category} state={state} onPick={(id) => pick(category.id, id)} />
+ ) : (
+ <TierPanel
+ state={state}
+ onTier={changeTier}
+ onSpecies={(species) => setState((s) => ({ ...s, species }))}
+ onBodyColor={(bodyColor) => setState((s) => ({ ...s, bodyColor }))}
+ />
+ )}
+ </section>
+
+ <aside aria-label="Your character" className="min-w-0 space-y-4 lg:col-span-2 xl:col-span-1">
+ <div className="space-y-3 rounded-2xl border bg-background p-4">
+ <h2 className="text-[13px] font-medium">Your character</h2>
+ <p className="font-heading text-[18px] leading-snug" aria-live="polite">
+ {summary}
+ </p>
+ {rows.length > 0 && (
+ <ul className="flex flex-wrap gap-1.5" aria-label="Your picks">
+ {rows.map((r) => (
+ <li key={r.category}>
+ <button type="button" onClick={() => setActive(r.category)} className="max-w-full rounded-full bg-muted px-2.5 py-1 text-left text-[12px] text-muted-foreground transition-colors outline-none hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
+ {r.label}: <span className="font-medium text-foreground">{r.options}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+
+ <div className="space-y-3 rounded-2xl border bg-background p-4">
+ <div role="radiogroup" aria-label="How to start" onKeyDown={radioKeys} className="scrollbar-none flex max-w-full overflow-x-auto rounded-full bg-muted p-0.5">
+ {STARTS.map(([id, label]) => (
+ <button
+ key={id}
+ type="button"
+ role="radio"
+ aria-checked={start === id}
+ tabIndex={radioTab(start === id)}
+ onClick={() => setStart(id)}
+ className={cn("h-8 flex-1 shrink-0 rounded-full px-3 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition outline-none focus-visible:ring-2 focus-visible:ring-ring", start === id && "bg-background text-foreground shadow-soft")}
+ >
+ {label}
+ </button>
+ ))}
+ </div>
+ {start !== "scratch" && (
+ <div className="space-y-1.5">
+ <UploadBox
+ value={photo}
+ onChange={setPhoto}
+ title={start === "face" ? "Your photo" : "Reference image"}
+ hint={start === "face" ? "A clear, front-facing photo of your face" : "A character whose look to start from"}
+ className="h-44"
+ />
+ <p className="text-[12px] text-muted-foreground">
+ {start === "face" ? "Your face goes on the character you build." : "The character starts from this look; your picks change it."} Shuffle keeps the gender, ethnicity and age{state.tier === "normal" ? ", skin and eye colour" : ""} the photo decides.
+ </p>
+ </div>
+ )}
+ <div className="space-y-2">
+ <p className="text-[13px] font-medium">
+ Clothing references <span className="font-normal text-muted-foreground">· up to {MAX_CLOTHING}</span>
+ </p>
+ <div className="grid grid-cols-4 gap-2">
+ {clothing.map((c, i) => (
+ <div key={c.id ?? i} className="relative aspect-square overflow-hidden rounded-lg bg-muted">
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+ <img src={c.preview} alt={`Clothing reference ${i + 1}`} className="size-full object-cover" />
+ {c.uploading && (
+ <span className="absolute inset-0 grid place-items-center bg-background/60" role="status" aria-label="Uploading">
+ <Loader2 className="size-4 animate-spin" />
+ </span>
+ )}
+ <button type="button" aria-label={`Remove clothing reference ${i + 1}`} onClick={() => setClothing((xs) => xs.filter((x) => x !== c))} className="absolute top-0.5 right-0.5 grid size-5 place-items-center rounded-full bg-foreground/80 text-background">
+ <X className="size-3" />
+ </button>
+ </div>
+ ))}
+ {clothing.length < MAX_CLOTHING && (
+ <button
+ type="button"
+ onClick={() => clothingInput.current?.click()}
+ onDragOver={(e) => e.preventDefault()}
+ onDrop={(e) => (e.preventDefault(), addClothing(e.dataTransfer.files))}
+ className="grid aspect-square place-items-center rounded-lg border border-dashed text-muted-foreground transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring"
+ aria-label="Add clothing references"
+ >
+ <ImagePlus className="size-5" />
+ </button>
+ )}
+ <input ref={clothingInput} type="file" accept="image/png,image/jpeg,image/webp" multiple hidden onChange={(e) => (addClothing(e.target.files ?? []), (e.target.value = ""))} />
+ </div>
+ </div>
+ <label className="block space-y-1.5">
+ <span className="flex items-baseline justify-between gap-2 text-[13px] font-medium">
+ Direction
+ <span className={cn("text-[11.5px] font-normal text-muted-foreground tabular-nums", direction.length > MAX_DIRECTION && "text-destructive")}>
+ {direction.length.toLocaleString("en-US")} / {MAX_DIRECTION.toLocaleString("en-US")}
+ </span>
+ </span>
+ <Textarea value={direction} onChange={(e) => setDirection(e.target.value)} rows={3} placeholder="Who are they? e.g. “a ceramicist from Porto who posts studio vlogs”" />
+ </label>
+ </div>
+
+ <div className="space-y-3 rounded-2xl border bg-background p-4">
+ {engine === "cloud" ? (
+ <div role="radiogroup" aria-label="Model" onKeyDown={radioKeys} className="space-y-1.5">
+ {CLOUD_MODELS.map((m) => (
+ <button
+ key={m.id}
+ type="button"
+ role="radio"
+ aria-checked={modelId === m.id}
+ tabIndex={radioTab(modelId === m.id)}
+ onClick={() => setModelId(m.id)}
+ className={cn(
+ "flex w-full min-w-0 items-start gap-2.5 rounded-xl border px-3 py-2 text-left transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",
+ modelId === m.id && "border-primary bg-brand-faint hover:bg-brand-faint-hover",
+ )}
+ >
+ <span className={cn("mt-1 size-3 shrink-0 rounded-full border-2", modelId === m.id ? "border-primary bg-primary" : "border-border-strong")} />
+ <span className="min-w-0">
+ <span className="block text-[13px] font-medium">{m.label}</span>
+ <span className="block text-[12px] leading-snug text-muted-foreground">
+ {m.note}
+ {m.higgsfield && !higgsfield && " · needs a Higgsfield key"}
+ </span>
+ </span>
+ </button>
+ ))}
+ </div>
+ ) : (
+ <p className="text-[12.5px] text-muted-foreground">
+ Open source: Z-Image Turbo draws the sheet (the Soul Cast sheet workflow); with a photo or clothing, Qwen-Image-Edit 2511 then puts them on it. <span className="font-medium text-foreground">Free</span> on your GPU.
+ </p>
+ )}
+ <RunInfo preview={blocker ? undefined : (settled ? preview.data : undefined)} loading={preview.isFetching} blocker={blocker} />
+ <Button className="w-full" onClick={create} disabled={run.isPending || uploading}>
+ {run.isPending ? <Loader2 className="animate-spin" /> : <Sparkles />} {run.isPending ? "Starting…" : "Generate character sheet"}
+ </Button>
+ </div>
+ </aside>
+ </div>
+
+ <section className="mt-8 space-y-3" aria-labelledby="ib-sheets">
+ <div className="flex flex-wrap items-baseline justify-between gap-2">
+ <h2 id="ib-sheets" className="font-heading text-[22px]">
+ {ids.length ? "Your sheets" : "Recent sheets"}
+ </h2>
+ <p className="text-[12.5px] text-muted-foreground">
+ Also in <Link href="/character-sheet" className="text-brand-text underline underline-offset-2">Character Sheet</Link> from your own photos
+ </p>
+ </div>
+ {mine.length ? (
+ <>
+ <ResultsGrid
+ items={mine}
+ ratio={2}
+ className="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)} />}
+ </>
+ ) : (
+ <div className="grid min-h-48 place-items-center rounded-2xl border border-dashed p-6 text-center">
+ <div className="max-w-md space-y-1">
+ <p className="font-heading text-[20px]">Your character sheet appears here</p>
+ <p className="text-[13px] text-muted-foreground">A portrait and full-body views of the same character on white — then save it as a character to use in any prompt with @.</p>
+ </div>
+ </div>
+ )}
+ </section>
+ </PageShell>
+ );
+}
diff --git a/src/components/influencer/option-panel.tsx b/src/components/influencer/option-panel.tsx
new file mode 100644
index 00000000..d7796510
--- /dev/null
+++ b/src/components/influencer/option-panel.tsx
@@ -0,0 +1,261 @@
+"use client";
+
+import {
+ Bird,
+ Bug,
+ Cat,
+ Check,
+ Dog,
+ Drama,
+ Droplet,
+ Earth,
+ Eye,
+ Glasses,
+ Hourglass,
+ Leaf,
+ Lock,
+ LockOpen,
+ Palette,
+ PersonStanding,
+ Rat,
+ Ruler,
+ RulerDimensionLine,
+ ScanFace,
+ Scissors,
+ Shirt,
+ Smile,
+ SmilePlus,
+ Sparkles,
+ UserRound,
+ VenusAndMars,
+ type LucideIcon,
+} from "lucide-react";
+import { radioKeys, radioTab } from "@/components/studio/radio-keys";
+import {
+ conflictFor,
+ CREATURE_TYPES,
+ HUMAN_TIERS,
+ type InfluencerCategory,
+ type InfluencerState,
+ type InfluencerTier,
+} from "@/lib/influencer";
+import { cn } from "@/lib/utils";
+
+export const TIER_ICON: Record<InfluencerTier, LucideIcon> = {
+ normal: UserRound,
+ freak: Smile,
+ total: Drama,
+ insects: Bug,
+ frogs: Leaf,
+ cats: Cat,
+ dogs: Dog,
+ capybaras: Rat,
+ birds: Bird,
+};
+
+export const CATEGORY_ICON: Record<string, LucideIcon> = {
+ tier: UserRound,
+ gender: VenusAndMars,
+ ethnicity_origin_base: Earth,
+ age: Hourglass,
+ skin_tone: Palette,
+ height: Ruler,
+ body_type: PersonStanding,
+ proportions: RulerDimensionLine,
+ freak_head: ScanFace,
+ freak_neck: UserRound,
+ eye_shape: Eye,
+ eye_color: Eye,
+ freak_face: SmilePlus,
+ facial_hair: Scissors,
+ hair: Scissors,
+ hair_colour: Droplet,
+ distinctive: Sparkles,
+ aesthetic: Shirt,
+ accessory: Glasses,
+};
+
+/** A stable hue per option id, for its tile (Fuobe draws its own tiles; nothing comes from Higgsfield's CDN). */
+function hue(id: string): number {
+ let h = 0;
+ for (const c of id) h = (h * 31 + c.charCodeAt(0)) % 360;
+ return h;
+}
+
+const SLOT_LABEL: Record<string, string> = {
+ marks: "Marks",
+ cheeks: "Cheeks",
+ eyes: "Eyes",
+ lips: "Mouth",
+ brows: "Brows",
+ nose: "Nose",
+ ears: "Ears",
+ teeth: "Teeth",
+ chin: "Chin",
+ forehead: "Forehead",
+};
+
+/** How many a category takes, in words. */
+export function pickRule(c: InfluencerCategory): string {
+ if (c.id === "freak_face") return "One per area, up to 4";
+ if (c.id === "accessory") return "Up to 3, or None";
+ return c.max === 1 ? "Pick one" : `Up to ${c.max}`;
+}
+
+/** The Character type panel: three human tiers, six creature types, then the species and body colour. */
+export function TierPanel({ state, onTier, onSpecies, onBodyColor }: { state: InfluencerState; onTier: (t: InfluencerTier) => void; onSpecies: (s?: string) => void; onBodyColor: (c?: string) => void }) {
+ const creature = CREATURE_TYPES.find((c) => c.id === state.tier);
+ const tile = (id: InfluencerTier, label: string, hint: string) => {
+ const Icon = TIER_ICON[id];
+ const on = state.tier === id;
+ return (
+ <button
+ key={id}
+ type="button"
+ role="radio"
+ aria-checked={on}
+ tabIndex={radioTab(on)}
+ onClick={() => onTier(id)}
+ className={cn(
+ "flex min-w-0 items-center gap-2.5 rounded-xl border p-2.5 text-left transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",
+ on && "border-primary bg-brand-faint hover:bg-brand-faint-hover",
+ )}
+ >
+ <span className={cn("grid size-9 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground", on && "bg-primary text-primary-foreground")}>
+ <Icon className="size-4.5" aria-hidden />
+ </span>
+ <span className="min-w-0">
+ <span className="block text-[13px] font-medium">{label}</span>
+ <span className="block truncate text-[12px] text-muted-foreground">{hint}</span>
+ </span>
+ </button>
+ );
+ };
+ return (
+ <div className="space-y-5">
+ <div role="radiogroup" aria-label="Character type" onKeyDown={radioKeys} className="space-y-4">
+ <div className="space-y-2">
+ <p className="text-[12px] font-medium text-muted-foreground">Human</p>
+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-3">{HUMAN_TIERS.map((t) => tile(t.id, t.label, t.hint))}</div>
+ </div>
+ <div className="space-y-2">
+ <p className="text-[12px] font-medium text-muted-foreground">Creature</p>
+ <div className="grid grid-cols-2 gap-2 sm:grid-cols-3">{CREATURE_TYPES.map((c) => tile(c.id, c.label, `Anthropomorphic ${c.label.toLowerCase()}`))}</div>
+ </div>
+ </div>
+ {creature && (
+ <>
+ <div className="space-y-2">
+ <p id="ib-species" className="text-[13px] font-medium">
+ Species
+ </p>
+ <div role="radiogroup" aria-labelledby="ib-species" onKeyDown={radioKeys} className="flex flex-wrap gap-1.5">
+ {[{ id: "", label: "Any" }, ...creature.species].map((s) => {
+ const on = (state.species ?? "") === s.id;
+ return (
+ <button
+ key={s.id || "any"}
+ type="button"
+ role="radio"
+ aria-checked={on}
+ tabIndex={radioTab(on)}
+ onClick={() => onSpecies(s.id || undefined)}
+ className={cn("h-8 rounded-full border px-3 text-[12.5px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", on ? "border-primary bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent")}
+ >
+ {s.label}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ <div className="space-y-2">
+ <p className="text-[13px] font-medium">Body colour</p>
+ <div className="flex flex-wrap items-center gap-2">
+ <button
+ type="button"
+ aria-pressed={!state.bodyColor}
+ onClick={() => onBodyColor(undefined)}
+ className={cn("h-8 rounded-full border px-3 text-[12.5px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", !state.bodyColor ? "border-primary bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent")}
+ >
+ Natural
+ </button>
+ <label className={cn("flex h-8 cursor-pointer items-center gap-2 rounded-full border pr-3 pl-1 text-[12.5px] font-medium focus-within:ring-2 focus-within:ring-ring", state.bodyColor ? "border-primary bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent")}>
+ <input type="color" value={state.bodyColor ?? "#c08457"} onChange={(e) => onBodyColor(e.target.value)} className="size-6 cursor-pointer rounded-full border-0 bg-transparent p-0" aria-label="Body colour" />
+ {state.bodyColor ? state.bodyColor.toUpperCase() : "Pick a colour"}
+ </label>
+ </div>
+ </div>
+ </>
+ )}
+ </div>
+ );
+}
+
+/** One category's options as tiles (swatches for colours); a tile that would conflict says why when picked. */
+export function OptionTiles({ category, state, onPick }: { category: InfluencerCategory; state: InfluencerState; onPick: (id: string) => void }) {
+ const picked = state.picks[category.id] ?? [];
+ const Icon = CATEGORY_ICON[category.id] ?? Sparkles;
+ const colour = category.kind === "color";
+ return (
+ <div role="group" aria-label={category.label} className={cn("grid gap-2", colour ? "grid-cols-2 sm:grid-cols-3 xl:grid-cols-4" : "grid-cols-2 sm:grid-cols-3 xl:grid-cols-4")}>
+ {category.options.map((o) => {
+ const on = picked.includes(o.id);
+ const conflict = on ? null : conflictFor(state, category.id, o.id);
+ return (
+ <button
+ key={o.id}
+ type="button"
+ aria-pressed={on}
+ aria-disabled={conflict ? true : undefined}
+ title={conflict ?? undefined}
+ onClick={() => onPick(o.id)}
+ className={cn(
+ "relative flex min-w-0 items-center gap-2.5 rounded-xl border p-2 text-left transition-colors outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",
+ on && "border-primary bg-brand-faint hover:bg-brand-faint-hover",
+ conflict && "opacity-50",
+ )}
+ >
+ {colour ? (
+ <span className="size-9 shrink-0 rounded-full border border-black/10 shadow-inner dark:border-white/15" style={{ background: o.swatch }} aria-hidden />
+ ) : (
+ <span
+ className="grid size-9 shrink-0 place-items-center rounded-lg bg-[oklch(0.94_0.045_var(--h))] text-[oklch(0.45_0.12_var(--h))] dark:bg-[oklch(0.32_0.06_var(--h))] dark:text-[oklch(0.86_0.08_var(--h))]"
+ style={{ "--h": hue(o.id) } as React.CSSProperties}
+ aria-hidden
+ >
+ <Icon className="size-4" />
+ </span>
+ )}
+ <span className="min-w-0 flex-1">
+ <span className="block text-[13px] leading-tight font-medium break-words">{o.label}</span>
+ {o.slot && <span className="block text-[11.5px] text-muted-foreground">{SLOT_LABEL[o.slot] ?? o.slot}</span>}
+ </span>
+ {on && (
+ <span className="grid size-4.5 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground" aria-hidden>
+ <Check className="size-3" />
+ </span>
+ )}
+ {conflict && <span className="sr-only">. {conflict}</span>}
+ </button>
+ );
+ })}
+ </div>
+ );
+}
+
+/** "Keep on Shuffle": a locked category keeps its picks when you Shuffle. */
+export function LockButton({ locked, label, onToggle }: { locked: boolean; label: string; onToggle: () => void }) {
+ const Icon = locked ? Lock : LockOpen;
+ return (
+ <button
+ type="button"
+ aria-pressed={locked}
+ onClick={onToggle}
+ className={cn("inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-[12.5px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring", locked ? "border-primary bg-brand-faint text-brand-text" : "text-muted-foreground hover:bg-accent")}
+ >
+ <Icon className="size-3.5" aria-hidden />
+ {locked ? "Kept on Shuffle" : "Keep on Shuffle"}
+ <span className="sr-only">({label})</span>
+ </button>
+ );
+}
diff --git a/src/components/nav-items.ts b/src/components/nav-items.ts
index cfe09608..f05d5197 100644
--- a/src/components/nav-items.ts
+++ b/src/components/nav-items.ts
@@ -37,6 +37,7 @@ import {
TrendingUp,
Tv,
UserRoundCog,
+ UserRoundPen,
Video,
Wand2,
WandSparkles,
@@ -105,6 +106,7 @@ export const NAV: NavGroupDef[] = [
{ href: "/photodump", label: "Photodump", icon: Camera, keywords: "photo pack character" },
{ href: "/fashion-factory", label: "Fashion Factory", icon: Shirt, keywords: "outfits try-on lookbook" },
{ href: "/character-sheet", label: "Character Sheet", icon: UserRoundCog, keywords: "turnaround" },
+ { href: "/influencer", label: "AI Influencer", icon: UserRoundPen, keywords: "character builder avatar creature shuffle" },
{ href: "/faceless", label: "Faceless Studio", icon: Tv, keywords: "youtube channel episodes" },
{ href: "/explainer", label: "Explainer", icon: Presentation, keywords: "slides pdf video" },
{ href: "/lipsync", label: "Lipsync & avatars", icon: Mic2, keywords: "talking avatar" },
diff --git a/src/lib/studios.ts b/src/lib/studios.ts
index 42da2ff6..e0d5c705 100644
--- a/src/lib/studios.ts
+++ b/src/lib/studios.ts
@@ -337,9 +337,15 @@ export function appStudio(preset: Preset): StudioConfig {
defaultModels: { cloud: preset.cloud?.modelId ?? preset.open!.modelId, open: preset.open?.modelId ?? preset.cloud!.modelId },
promptOptional: preset.userPrompt !== "required",
hidePrompt: preset.userPrompt === "none",
+ ...(APP_RELATED[preset.id] && { related: APP_RELATED[preset.id] }),
};
}
+/** 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" },
+};
+
export const MOTION_CONTROL_STUDIO: StudioConfig = {
feature: "motion-control",
title: "Motion control",