Skip to content

Improve attachment file handling #2576

@wwwillchen

Description

@wwwillchen

There's two main issues with our attachment file handling:

  1. We use synthetic file ids and replace them magically with file contents, which confuses the AI and can lead it down rabbit holes.
  2. You can't preview the attachment files in the chat UI.

Current state:
When you upload files, we generate file ids in chat stream handler and then resolve the file id to content in write_file

Proposed state:
Instead what we should do is have proper temp paths and then allow the AI to copy files from the temp path into the codebase. This is less magical to the AI, and if we do this for "attach as chat context" as well, then the user could prompt the user to say "actually let's use this in the app itself" and the AI could copy the image file (right now this isn't possible). We'll probably need to introduce a new tool called copy_file to support this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions