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
Composer: try-on names its images ("Person photo", "Add garment")
Claude5edbcd7e826f
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsxindex 5e70559f..37e708c3 100644--- a/src/components/studio/composer.tsx+++ b/src/components/studio/composer.tsx@@ -12,7 +12,7 @@ import type { GenerationRequest, MediaKind, ModelDef, Operation, Preset } from "import { enhance, useCreateGeneration, useElements, useEngine, useHydrated, useStatus } from "@/lib/api";import { applyMentions, type StudioElement } from "@/lib/catalog/elements";import { applySketch, stripMotionPaths } from "@/lib/catalog/sketch";-import { blockerFor, costLabel, filterModels, firstMissingSlot, PLACEHOLDER, pushRecent, settingsShape } from "@/lib/composer";+import { blockerFor, costLabel, filterModels, firstMissingSlot, namedImageSlots, PLACEHOLDER, pushRecent, settingsShape } from "@/lib/composer";import { formatCost } from "@/lib/format";import { cn } from "@/lib/utils";import { AttachMenu } from "./attach-menu";@@ -144,8 +144,14 @@ export function Composer({ docked }: { docked: boolean }) {// Single-purpose studios (Extend, Reframe, Edit video…) pin their operation.const studioOp = config.ops.length === 1 && !preset ? config.ops[0] : undefined;- const slots = preset?.inputs ?? config.slots;const opts = model?.options ?? {};+ // Try-on names its images: "Person photo", then "Add garment" (instead of "Image" / "Add ref").+ const baseSlots = preset?.inputs ?? config.slots;+ const named = useMemo(+ () => namedImageSlots(baseSlots, model?.options.imageLabels, config.multiRef?.label, draft.refs.length),+ [baseSlots, model?.options.imageLabels, config.multiRef?.label, draft.refs.length],+ );+ const slots = named.slots;// Clips: ComfyUI joins 4 at a time. Images: what the model takes beyond the fixed image slots.const refMax = !config.multiRef? 0@@ -332,7 +338,7 @@ export function Composer({ docked }: { docked: boolean }) {{config.multiRef && draft.refs.length < refMax && (<MediaSlotslotKey="refs"- label={config.multiRef.label}+ label={named.refLabel ?? config.multiRef.label}kind={config.multiRef.kind ?? "image"}value={null}onFile={attach.addRefFile}diff --git a/src/lib/composer.ts b/src/lib/composer.tsindex 71fe9452..9081ac69 100644--- a/src/lib/composer.ts+++ b/src/lib/composer.ts@@ -98,6 +98,21 @@ export function hiddenChanges(params: GenParams, negativePrompt: string, model?:const VOWEL = /^[aeiou]/i;const DETERMINER = /^(your|the|a|an|some|any|my|this|that)\b/i;+const sentence = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);++/**+ * Models that name their images (try-on: "person photo", then "garment") label the studio's image+ * slots in that order, and the next reference tile after the `refs` already added ("Add garment").+ * Same array when nothing changes.+ */+export function namedImageSlots(slots: InputSlot[], names: string[] | undefined, refLabel?: string, refs = 0): { slots: InputSlot[]; refLabel?: string } {+ if (!names?.length) return { slots, refLabel };+ let i = 0;+ const named = slots.map((s) => (s.accept === "image" && s.key !== "mask" && s.key !== "sketch" && names[i] ? { ...s, label: sentence(names[i++]) } : s));+ const next = names[i + refs];+ return { slots: i ? named : slots, refLabel: refLabel && next ? `Add ${next}` : refLabel };+}+/** "Target photo" → "Add a target photo"; "Your clip" → "Add your clip"; "Image" → "Add an image". */export function slotMessage(label: string): string {const l = label.trim();diff --git a/tests/studio-pickers.test.ts b/tests/studio-pickers.test.tsindex 121ee06b..f3460aae 100644--- a/tests/studio-pickers.test.ts+++ b/tests/studio-pickers.test.ts@@ -1,7 +1,25 @@import { describe, expect, it } from "vitest";+import { getModel } from "@/lib/catalog";+import { namedImageSlots, slotMessage } from "@/lib/composer";import { EDIT_STUDIO, FOLEY_STUDIO, IMAGE_STUDIO, MUSIC_STUDIO, SFX_STUDIO } from "@/lib/studios";import { studioCatalog } from "@/lib/studio-catalog";+describe("named image slots (try-on)", () => {+ it("labels the Edit studio's image and reference tile with the model's image names", () => {+ const names = getModel("fashn-tryon")!.options.imageLabels;+ const r = namedImageSlots(EDIT_STUDIO.slots, names, EDIT_STUDIO.multiRef?.label);+ expect(r.slots.map((s) => s.label)).toEqual(["Person photo"]);+ expect(r.refLabel).toBe("Add garment");+ expect(slotMessage(r.slots[0].label)).toBe("Add a person photo");+ // Once the garment is in, the tile goes back to its own label (FASHN takes no more images anyway).+ expect(namedImageSlots(EDIT_STUDIO.slots, names, EDIT_STUDIO.multiRef?.label, 1).refLabel).toBe("Add ref");+ // Models without names keep the studio's own labels, same array.+ const same = namedImageSlots(EDIT_STUDIO.slots, getModel("nano-banana-pro")!.options.imageLabels, "Add ref");+ expect(same.slots).toBe(EDIT_STUDIO.slots);+ expect(same.refLabel).toBe("Add ref");+ });+});+describe("studio pickers and defaults", () => {it("the Image studio lists text-to-image models; edit-only tools are in Edit", () => {const image = studioCatalog(IMAGE_STUDIO).models.map((m) => m.id);