feat(aionrs): inline image attachments for Aion CLI#589
Open
s-yanev wants to merge 3 commits into
Open
Conversation
Convert attached image file paths to base64 data URIs before passing the user message to the aionrs engine. This enables the Aion CLI backend to send images to the LLM provider using the new image content block support in aionrs. Requires aionrs with image content block support. - crates/aionui-ai-agent/src/manager/aionrs/agent.rs - crates/aionui-ai-agent/src/manager/aionrs/history_sanitize.rs Co-Authored-By: Claude <noreply@anthropic.com>
- Replace enrich_content_with_files with build_content_blocks - Read SendMessageData.files, inline supported images as ContentBlock::Image - Preserve non-image, missing, oversized, and unsupported-format paths as text - Call engine.run_with_blocks(...) instead of engine.run(...) - Add unit tests for text-only, image, non-image, missing, and unsupported-format cases
Resolved conflicts: - Cargo.lock (regenerated under local aionrs patch) - crates/aionui-ai-agent/src/manager/aionrs/agent.rs Kept image-support code (build_content_blocks + run_with_blocks). Preserved runtime-env guard because local aionrs 0.1.38 lacks AgentBootstrap::runtime_env. Reverted main-only v0.2.2 API usage: thinking/thinking_budget CliArgs fields and RateLimited body handling. Verified: - cargo check --workspace - cargo test -p aionui-ai-agent - cargo clippy -p aionui-ai-agent -- -D warnings - cargo fmt --all -- --check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables image attachments to work with the Aion CLI backend by converting attached image file paths to base64 data URIs before passing the message to the aionrs engine.
Depends on
This change requires aionrs to support image content blocks first:
Once that PR is merged and a new aionrs tag is released, this PR should be updated to point
Cargo.tomlto the new aionrs version.How it works
When a user attaches an image to an Aion CLI conversation:
user text\n\n[[AION_FILES]]\n/path/to/image.pngplus afilesarrayenrich_content_with_files()reads the image, base64-encodes it, and replaces the path withdata:image/png;base64,...Files changed
crates/aionui-ai-agent/src/manager/aionrs/agent.rsenrich_content_with_files()to inline image file paths as data URIscrates/aionui-ai-agent/src/manager/aionrs/history_sanitize.rsContentBlock::Imagein history sanitizationTesting