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
Image: a visitor's palette stays in the prompt, and the notes say color
Adarsh9e2a3dc79e14
diff --git a/src/components/palettes/color-signature-panel.tsx b/src/components/palettes/color-signature-panel.tsxindex b3cd26e2..a930b287 100644--- a/src/components/palettes/color-signature-panel.tsx+++ b/src/components/palettes/color-signature-panel.tsx@@ -194,7 +194,8 @@ export function ColorSignaturePanel({</Button>)}</div>- {engine === "open" && value && (+ {/* The lock is a second run on the studio's own ComfyUI, which a visitor's request never asks for. */}+ {engine === "open" && value && !visitor && (<label className="mb-3 flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-[12.5px]"><span>Lock the colors after generatingdiff --git a/src/components/palettes/use-signature.ts b/src/components/palettes/use-signature.tsindex 24a6fc83..04b33f39 100644--- a/src/components/palettes/use-signature.ts+++ b/src/components/palettes/use-signature.ts@@ -4,6 +4,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";import { useCallback } from "react";import { applySignature, withSignatureWords, type Signature, type SignedRequest } from "@/lib/catalog/palettes";import type { Generation, GenerationRequest } from "@/lib/catalog/types";+import { useIsVisitor } from "@/lib/api";import { responseError } from "@/lib/refusals";import { useCatalog } from "@/components/studio/catalog";import { usePalettes } from "./hooks";@@ -12,19 +13,21 @@ import { usePalettes } from "./hooks";* The composer's hook for the style signature (Color signature + Moodboard chips): `apply` routes a* request for the picked palette and moodboard (pure, src/lib/catalog/palettes.ts) — the composer* plans and prices with it while you type and sends what it returns. `lock` sends a run whose- * images are recoloured afterwards (open engine) through POST /api/palettes/lock.+ * images are recolored afterwards (open engine) through POST /api/palettes/lock: the owner's only, so a+ * guest's or a free account's request never carries a lock.*/export function useSignature(enabled: boolean, signature: Signature | undefined) {const { getModel } = useCatalog();// The palette list carries which models take a palette natively; the chip has usually loaded it already.const { caps } = usePalettes(enabled && !!signature?.palette);+ const visitor = useIsVisitor();const apply = useCallback((req: GenerationRequest): SignedRequest & { worded: GenerationRequest } => {- const signed = enabled && signature ? applySignature(req, signature, { caps, getModel }) : { request: req, modelId: req.modelId, notes: [] };+ const signed = enabled && signature ? applySignature(req, signature, { caps, getModel, visitor }) : { request: req, modelId: req.modelId, notes: [] };// `request` is what's sent (the user's words in `prompt`); `worded` is how it runs, for planning and pricing.return { ...signed, worded: withSignatureWords(signed.request) };},- [enabled, signature, caps, getModel],+ [enabled, signature, caps, getModel, visitor],);const qc = useQueryClient();const lock = useMutation({diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.tsindex 269284fc..558c3dc8 100644--- a/src/lib/catalog/models.ts+++ b/src/lib/catalog/models.ts@@ -1201,7 +1201,7 @@ const open: ModelDef[] = [vendor: "Alibaba Tongyi",family: "z-image",kind: "image",- tagline: "Generates in your hex colours and locks them with a colour transfer · 12 GB GPU · Apache-2.0",+ tagline: "Generates in your hex colors and keeps them with a color transfer · 12 GB GPU · Apache-2.0",badges: ["new", "fast"],routes: [comfy("t2i", "palette-zimage-hex", "hex list in the prompt + ColorTransfer to a swatch")],options: {diff --git a/src/lib/catalog/palettes.ts b/src/lib/catalog/palettes.tsindex f8f7e2b7..fde7e1df 100644--- a/src/lib/catalog/palettes.ts+++ b/src/lib/catalog/palettes.ts@@ -369,6 +369,11 @@ export interface SignatureCaps {export interface SignatureContext {caps: SignatureCaps;getModel: (id: string) => ModelDef | undefined;+ /**+ * A guest or a free account: no palette lock. The lock is a second run on the studio's own ComfyUI+ * (POST /api/palettes/lock), which only the owner starts, so a visitor's colors stay in the prompt.+ */+ visitor?: boolean;}export interface SignedRequest {@@ -577,12 +582,12 @@ export function applySignature(req: GenerationRequest, sig: Signature | undefineconst all = paletteColors(pal);const native = ctx.caps.native[model.id];if (!native && model.engine === "open" && model.id === SIGNATURE_MODELS.openTurbo && !styled && !(r.inputs?.images?.length) && !r.loras?.length) {- move(SIGNATURE_MODELS.openPalette, `Runs on {model}: your colours in the prompt, then locked in with a colour transfer`);+ move(SIGNATURE_MODELS.openPalette, `Runs on {model}: your colors go in the prompt, then a color transfer keeps the image to them`);}const nativeNow = ctx.caps.native[model.id];if (nativeNow) {const colors = cardStrip({ colors: pal.colors, background: null });- if (colors.length > nativeNow.max) notes.push(`${model.name} takes ${nativeNow.max} colours — the first ${nativeNow.max} are used`);+ if (colors.length > nativeNow.max) notes.push(`${model.name} takes ${nativeNow.max} colors — the first ${nativeNow.max} are used`);r = { ...r, params: { ...r.params, palette: colors.slice(0, nativeNow.max) } };if (pal.background && nativeNow.background) r = setExtra(r, nativeNow.background, pal.background.toUpperCase());} else if (model.id === SIGNATURE_MODELS.openPalette) {@@ -590,9 +595,9 @@ export function applySignature(req: GenerationRequest, sig: Signature | undefine} else {words.push(palettePrompt(pal));r = { ...r, params: { ...r.params, palette: all.slice(0, 16) } };- if (model.engine === "open" && (pal.lock ?? locksByDefault(model.id))) {+ if (model.engine === "open" && !ctx.visitor && (pal.lock ?? locksByDefault(model.id))) {lock = { colors: all };- notes.push(`Then recoloured to “${pal.name}” by a palette-transfer step`);+ notes.push(`Then kept to the colors of “${pal.name}” after it's made`);}}}diff --git a/src/server/palettes.ts b/src/server/palettes.tsindex 299a21f7..f13e2d91 100644--- a/src/server/palettes.ts+++ b/src/server/palettes.ts@@ -119,7 +119,7 @@ export function getPalette(id: string): Palette | null {export function createPalette(input: { name: string; colors: string[]; background?: string | null; source?: "manual" | "images"; thumb?: string | null }): Palette {const colors = input.colors.map((c) => normalizeHex(c)).filter((c): c is string => !!c);const background = input.background ? normalizeHex(input.background) : null;- if (colors.length !== input.colors.length) throw new Error(`${input.colors.find((c) => !normalizeHex(c))} isn't a colour — use #RRGGBB`);+ if (colors.length !== input.colors.length) throw new Error(`${input.colors.find((c) => !normalizeHex(c))} isn't a color — use #RRGGBB`);const err = paletteError({ name: input.name, colors, background });if (err) throw new Error(err);const now = Date.now();diff --git a/tests/image-studios.test.ts b/tests/image-studios.test.tsindex 98349250..32024f30 100644--- a/tests/image-studios.test.ts+++ b/tests/image-studios.test.ts@@ -190,7 +190,7 @@ describe("palettes: routing per model", () => {const twelve = { ...PAL, colors: Array.from({ length: 12 }, (_, i) => `#0000${(i * 16).toString(16).padStart(2, "0").toUpperCase()}`) };const trimmed = applySignature(req("recraft-4-1"), { palette: twelve }, ctx);expect(trimmed.request.params?.palette).toHaveLength(10);- expect(trimmed.notes.join()).toMatch(/takes 10 colours/);+ expect(trimmed.notes.join()).toMatch(/takes 10 colors/);const ideo = applySignature(req("ideogram-3"), { palette: PAL }, ctx);expect(ideo.request.params?.palette).toEqual(PAL.colors);@@ -229,7 +229,12 @@ describe("palettes: routing per model", () => {expect(said(free)).toMatch(/Color palette/);const locked = applySignature(req("oss-qwen-image"), { palette: { ...PAL, lock: true } }, ctx);expect(locked.lock?.colors).toEqual([...PAL.colors, "#264653"]);- expect(locked.notes).toEqual(["Then recoloured to “Teal Dusk” by a palette-transfer step"]);+ expect(locked.notes).toEqual(["Then kept to the colors of “Teal Dusk” after it's made"]);+ // A guest or a free account never gets the lock (a run on the studio's own ComfyUI): the colors stay in the prompt.+ const visitor = applySignature(req("oss-qwen-image"), { palette: { ...PAL, lock: true } }, { ...ctx, visitor: true });+ expect(visitor.lock).toBeUndefined();+ expect(visitor.notes).toEqual([]);+ expect(said(visitor)).toMatch(/Color palette/);});it("leaves requests alone without a signature or an unknown model", () => {diff --git a/tests/soul-runs.test.ts b/tests/soul-runs.test.tsindex 65754d21..1ed3edf9 100644--- a/tests/soul-runs.test.ts+++ b/tests/soul-runs.test.ts@@ -211,7 +211,7 @@ describe("Fuobe Soul through the server", () => {describe("Soul HEX: a palette on Fuobe Soul", () => {const PAL = { id: "p1", name: "Teal Dusk", colors: ["#102030", "#2A9D8F"], background: "#264653", slug: null };- const signed = async (engine: "open" | "cloud", modelId = "fuobe-soul", lock?: boolean) => {+ const signed = async (engine: "open" | "cloud", modelId = "fuobe-soul", lock?: boolean, visitor?: boolean) => {const { applySignature } = await import("@/lib/catalog/palettes");const { signatureCaps } = await import("@/server/palettes");// The composer's catalog is the engine's view of each model.@@ -219,7 +219,7 @@ describe("Soul HEX: a palette on Fuobe Soul", () => {const m = getModel(id);return m && onEngine(m, engine);};- return applySignature({ feature: "image", modelId, prompt: "a lighthouse at dusk", presetId: "v1-90s-grain", engine }, { palette: { ...PAL, ...(lock !== undefined && { lock }) } }, { caps: signatureCaps(), getModel: view });+ return applySignature({ feature: "image", modelId, prompt: "a lighthouse at dusk", presetId: "v1-90s-grain", engine }, { palette: { ...PAL, ...(lock !== undefined && { lock }) } }, { caps: signatureCaps(), getModel: view, visitor });};it("writes the colours into the prompt on both engines and locks them on the open engine unless turned off", async () => {@@ -230,6 +230,10 @@ describe("Soul HEX: a palette on Fuobe Soul", () => {expect(open.lock).toEqual({ colors: ["#102030", "#2A9D8F", "#264653"] });expect((await signed("open", "fuobe-soul-cinema")).lock).toBeTruthy();expect((await signed("open", "fuobe-soul", false)).lock).toBeUndefined();+ // A guest or a free account: the colors in the prompt only (the lock runs on the studio's own ComfyUI).+ const visitor = await signed("open", "fuobe-soul", undefined, true);+ expect(visitor.lock).toBeUndefined();+ expect(visitor.request.signature?.words).toMatch(/Color palette/);// fal has no colour-match step: the cloud gets the words only.const cloud = await signed("cloud");expect(cloud.lock).toBeUndefined();