AI media harness for planning, generating, and editing locally
TypeScript
Remove mask wording from image edit prompts
Bitti8c19d569c1be
diff --git a/src/lib/imageEditing.test.ts b/src/lib/imageEditing.test.tsindex e04ab60..22cd1c8 100644--- a/src/lib/imageEditing.test.ts+++ b/src/lib/imageEditing.test.ts@@ -29,6 +29,7 @@ it("uses hierarchy order, skips empty groups, and converts boxes to original pixexpect(edits[0].prompt).toContain("<Picture 1> ([Shot 1] edited keyframe): partially_preserved");expect(edits[0].prompt).toContain("[Shot 1] The edited keyframe corresponds to <Picture 1>");expect(edits[0].prompt).not.toMatch(/<Subject|video editing|A still photograph/);+ for (const edit of edits) expect(edit.prompt).not.toMatch(/\b(box|mask\w*|rectangle|region|boundary|border|pixels?)\b/i);scene.nodes[3].box = null;expect(() => compileImageEdits(config)).toThrow("placement box");});@@ -43,6 +44,7 @@ it("reserves Picture 1 for the source and counts it toward H3's nine-picture limexpect(prompt).toContain("<Subject 1> is Reference 0, providing appearance from <Picture 2>");expect(prompt).toContain("<Subject 8> is Reference 7, providing appearance from <Picture 9>");expect(prompt).toContain("[keyframe completion + reference generation]");+ expect(prompt).not.toMatch(/\b(box|mask\w*|rectangle|region|boundary|border|pixels?)\b/i);config.imageScene.referenceIds.push("ref-8");expect(() => compileImageEdits(config)).toThrow("at most nine reference images");});diff --git a/src/lib/imageEditing.ts b/src/lib/imageEditing.tsindex 7e3d164..d4bd60b 100644--- a/src/lib/imageEditing.ts+++ b/src/lib/imageEditing.ts@@ -18,7 +18,7 @@ export function compileImageEdits(config: ProjectConfig): { source: ImageSource;const y = Math.min(source.height - 1, Math.floor(node.box.y * source.height / 1000));const right = Math.min(source.width, Math.ceil((node.box.x + node.box.width) * source.width / 1000));const bottom = Math.min(source.height, Math.ceil((node.box.y + node.box.height) * source.height / 1000));- const description = ["The edited keyframe corresponds to <Picture 1>, with the following change confined to the masked rectangle. Preserve the surrounding composition and any previously completed edits.", node.description,+ const description = ["The edited keyframe corresponds to <Picture 1> with the following change. Preserve the composition and any previously completed edits.", node.description,node.text ? `Render the exact text "${node.text}".` : "", node.colors.length ? `Use these colors: ${node.colors.join(", ")}.` : ""].filter(Boolean).join(" ");const editScene = { ...createImageScene(description), rootType: "image" as const, sourceImage: source, referenceIds: scene.referenceIds };const compiled = compileImagePrompt({ ...config, settings: { ...config.settings, defaultLook: null }, imageScene: editScene });diff --git a/src/lib/imagePrompt.ts b/src/lib/imagePrompt.tsindex ac24e2b..675c251 100644--- a/src/lib/imagePrompt.ts+++ b/src/lib/imagePrompt.ts@@ -40,10 +40,10 @@ export function compileImagePrompt(config: ProjectConfig) {const retention = subjects.map((subject, index) => `${label(index)} (appears in [Shot 1]): fully_preserved - retain the referenced ${subject.role} of ${subject.name} while following the requested composition and styling.`);if (editing) {definitions.unshift("<Picture 1> is the original source image and composition anchor for the edited still keyframe in [Shot 1], providing the framing, perspective, environment, lighting and visual style.");- retention.unshift("<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics while changing the requested region. Preserve all pixels outside the edit box, including any previously completed edits.");+ retention.unshift("<Picture 1> ([Shot 1] edited keyframe): partially_preserved - retain its composition and visual characteristics except for the described change. Preserve all other content, including any previously completed edits.");}const summary = editing- ? `[keyframe completion${subjects.length ? " + reference generation" : ""}] The target is a single edited still keyframe based on <Picture 1>. Apply the described change only inside the edit box.${subjects.length ? ` Use ${subjects.map((_, index) => label(index)).join(", ")} for the specified reference attributes.` : ""}`+ ? `[keyframe completion${subjects.length ? " + reference generation" : ""}] The target is a single edited still keyframe based on <Picture 1>. Apply the described change while preserving all other content.${subjects.length ? ` Use ${subjects.map((_, index) => label(index)).join(", ")} for the specified reference attributes.` : ""}`: `[reference generation] A single still image uses ${subjects.map((_, index) => label(index)).join(", ")} in the requested composition.`;const style = editing ? "The still image retains the visual medium, lighting, palette and perspective of <Picture 1>." : visual.style;return { prompt: [