[PR #20182] [CLOSED] fix: filter ComfyUI output to only SaveImage/PreviewImage nodes #25494

Closed
opened 2026-04-20 05:57:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20182
Author: @MirrorDNA-Reflection-Protocol
Created: 12/26/2025
Status: Closed

Base: devHead: fix/comfyui-duplicate-images-20158


📝 Commits (9)

📊 Changes

1 file changed (+4 additions, -3 deletions)

View changed files

📝 backend/open_webui/utils/images/comfyui.py (+4 -3)

📄 Description

Pull Request Checklist

  • Target branch: Verify that the pull request targets the dev branch.
  • Description: Provided below.
  • Changelog: Included below.
  • Documentation: No documentation changes needed.
  • Dependencies: No new dependencies.
  • Testing: Code reviewed and logic verified against issue description.
  • Agentic AI Code: This is a simple logic fix, manually reviewed.
  • Code review: Self-reviewed.
  • Title Prefix: Using fix: prefix.

Changelog Entry

Description

Fixes #20158 — When using complex ComfyUI workflows, Open WebUI was displaying multiple duplicate images from internal processing nodes (masks, crops, segmentation previews) instead of just the final output images.

Fixed

  • Removed redundant nested loop in get_images() function that was iterating over history['outputs'] twice
  • Added filter to only include images from nodes with class_type of SaveImage or PreviewImage
  • This prevents intermediate IMAGE outputs from nodes like MaskToImage, CutByMask, or FaceSegmentation from appearing in chat

Additional Information

File Changed: backend/open_webui/utils/images/comfyui.py

Before:

for o in history['outputs']:
    for node_id in history['outputs']:
        node_output = history['outputs'][node_id]
        if 'images' in node_output:
            # retrieves ALL images, including intermediate ones

After:

for node_id in history['outputs']:
    node_output = history['outputs'][node_id]
    if node_id in prompt and prompt[node_id].get('class_type') in ['SaveImage', 'PreviewImage']:
        if 'images' in node_output:
            # Only retrieves intended output images

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/20182 **Author:** [@MirrorDNA-Reflection-Protocol](https://github.com/MirrorDNA-Reflection-Protocol) **Created:** 12/26/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/comfyui-duplicate-images-20158` --- ### 📝 Commits (9) - [`fe6783c`](https://github.com/open-webui/open-webui/commit/fe6783c16699911c7be17392596d579333fb110c) Merge pull request #19030 from open-webui/dev - [`fc05e0a`](https://github.com/open-webui/open-webui/commit/fc05e0a6c5d39da60b603b4d520f800d6e36f748) Merge pull request #19405 from open-webui/dev - [`e3faec6`](https://github.com/open-webui/open-webui/commit/e3faec62c58e3a83d89aa3df539feacefa125e0c) Merge pull request #19416 from open-webui/dev - [`9899293`](https://github.com/open-webui/open-webui/commit/9899293f050ad50ae12024cbebee7e018acd851e) Merge pull request #19448 from open-webui/dev - [`140605e`](https://github.com/open-webui/open-webui/commit/140605e660b8186a7d5c79fb3be6ffb147a2f498) Merge pull request #19462 from open-webui/dev - [`6f1486f`](https://github.com/open-webui/open-webui/commit/6f1486ffd0cb288d0e21f41845361924e0d742b3) Merge pull request #19466 from open-webui/dev - [`d95f533`](https://github.com/open-webui/open-webui/commit/d95f533214e3fe5beb5e41ec1f349940bc4c7043) Merge pull request #19729 from open-webui/dev - [`a727153`](https://github.com/open-webui/open-webui/commit/a7271532f8a38da46785afcaa7e65f9a45e7d753) 0.6.43 (#20093) - [`e44cd99`](https://github.com/open-webui/open-webui/commit/e44cd997b2757d39fca6a3f0ba3f3bb1ae54fa3e) fix: filter ComfyUI output to only SaveImage/PreviewImage nodes (#20158) ### 📊 Changes **1 file changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/images/comfyui.py` (+4 -3) </details> ### 📄 Description # Pull Request Checklist - [x] **Target branch:** Verify that the pull request targets the `dev` branch. - [x] **Description:** Provided below. - [x] **Changelog:** Included below. - [x] **Documentation:** No documentation changes needed. - [x] **Dependencies:** No new dependencies. - [x] **Testing:** Code reviewed and logic verified against issue description. - [x] **Agentic AI Code:** This is a simple logic fix, manually reviewed. - [x] **Code review:** Self-reviewed. - [x] **Title Prefix:** Using `fix:` prefix. # Changelog Entry ### Description Fixes #20158 — When using complex ComfyUI workflows, Open WebUI was displaying multiple duplicate images from internal processing nodes (masks, crops, segmentation previews) instead of just the final output images. ### Fixed - Removed redundant nested loop in `get_images()` function that was iterating over `history['outputs']` twice - Added filter to only include images from nodes with `class_type` of `SaveImage` or `PreviewImage` - This prevents intermediate IMAGE outputs from nodes like `MaskToImage`, `CutByMask`, or `FaceSegmentation` from appearing in chat ### Additional Information **File Changed:** `backend/open_webui/utils/images/comfyui.py` **Before:** ```python for o in history['outputs']: for node_id in history['outputs']: node_output = history['outputs'][node_id] if 'images' in node_output: # retrieves ALL images, including intermediate ones ``` **After:** ```python for node_id in history['outputs']: node_output = history['outputs'][node_id] if node_id in prompt and prompt[node_id].get('class_type') in ['SaveImage', 'PreviewImage']: if 'images' in node_output: # Only retrieves intended output images ``` ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 05:57:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#25494