Skip to content

feat(flow-chat): render view_image previews inline#1595

Open
wgqqqqq wants to merge 1 commit into
GCWing:mainfrom
wgqqqqq:feat/view-image-inline-preview
Open

feat(flow-chat): render view_image previews inline#1595
wgqqqqq wants to merge 1 commit into
GCWing:mainfrom
wgqqqqq:feat/view-image-inline-preview

Conversation

@wgqqqqq

@wgqqqqq wgqqqqq commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • carry optional tool image attachments through completed tool events and persisted session history
  • render successful view_image results as a compact, auto-expanded image attachment in Flow Chat
  • open the thumbnail in the existing large image modal and keep unsupported MIME types out of the DOM
  • use the backend-produced attachment instead of reading toolCall.input.path in the UI, so local, web, peer-device, and remote workspace flows share the same rendering path

Closes #1490

Prior contribution

This work builds on the product need reported by @liuxingyu521 in #1490 and the dedicated Flow Chat image-preview direction first implemented and demonstrated by @liuxingyu521 in #1491. That PR established the value of showing view_image output directly in the conversation and provided the first card/preview implementation.

This PR carries that contribution forward on the latest main after #1491 was closed for being stale. It preserves the dedicated-card UX while addressing the remote-workspace concern raised in that discussion: image bytes now come from the tool's existing ToolImageAttachment, flow through the stable completed-event contract, and survive session history restoration instead of requiring the frontend to reopen a local path.

Type and Areas

Type: Feature / UI/UX

Areas: Rust core, event contracts, session persistence, Web UI

Verification

  • pnpm run type-check:web
  • pnpm --dir src/web-ui run test:run src/flow_chat/tool-cards/ViewImageToolCard.test.tsx src/flow_chat/services/flow-chat-manager/ToolEventModule.test.ts (13 tests passed)
  • pnpm run i18n:audit
  • cargo test -p bitfun-events -p tool-runtime completed (6 focused tests passed)
  • cargo test -p bitfun-core view_image_reads_remote_workspace_relative_image
  • cargo check -p bitfun-core -p bitfun-events -p tool-runtime -p bitfun-services-core -p bitfun-acp

Reviewer Notes

  • image_attachments is optional on the event and persistence DTOs, preserving compatibility with existing tool results and saved sessions.
  • The preview accepts only PNG, JPEG, GIF, WebP, and BMP attachments. The backend already optimizes the image to provider limits before attaching it.
  • The compact row and 160px thumbnail follow the image-attachment presentation suggested in the feat(web-ui): 为 view_image 工具增加对话内图片预览卡片 #1491 discussion; clicking the thumbnail opens the existing modal.
  • AI-assisted implementation; verification level: focused automated checks plus remote-workspace regression coverage.

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.

[Feature]: view_image Tool 工具把图片展示在界面上

1 participant