fix: reuse existing image preview for galleries

This commit is contained in:
ChangeHow
2026-08-13 16:19:06 +08:00
parent efba4f33a7
commit 5d29ef15d3
5 changed files with 114 additions and 178 deletions
@@ -63,14 +63,13 @@ Use this doc when you ask an agent to change tool/header/description behavior.
are limited to 10 MiB, validated as PNG/JPEG/GIF/WebP, and local paths are
fetched through the active runtime before conversion to data URLs. Local
Markdown links whose target has one of
those image suffixes stay links in the text and open the same standard modal
preview as the gallery; image syntax does not insert a large inline image. A
those image suffixes stay links in the text and open the same existing
full-screen image preview as the gallery; image syntax does not insert a
large inline image. A
completed assistant message hydrates at most 12 unique image candidates,
including persisted text parts that omit their optional part-level end time.
The image modal reserves readable title width even for narrow portrait media.
This gallery and modal-preview enhancement is desktop-only. Mobile keeps the
standard Markdown rendering path until a dedicated, non-modal full-screen
image viewer can own safe areas, orientation, and touch gestures coherently.
Gallery clicks do not introduce or alter preview chrome: desktop and mobile
both reuse the pre-existing attachment image preview overlay.
- `read` and `skill` are **static navigation tools** and render via `StaticToolRow`.
- Every other tool, including search/fetch, OpenCode built-ins, custom tools, plugins, and MCP tools, is **expandable** and renders through `ToolPart`.
- The managed `openchamber` plugin tool uses the expandable path and hides its broad protocol input. The plugin supplies the selected action's human description as the native tool title; the UI renders that metadata without owning an action map. The full versioned result envelope renders through the same neutral JSON summary/tree/raw views as other tools, without a tool-specific output card.