Skip to content

Feature/cap image dimensions - #192

Merged
stippi merged 2 commits into
mainfrom
feature/cap-image-dimensions
Aug 31, 2026
Merged

Feature/cap image dimensions#192
stippi merged 2 commits into
mainfrom
feature/cap-image-dimensions

Conversation

@stippi

@stippi stippi commented Aug 31, 2026

Copy link
Copy Markdown
Owner

No description provided.

stippi added 2 commits August 27, 2026 16:44
Shrink oversized images to a max edge (1568px, matching Anthropic's
server-side limit) once, where they enter a conversation, so the bounded
version is stored and re-sent without repeated resize work as history grows.

- add shared tools_core::cap_base64_image + MAX_IMAGE_EDGE (next to ImageData,
  reachable by mcp_client which does not depend on llm)
- cap user attachments (content.rs) and ACP prompt images
- cap tool sources: browser screenshot capture, view_images load, MCP output
Move image capping into a Render::cap_images hook (default no-op, overridden by
browser/view_images/MCP outputs) invoked by DynTool at two points:

- on creation (invoke), replacing the earlier per-tool inline capping
- on deserialize_output, so sessions persisted before capping (or by an older
  version) get oversized tool-result images corrected on load instead of being
  unresumable when a provider rejects an >8000px image

Also cap oversized user-attached images in the conversation tree when a chat
session is loaded from disk (load_chat_session).
@stippi
stippi merged commit 5bd7cdd into main Aug 31, 2026
5 checks passed
@stippi
stippi deleted the feature/cap-image-dimensions branch August 31, 2026 20:50
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