Skip to content

Improve WebUI generated image workflows and manual model support#575

Open
wowugeng-max wants to merge 9 commits into
chenyme:mainfrom
wowugeng-max:main
Open

Improve WebUI generated image workflows and manual model support#575
wowugeng-max wants to merge 9 commits into
chenyme:mainfrom
wowugeng-max:main

Conversation

@wowugeng-max
Copy link
Copy Markdown

@wowugeng-max wowugeng-max commented Jun 4, 2026

Summary

This PR improves the WebUI image workflow and manual-model experience end to end.

WebUI generated image handling

  • Render generated images returned by chat reliably, including markdown image syntax, bare local image URLs, and base64 image data.
  • Handle stream terminal events so image content emitted near the end of a response is not dropped.
  • Request server-side local media caching for WebUI chat image output via image_config.response_format = local_md, so generated chat images are saved in the existing local media cache and referenced as /v1/files/image?id=... instead of filling browser storage.
  • Keep image and image_edit WebUI requests on local_url, matching the existing image pipeline and admin cache behavior.
  • Add a download action for assistant messages that contain images.

Continuous image editing in chat/image_edit

  • Let WebUI chat and image_edit carry the latest assistant image forward as context for follow-up edits.
  • Do not attach previous images for normal image generation requests, so explicit new-image prompts still start a fresh image.
  • Prefer manually uploaded reference images over automatic conversation context.
  • Strip stale image references from older user turns when sending payloads to avoid accumulating old references.
  • image
image image

Storage and cache safety

  • Avoid writing large data:image/... payloads directly into localStorage.
  • Preserve lightweight image references in chat history and use server-side cached image URLs for new WebUI chat generations.
  • Keep legacy/edge fallback handling for stored image references so existing sessions degrade more gracefully.

Manual model registry/admin UI

  • Add a manual model registry overlay and admin model management UI.
image
  • Route manual imagine/image-style models through the image pipeline when applicable.

  • Expose manual models through the WebUI model list without requiring code changes for each entry.

Why

Before these changes, generated images could fail to render in WebUI chat, follow-up image edits did not reliably reuse the previous image, and base64 image history could quickly exhaust browser localStorage. The image model path already uses the project local media cache; this PR aligns WebUI chat image output with that same server-side cache behavior.

Test Plan

  • node tests/test_webui_image_payload.mjs
  • node tests/test_webui_media_normalization.mjs
  • node --check app/statics/js/webui/chat.js
  • uv run python -m unittest discover -s tests -p 'test_*.py'

Notes

  • New WebUI chat-generated images are requested as local markdown image links and should appear in the existing admin cache under local images.
  • Existing browser history entries that were previously saved as [image omitted from local storage] cannot be reconstructed because the original image bytes were already discarded by that older fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants