mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #19930] [CLOSED] fix: make image generation/edit context visible to LLM and harden missing chat_id handling #64252
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/19930
Author: @belugaming
Created: 12/13/2025
Status: ❌ Closed
Base:
dev← Head:main📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/dev0397d2dRefactor chat_image_generation_handler to handle missing chat_id gracefully and improve event emission logic. Ensure proper status updates for image generation and error handling, while enhancing system message content for clarity.d633fe6docs: add PR description template837c6f2docs: update PR testing notes3ea5309delete PR.MD📊 Changes
1 file changed (+99 additions, -71 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+99 -71)📄 Description
Pull Request Checklist
Note to first-time contributors
If required, a Discussion was opened to describe the bug/fix and gather feedback before submitting this PR.
Before submitting, make sure you've checked the following:
devbranch.fix:.Description
Fix server-side image generation/edit flow so the LLM reliably knows an image operation happened (even for text-only models), and harden the handler against missing
chat_idand missing websocket emitter in error paths.Related issue: open-webui/open-webui#19702
Changelog Entry
Description
Improve
chat_image_generation_handlerrobustness and make the final prompt used for image generation/edit visible to the LLM via system context injection.Fixed
AttributeErrorwhenchat_idis missing (avoidchat_id.startswith(...)onNone)."None"from being sent as an image generation prompt whenpromptisNone.<context>so text-only models can acknowledge image operations consistently.Additional Information
backend/open_webui/utils/middleware.py(chat_image_generation_handler).Testing (Manual)
deepseek-v3.1:671b-cloudchat_idis missing (no websocket emitter available).Screenshots or Videos
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.