diff --git a/backend/open_webui/routers/images.py b/backend/open_webui/routers/images.py index 567745cfa0..7e0cd0626b 100644 --- a/backend/open_webui/routers/images.py +++ b/backend/open_webui/routers/images.py @@ -870,6 +870,9 @@ class EditImageForm(BaseModel): n: int | None = None negative_prompt: str | None = None background: str | None = None + seed: int | None = None + steps: int | None = None + extra_params: dict | None = None @router.post('/edit') @@ -1153,6 +1156,18 @@ async def image_edits( **({'n': form_data.n} if form_data.n else {}), } + if form_data.negative_prompt is not None: + data['negative_prompt'] = form_data.negative_prompt + + if form_data.seed is not None: + data['seed'] = form_data.seed + + if form_data.steps is not None: + data['steps'] = form_data.steps + + if form_data.extra_params: + data['extra_params'] = form_data.extra_params + form_data = ComfyUIEditImageForm( **{ 'workflow': ComfyUIWorkflow( diff --git a/backend/open_webui/utils/images/comfyui.py b/backend/open_webui/utils/images/comfyui.py index 16fce080ab..17a1a5ecec 100644 --- a/backend/open_webui/utils/images/comfyui.py +++ b/backend/open_webui/utils/images/comfyui.py @@ -284,12 +284,14 @@ class ComfyUIEditImageForm(BaseModel): image: str | list[str] prompt: str + negative_prompt: Optional[str] = None width: Optional[int] = None height: Optional[int] = None n: Optional[int] = None steps: Optional[int] = None seed: Optional[int] = None + extra_params: Optional[dict] = None async def comfyui_edit_image(model: str, payload: ComfyUIEditImageForm, client_id, base_url, api_key):