From 4ab60cc7a3f79d181605e3007a9c64528e27e1aa Mon Sep 17 00:00:00 2001 From: 134 Date: Sun, 5 Jul 2026 11:42:50 +0800 Subject: [PATCH] fix: ignore protected person direction in scale drafts --- app/api/canvas/local-edit/route.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/api/canvas/local-edit/route.ts b/app/api/canvas/local-edit/route.ts index c8e2fcb50..a2e8cab31 100644 --- a/app/api/canvas/local-edit/route.ts +++ b/app/api/canvas/local-edit/route.ts @@ -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"