Fix smart select visualization and inpaint API

Frontend:
- Fix smart_select.js to properly render mask overlay
- Add marching ants border around selection
- Calculate selection bounds from mask
- Trigger re-render after mask is loaded

Backend:
- Fix inpaint endpoint to call edit_image() instead of inpaint()
- The AI providers use edit_image() method, not inpaint()
This commit is contained in:
Claude
2026-01-26 18:26:12 +00:00
parent f0ea7df6b7
commit cfe487e2ed
2 changed files with 57 additions and 43 deletions
+9 -11
View File
@@ -89,28 +89,26 @@ async def inpaint_base64(request: InpaintRequest):
if mask_img.size != img.size:
mask_img = mask_img.resize(img.size, Image.Resampling.LANCZOS)
# Get the AI provider and run inpainting
# Get the AI provider
from app.services.ai_provider import get_ai_provider
from app.config import settings
provider = get_ai_provider()
# Convert images to format expected by provider
# Convert images to bytes for provider
img_buffer = BytesIO()
img.save(img_buffer, format='PNG')
img_buffer.seek(0)
img_bytes = img_buffer.getvalue()
mask_buffer = BytesIO()
mask_img.save(mask_buffer, format='PNG')
mask_buffer.seek(0)
mask_bytes_png = mask_buffer.getvalue()
# Run inpainting
result_bytes = await provider.inpaint(
image=img_buffer,
mask=mask_buffer,
# Run inpainting using edit_image method
result_bytes = await provider.edit_image(
patch_image_bytes=img_bytes,
mask_image_bytes=mask_bytes_png,
prompt=request.prompt,
negative_prompt=request.negative_prompt,
strength=request.strength
mode="A" # Patch-only mode
)
# Convert result to base64