Skip to content

fix(file): save uploads to conversation workspace#352

Open
xiaolaili wants to merge 2 commits into
iOfficeAI:mainfrom
xiaolaili:fix/upload-save-to-workspace
Open

fix(file): save uploads to conversation workspace#352
xiaolaili wants to merge 2 commits into
iOfficeAI:mainfrom
xiaolaili:fix/upload-save-to-workspace

Conversation

@xiaolaili
Copy link
Copy Markdown

Problem

File uploads currently ignore the save_upload_to_workspace setting.

When system_settings.save_upload_to_workspace is enabled, files uploaded from a conversation should be saved into that conversation's workspace directory. Instead, the upload service always writes to the process temp directory under aionui/<conversation_id>.

Example from a container deployment:

  • Expected: /data/conversations/claude-temp-a119bb34/<file>
  • Actual: /data/config/temp/aionui/a119bb34/<file>

This makes uploaded files unavailable from the active conversation workspace even though the UI setting says uploads should be saved there.

Root Cause

The file upload path in aionui-file only uses std::env::temp_dir().join("aionui"). After the v2 migration to AionCore, the upload service does not resolve:

  • system_settings.save_upload_to_workspace
  • the current conversation by conversation_id
  • the workspace path stored in conversation.extra.workspace

Changes

  • Inject settings and conversation repositories into FileService.
  • Honor system_settings.save_upload_to_workspace for /api/fs/upload.
  • When enabled and a valid conversation_id is provided, resolve the conversation workspace from conversation.extra.workspace and save uploads there.
  • Preserve existing temp-directory fallback behavior when:
    • no conversation_id is provided
    • the setting is disabled or missing
    • the conversation cannot be found
    • the conversation has no valid workspace metadata
  • Add unit and E2E coverage for workspace upload behavior.

Testing

  • cargo fmt --all -- --check
  • cargo test -p aionui-file
  • cargo test -p aionui-app --test file_e2e
  • cargo clippy -p aionui-file -p aionui-app -- -D warnings

xiaolaili added 2 commits May 28, 2026 09:07
In Docker-hosted AionUI web mode, the conversation page can prime /api/fs/list while the auto-created workspace is still empty. If the user uploads a file into that workspace afterwards, the cached empty file list keeps @ file search from finding the new document.

Invalidate the workspace file list cache after a successful upload so file mentions see newly uploaded files in the current conversation workspace.

Tested: docker run --rm -v /Users/xzh/workspace/harness/AionCore:/workspace -w /workspace -e CARGO_TARGET_DIR=/tmp/aioncore-target rust:1.95.0 cargo test -p aionui-file create_upload_file_invalidates_workspace_file_list_cache

Tested: docker run --rm -v /Users/xzh/workspace/harness/AionCore:/workspace -w /workspace rust:1.95.0 cargo fmt --all -- --check
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