Skip to content

fix(wework): enlarge generated image previews - #2098

Merged
qdaxb merged 2 commits into
mainfrom
fix/image-generation-lightbox
Jul 21, 2026
Merged

qdaxb merged 2 commits into
mainfrom
fix/image-generation-lightbox

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • make image_generation result previews clickable
  • reuse the existing attachment lightbox with zoom, download, close, and gallery navigation
  • add regression coverage for opening generated images in the lightbox

Why

Generated image results were rendered as plain images, so users could not inspect them at full size.

Validation

  • pnpm --filter wework test (189 files, 1888 tests)
  • pnpm --filter wework typecheck
  • ESLint and typography checks via pre-commit/pre-push hooks
  • isolated real-Tauri verification: generated preview, open lightbox, zoom to 125%, close and restore conversation

Summary by CodeRabbit

  • New Features

    • Generated images now support an enlarged preview experience when selected, including preview zoom interactions.
    • Image previews within chat attachments now use a more consistent gallery presentation and behavior across generated-image artifacts.
  • Bug Fixes

    • Improved rendering of assistant-generated image artifacts in chat messages, with more reliable preview display.
  • Tests

    • Expanded automated coverage for generated image preview/lightbox behavior and zoom interactions.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d087b3a8-effb-4d78-b11a-9bd6b568af2d

📥 Commits

Reviewing files that changed from the base of the PR and between bf0096b and 8eece17.

📒 Files selected for processing (2)
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx

📝 Walkthrough

Walkthrough

Generated assistant images are memoized, converted into attachment metadata, and rendered through shared preview and lightbox components. Tests now cover image data URLs, enlarged previews, and zoom interactions.

Changes

Generated image preview

Layer / File(s) Summary
Generated image attachment and preview rendering
wework/src/components/chat/MessageList.tsx
Display blocks and generated images are memoized; image artifacts become deterministic PNG attachments rendered through AttachmentImagePreview.
Generated image preview interaction test
wework/src/components/chat/MessageList.test.tsx
The test verifies the generated image data URL, lightbox source and alternative text, and zoom changes after user interactions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • wecode-ai/Wegent#1940: Added renderPayload support and image-generation tool-block rendering used by this flow.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: generated image previews are enlarged and shown in the lightbox.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/image-generation-lightbox

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qdaxb
qdaxb marked this pull request as ready for review July 21, 2026 09:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/components/chat/MessageList.tsx`:
- Around line 1861-1910: Memoize the attachments array in the generated-image
gallery using the existing images input, so its reference remains stable when
images have not changed. Reuse this memoized value as galleryAttachments for
each GeneratedImagePreview, and avoid recreating the array during unrelated
renders.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af0a9d5a-6870-49a9-8f84-e928d9bb1503

📥 Commits

Reviewing files that changed from the base of the PR and between 97db727 and bf0096b.

📒 Files selected for processing (2)
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx

@qdaxb
qdaxb merged commit b5c599d into main Jul 21, 2026
29 checks passed
@qdaxb
qdaxb deleted the fix/image-generation-lightbox branch July 21, 2026 10:43
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.

1 participant