fix(file): save uploads to conversation workspace#352
Open
xiaolaili wants to merge 2 commits into
Open
Conversation
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
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.
Problem
File uploads currently ignore the
save_upload_to_workspacesetting.When
system_settings.save_upload_to_workspaceis 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 underaionui/<conversation_id>.Example from a container deployment:
/data/conversations/claude-temp-a119bb34/<file>/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-fileonly usesstd::env::temp_dir().join("aionui"). After the v2 migration to AionCore, the upload service does not resolve:system_settings.save_upload_to_workspaceconversation_idconversation.extra.workspaceChanges
FileService.system_settings.save_upload_to_workspacefor/api/fs/upload.conversation_idis provided, resolve the conversation workspace fromconversation.extra.workspaceand save uploads there.conversation_idis providedTesting
cargo fmt --all -- --checkcargo test -p aionui-filecargo test -p aionui-app --test file_e2ecargo clippy -p aionui-file -p aionui-app -- -D warnings