Skip to content

feat(aionrs): inline image attachments for Aion CLI#589

Open
s-yanev wants to merge 3 commits into
iOfficeAI:mainfrom
s-yanev:image-support-aion-cli
Open

feat(aionrs): inline image attachments for Aion CLI#589
s-yanev wants to merge 3 commits into
iOfficeAI:mainfrom
s-yanev:image-support-aion-cli

Conversation

@s-yanev

@s-yanev s-yanev commented Jul 7, 2026

Copy link
Copy Markdown

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.toml to the new aionrs version.

How it works

When a user attaches an image to an Aion CLI conversation:

  1. AionUi sends content like: user text\n\n[[AION_FILES]]\n/path/to/image.png plus a files array
  2. enrich_content_with_files() reads the image, base64-encodes it, and replaces the path with data:image/png;base64,...
  3. The aionrs engine parses the marker and creates proper text + image content blocks
  4. The provider serializes those blocks into the correct OpenAI/Anthropic multimodal format

Files changed

  • crates/aionui-ai-agent/src/manager/aionrs/agent.rs
    • Added enrich_content_with_files() to inline image file paths as data URIs
  • crates/aionui-ai-agent/src/manager/aionrs/history_sanitize.rs
    • Handle ContentBlock::Image in history sanitization

Testing

  • Built locally with modified aionrs
  • Verified Aion CLI can now receive and process attached images

s-yanev and others added 3 commits July 7, 2026 18:29
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
@s-yanev s-yanev marked this pull request as ready for review July 10, 2026 13:45
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