AI media harness for planning, generating, and editing locally
TypeScript
Use one character sheet prompt
Bitti384489b1ba0a
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex a221d3c..6e011fc 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -5,7 +5,7 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve## What's new- First and last scene frames use the searchable reference picker with image thumbnails. Reference selectors and prompt chips share configurable filters for images, audio, video, text, and RefMods.-- Configure a character sheet from the Image toolbar's Template menu, with reference-enabled prompts for clothing and other details and a resolution selection controlling sheet height (512–2048 px), then select Execute. A square portrait and three 9:16 full-body views are combined into one child image in the image bar. The front view provides a shared clothing reference for the other views.+- Configure a character sheet from the Image toolbar's Template menu, with one reference-enabled prompt for clothing and other details and a resolution selection controlling sheet height (512–2048 px), then select Execute. A square portrait and three 9:16 full-body views are combined into one child image in the image bar. The front view provides a shared clothing reference for the other views.- Continue scenes from a selected scene's saved latents, with adjustable overlap and a choice of beginning or end. This replaces Previous scene in First & last frame.- Export any reference with images, a video or a sound as a refmod `.safetensors` file from References. Exported refmods can be attached to other references and projects.- Copying or cutting prompts preserves reference chips when pasted into other prompt fields.diff --git a/src/components/ImageProject.integration.test.tsx b/src/components/ImageProject.integration.test.tsxindex 2d2526e..1c669df 100644--- a/src/components/ImageProject.integration.test.tsx+++ b/src/components/ImageProject.integration.test.tsx@@ -47,16 +47,16 @@ it("opens template settings and executes only after configuring prompts and clotconst before = structuredClone(queue.project(project).getSnapshot().config);choose("Character sheet resolution", "2048 px high");expect(panel.getByText(/Sheet size:/)).toHaveTextContent("5504 × 2048 px");- typePrompt(panel.getByRole("textbox", { name: "Character sheet prompt" }), "Soft studio lighting");- const clothing = panel.getByRole("textbox", { name: "Clothing and accessories" });- typePrompt(clothing, "Wear");- placePromptCaret(clothing);- fireEvent.click(within(clothing.closest(".image-inspector__area") as HTMLElement).getByRole("button", { name: "Reference" }));+ expect(panel.queryByRole("textbox", { name: "Clothing and accessories" })).not.toBeInTheDocument();+ const prompt = panel.getByRole("textbox", { name: "Character sheet prompt" });+ typePrompt(prompt, "Soft studio lighting. Wear");+ placePromptCaret(prompt);+ fireEvent.click(within(prompt.closest(".image-inspector__area") as HTMLElement).getByRole("button", { name: "Reference" }));fireEvent.click(screen.getByRole("button", { name: /Red coat/ }));- expect(clothing.querySelector(".prompt-chip")).toHaveTextContent("Red coat");+ expect(prompt.querySelector(".prompt-chip")).toHaveTextContent("Red coat");expect(queue.project(project).getSnapshot().config).toEqual(before);fireEvent.click(panel.getByRole("button", { name: "Execute" }));- expect(generate).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ id: "test" }), "Selected", { prompt: "Soft studio lighting", clothing: "Wear @[ref:outfit]", height: 2048 });+ expect(generate).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ id: "test" }), "Selected", { prompt: "Soft studio lighting. Wear @[ref:outfit]", height: 2048 });fireEvent.click(panel.getByRole("button", { name: "Close template settings" }));expect(screen.getByRole("complementary", { name: "Image node inspector" })).toBeInTheDocument();fireEvent.click(toolbar.getByRole("button", { name: "Template" }));diff --git a/src/components/workspace/CharacterSheetSettings.tsx b/src/components/workspace/CharacterSheetSettings.tsxindex 8afb834..5f84b36 100644--- a/src/components/workspace/CharacterSheetSettings.tsx+++ b/src/components/workspace/CharacterSheetSettings.tsx@@ -35,12 +35,9 @@ export function CharacterSheetSettings({ config, source, references, missingLabeoptions={CHARACTER_SHEET_HEIGHTS.map((height) => ({ value: height, label: `${height} px high` }))} onChange={(height) => update("height", height)} /></PropRow><p className="image-inspector__caption">Sheet size: {dimensions.reduce((width, view) => width + view.width, 0)} × {dimensions[0].height} px. Width follows the four view proportions.</p><div className="image-inspector__area"><span>Prompt</span>- <PromptTextField aria-label="Character sheet prompt" value={options.prompt} onChange={(value) => update("prompt", value)} references={references} missingLabel={missingLabel} disabled={busy} placeholder="Describe the character, style, lighting, or other details…" />+ <PromptTextField aria-label="Character sheet prompt" value={options.prompt} onChange={(value) => update("prompt", value)} references={references} missingLabel={missingLabel} disabled={busy} placeholder="Describe the character, clothing, accessories, style, or lighting…" /></div>- <div className="image-inspector__area"><span>Clothing and accessories</span>- <PromptTextField aria-label="Clothing and accessories" value={options.clothing} onChange={(value) => update("clothing", value)} references={references} missingLabel={missingLabel} disabled={busy} placeholder="Describe the outfit or add clothing references…" />- </div>- <p className="image-inspector__caption">Leave these blank to keep the source appearance. Clothing instructions apply to the front view, then the same outfit is used for every angle.</p>+ <p className="image-inspector__caption">Use the prompt and references for clothing and other details. Leave it blank to keep the source appearance. Clothing instructions apply to the front view, then the same outfit is used for every angle.</p>{(validation || error) && <InfoBar severity="error" title="Couldn't prepare the template" message={validation ?? error ?? ""} />}</div><div className="image-template-settings__footer">diff --git a/src/lib/characterSheet.test.ts b/src/lib/characterSheet.test.tsindex 36943bc..aebd309 100644--- a/src/lib/characterSheet.test.ts+++ b/src/lib/characterSheet.test.ts@@ -104,7 +104,7 @@ it.each(CHARACTER_SHEET_HEIGHTS)("generates all four views at the selected %s pxconst { queue, session } = setup();const saved = { ...result, width: height * 43 / 16, height };vi.mocked(invoke).mockImplementation(async (command) => command === "combine_character_sheet" ? saved : undefined);- const options = { prompt: "", clothing: "", height };+ const options = { prompt: "", height };queue.enqueueCharacterSheet(session, template, "source", options);expect(queue.getSnapshot()[0].settings.canvasHeight).toBe(height);options.height = 512; // Queued dimensions must not follow later settings edits.@@ -122,7 +122,7 @@ it.each(CHARACTER_SHEET_HEIGHTS)("generates all four views at the selected %s pxit("rejects unsupported sheet heights before queueing generation", () => {const { queue, session } = setup();- expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: "", clothing: "", height: 8192 })).toThrow("supported character sheet height");+ expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: "", height: 8192 })).toThrow("supported character sheet height");expect(queue.getSnapshot()).toHaveLength(0);});@@ -172,16 +172,16 @@ it("conditions every view on prompt references and freezes the requested outfitconst { queue, session } = setup();session.update((current) => ({ ...current, references: [{ id: "coat", name: "Red coat", kind: "image", description: "A red wool coat", relativePath: "references/coat.png", intendedUse: [], createdAt: current.createdAt,refmods: [{ id: "coat-style", name: "Coat style", relativePath: "references/coat.safetensors", strength: 0.75, copies: 1 }] }] }));- const options = { prompt: "Soft studio lighting", clothing: "Wear @[ref:coat] with black boots" };+ const options = { prompt: "Soft studio lighting. Wear @[ref:coat] with black boots" };queue.enqueueCharacterSheet(session, template, "source", options);- options.clothing = "Changed after execution";+ options.prompt = "Changed after execution";const id = queue.getSnapshot()[0].id;for (let index = 0; index < 4; index++) {const request = await requestAt(index);expect(request.referencePaths).toEqual(["C:/Character/media/hero.png", ...(index > 0 ? [`C:/Character/cache/character-sheets/${id}/1.png`] : []), "C:/Character/references/coat.png"]);expect(request.refmods).toEqual([{ path: "C:/Character/references/coat.safetensors", strength: 0.75, copies: 1 }]);expect(request.prompt).toContain("Template instructions: Soft studio lighting");- expect(request.prompt).toContain("Clothing and accessories: Wear <Subject 2> with black boots");+ expect(request.prompt).toContain("Wear <Subject 2> with black boots");expect(request.prompt).not.toContain("@[ref:");expect(request.prompt).not.toContain("Changed after execution");expect(request.prompt).toContain(`<Subject 2> is Red coat, providing appearance from <Picture ${index === 0 ? 2 : 3}>`);@@ -196,9 +196,9 @@ it("conditions every view on prompt references and freezes the requested outfitit("rejects missing or excessive prompt references before starting a template", () => {const { queue, session } = setup();- expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: "", clothing: "@[ref:missing]" })).toThrow("no longer exists");+ expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: "@[ref:missing]" })).toThrow("no longer exists");session.update((current) => ({ ...current, references: Array.from({ length: 8 }, (_, index) => ({ id: `ref-${index}`, name: `Outfit ${index}`, kind: "image" as const, description: "", relativePath: `references/${index}.png`, intendedUse: [], createdAt: current.createdAt })) }));- expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: "", clothing: session.getSnapshot().config.references.map((reference) => `@[ref:${reference.id}]`).join(" ") })).toThrow("at most nine");+ expect(() => queue.enqueueCharacterSheet(session, template, "source", { prompt: session.getSnapshot().config.references.map((reference) => `@[ref:${reference.id}]`).join(" ") })).toThrow("at most nine");expect(queue.getSnapshot()).toHaveLength(0);expect(enqueueSlopfabGeneration).not.toHaveBeenCalled();});diff --git a/src/lib/characterSheet.ts b/src/lib/characterSheet.tsindex e2ae21d..fc51e4c 100644--- a/src/lib/characterSheet.ts+++ b/src/lib/characterSheet.ts@@ -14,8 +14,8 @@ export const CHARACTER_SHEET_VIEWS = [export const CHARACTER_SHEET_ORDER = [1, 0, 2, 3] as const;export const CHARACTER_SHEET_HEIGHTS = [512, 1024, 1536, 2048] as const;-export interface CharacterSheetOptions { prompt: string; clothing: string; height?: number }-export const emptyCharacterSheetOptions = (): CharacterSheetOptions => ({ prompt: "", clothing: "" });+export interface CharacterSheetOptions { prompt: string; height?: number }+export const emptyCharacterSheetOptions = (): CharacterSheetOptions => ({ prompt: "" });export function characterSheetDimensions(resolution: ProjectConfig["settings"]["resolution"], requestedHeight?: number) {// A shared height divisible by 512 makes both 1:1 and 9:16 exact on H3's@@ -39,7 +39,7 @@ export function compileCharacterSheet(config: ProjectConfig, source: ProjectAsse? "Apply the template's clothing instructions and references to establish the outfit. Where no change is requested, copy visible garments from <Picture 1> exactly. For clothing outside its crop, complete one coherent outfit for this character; this full body front view will define the outfit for all other views.": "<Picture 1> is the original identity reference. <Picture 2> is the full body front view of this same character and the fixed wardrobe reference. Reproduce that exact outfit from the requested camera angle. Keep identical garment types, layers, cuts, lengths, fit, seams, closures, patterns, colors, fabric, footwear, jewelry and accessories. Do not add, remove, replace, restyle or recolor any clothing. Preserve anatomical left/right placement of asymmetric details when turning the character. Infer only hidden surfaces consistently with the same garments." + (index === 0 ? " Use frontal close-up framing while retaining the exact visible upper-body clothing." : " Change the camera angle from <Picture 2> to the requested side or back view.");const selectedReference = index === 1 ? reference : { ...reference, images: [...reference.images!, { id: "character-sheet-front", name: "Full body front wardrobe reference", relativePath: frontRelativePath }] };- const instructions = [options.prompt.trim() && `Template instructions: ${options.prompt.trim()}`, options.clothing.trim() && `Clothing and accessories: ${options.clothing.trim()}`].filter(Boolean).join("\n");+ const instructions = options.prompt.trim() ? `Template instructions: ${options.prompt.trim()}` : "";const scene = createImageScene(`Create a character reference view of @[ref:${reference.id}]. ${view.description} ${wardrobe} Preserve the character's identity. Use a plain light gray background and soft even studio lighting unless the template instructions specify otherwise. Render no text, labels, borders, additional characters or multiple views. Match the source image's visual style.\n${instructions}`);scene.style = { mode: "art", medium: "the same visual medium and rendering style as <Picture 1>", aesthetics: "", lighting: "", detail: "" };return compileImagePrompt({