fix: include scale adjust region prompt

This commit is contained in:
134 2026-07-02 18:14:51 +08:00
parent a8c5c14656
commit 87d2960713

View File

@ -1591,6 +1591,10 @@ function buildScaleAdjustCoordinatePrompt(
const sourceBottom = region.pixelRect.top + region.pixelRect.height;
const targetRight = targetPixelRect.left + targetPixelRect.width;
const targetBottom = targetPixelRect.top + targetPixelRect.height;
const regionUserInstruction = region.prompt.trim();
const userInstructionLine = regionUserInstruction
? ` User instruction for this region: ${regionUserInstruction}.`
: "";
const isShrink = widthFactor < 0.92 || heightFactor < 0.92;
const isEnlarge = widthFactor > 1.08 || heightFactor > 1.08;
const scaleDirection =
@ -1626,7 +1630,7 @@ function buildScaleAdjustCoordinatePrompt(
: "Keep the surrounding room stable.";
return `Region ${region.index}: current furniture box in source photo left=${region.pixelRect.left}, top=${region.pixelRect.top}, right=${sourceRight}, bottom=${sourceBottom}, width=${region.pixelRect.width}, height=${region.pixelRect.height}; requested final footprint left=${targetPixelRect.left}, top=${targetPixelRect.top}, right=${targetRight}, bottom=${targetBottom}, width=${targetPixelRect.width}, height=${targetPixelRect.height}; scale factor width=${widthFactor.toFixed(2)}, height=${heightFactor.toFixed(2)}. Edit direction: ${actionPhrase}. ${blendPhrase}${cropNote}`;
}
return `Region ${region.index}: OLD search box in input 1 left=${region.pixelRect.left}, top=${region.pixelRect.top}, right=${sourceRight}, bottom=${sourceBottom}, width=${region.pixelRect.width}, height=${region.pixelRect.height}; TARGET final visual footprint left=${targetPixelRect.left}, top=${targetPixelRect.top}, right=${targetRight}, bottom=${targetBottom}, width=${targetPixelRect.width}, height=${targetPixelRect.height}; target scale is ${widthFactor.toFixed(2)}x width and ${heightFactor.toFixed(2)}x height. Main action: ${scaleDirection}. The final furniture silhouette must clearly leave the OLD footprint edges and align much closer to TARGET than OLD; returning an almost unchanged furniture footprint is not acceptable. ${footprintRule}${cropNote}`;
return `Region ${region.index}: OLD search box in input 1 left=${region.pixelRect.left}, top=${region.pixelRect.top}, right=${sourceRight}, bottom=${sourceBottom}, width=${region.pixelRect.width}, height=${region.pixelRect.height}; TARGET final visual footprint left=${targetPixelRect.left}, top=${targetPixelRect.top}, right=${targetRight}, bottom=${targetBottom}, width=${targetPixelRect.width}, height=${targetPixelRect.height}; target scale is ${widthFactor.toFixed(2)}x width and ${heightFactor.toFixed(2)}x height. Main action: ${scaleDirection}.${userInstructionLine} The final furniture silhouette must clearly leave the OLD footprint edges and align much closer to TARGET than OLD; returning an almost unchanged furniture footprint is not acceptable. ${footprintRule}${cropNote}`;
})
.join("\n");
const cropLines = cropReferences