From e8b88fcead867e247cd2a5bb7e8fd81250425631 Mon Sep 17 00:00:00 2001 From: AI Bot Date: Mon, 5 Oct 2026 12:48:43 +0530 Subject: [PATCH] feat: improve AI layer editing UI, enforce aspect ratio matching through system prompt constraints --- src/components/UVEditor.tsx | 58 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/components/UVEditor.tsx b/src/components/UVEditor.tsx index 6fa93f0..7231d31 100644 --- a/src/components/UVEditor.tsx +++ b/src/components/UVEditor.tsx @@ -69,7 +69,11 @@ export function UVEditor({ onClose, onSave, targetObject, loadedModel, sceneObje ctx.drawImage(layer.img, 0, 0); const base64 = tempCanvas.toDataURL('image/png'); - const newUrl = await editUVLayer(aiPrompt, base64, token || ''); + const fullPrompt = `The user has provided an image layer. Please apply the following edit exactly as requested, while strictly maintaining the EXACT same aspect ratio, resolution, and general structure of the original image. +User Prompt: "${aiPrompt}" +Negative constraints: Do NOT change the aspect ratio. Do NOT add completely unrelated elements. Do NOT crop the image boundaries.`; + + const newUrl = await editUVLayer(fullPrompt, base64, token || ''); if (!originalLayerUrl && !regenerate) { setOriginalLayerUrl(layer.url); @@ -485,42 +489,44 @@ export function UVEditor({ onClose, onSave, targetObject, loadedModel, sceneObje {/* AI Layer Edit */}

- AI Texture Edit + ✨ Edit with AI

- {aiPreviewUrl ? ( -
-

Review AI Generation:

+
+ {isEditingLayer && ( +
+ + Generating... +
+ )} +