mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-05 12:25:04 -05:00
When CoPilot executes blocks that produce binary outputs (code execution results with png/jpeg/pdf/svg fields), the data is now automatically saved to the user's workspace and replaced with workspace:// references. This reduces output token usage by ~97% for file generation tasks (observed: 17k -> 500 tokens for a PDF) and prevents data corruption from LLM truncation/hallucination of base64 strings. Detection is field-name based (png, jpeg, pdf, svg) which targets the standard e2b CodeExecutionResult fields. Other image-producing blocks already use store_media_file() and don't need this post-processing. Features: - Automatic detection and saving of binary content >1KB - Content deduplication within single block execution via SHA-256 hash - Graceful degradation (original value preserved on save failure) - Support for both raw base64 and data URI formats Closes SECRT-1887