fix: ignore protected person direction in scale drafts

This commit is contained in:
134 2026-07-05 11:42:50 +08:00
parent c9b6df55b0
commit 4ab60cc7a3

View File

@ -1103,6 +1103,18 @@ function getScaleAdjustVisualGuidePlacement(params: {
function getScaleAdjustFocusDirection(region: NormalizedLocalEditRegion) {
const text = normalizeScaleAdjustModelText(region.prompt);
const compact = text.replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "");
const protectedDirectionalPerson =
/(?:不要|别|勿|不改变|不能改变|不动|保持|保留|保护|非目标|do not|don't|dont|keep|preserve|without changing).{0,28}(?:left|right|左|右).{0,28}(?:person|people|human|woman|man|model|face|body|人物|人像|人|模特|女人|男人|脸|身体)/.test(
text
) ||
/(?:left|right|左|右).{0,16}(?:person|people|human|woman|man|model|face|body|人物|人像|人|模特|女人|男人|脸|身体).{0,28}(?:不要|别|勿|不改变|不能改变|不动|保持|保留|保护|非目标|do not|don't|dont|keep|preserve|without changing)/.test(
text
) ||
/(?:不要|别|勿|不改变|不能改变|不动|保持|保留|保护|非目标).{0,16}(?:左侧|右侧|左边|右边|左方|右方).{0,16}(?:人物|人像|人|模特|女人|男人|脸|身体)/.test(
compact
);
if (protectedDirectionalPerson) return "";
if (text.includes("left") || compact.includes("左")) return "left";
if (text.includes("right") || compact.includes("右")) return "right";
if (text.includes("top") || compact.includes("上")) return "top";
@ -4773,7 +4785,7 @@ export async function POST(request: NextRequest) {
scaleAdjustPromptStrategy: isScaleAdjustOperation
? scaleAdjustPatchReference
? useScaleAdjustFullFrameStructurePatch
? "full-frame-structure-locked-draft-v1-one-shot"
? "full-frame-structure-locked-draft-v2-protected-direction-one-shot"
: scaleAdjustPatchReference.structureLockedDraft
? "ai-patch-workspace-structure-locked-draft-v87-subject-alpha-clipped-one-shot"
: "ai-patch-workspace-draft-v75-soft-wipe-erase-ghost-one-shot"