Restructure SAM rough mask workflow for sidebar preview

- Add roughMaskThumbnailScale state with $watch to sync with main scale slider
- Update sidebar thumbnail to use transform:scale() for consistent zoom between views
- Modify openRoughMaskInNewWindow() to create HTML page with matching scale
- Add denoise strength slider (10-100%) visible only when rough mask exists
- Backend already supports denoise_strength parameter in prepare_mask_workflow_with_start()
- Rough mask auto-clears after successful extraction
- Add Playwright tests for UI changes and API parameter acceptance
This commit is contained in:
2026-03-28 10:42:27 -07:00
parent c94988561c
commit 7c9a25dd91
6 changed files with 240 additions and 72 deletions

View File

@@ -279,6 +279,7 @@ class ComfyUIService:
polygon_points: list | None = None,
polygon_color: str = '#FF0000',
polygon_width: int = 2,
denoise_strength: float = 0.8,
workflow_template: dict | None = None
) -> dict:
"""Prepare the mask extraction workflow with a starting mask (lower denoise)."""
@@ -319,6 +320,9 @@ class ComfyUIService:
if "50" in workflow and 'inputs' in workflow["50"]:
workflow["50"]["inputs"]["seed"] = seed
if "1:65" in workflow and 'inputs' in workflow["1:65"]:
workflow["1:65"]["inputs"]["denoise"] = denoise_strength
if "96" in workflow and 'inputs' in workflow["96"]:
metadata = f"{batch_id}:{mask_index}" if batch_id else str(mask_index)
workflow["96"]["inputs"]["external_uid"] = metadata