mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-12 07:45:14 -05:00
fix: Preserve binary file data in non-workspace executions
When store_media_file returns a data URI (non-CoPilot graph executions without workspace_id), the result was silently discarded. Binary files would lose their content, keeping only a "[Binary file: N bytes]" placeholder. Now the data URI is stored in content_str on the success path too, not just in the except fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -231,9 +231,12 @@ async def store_sandbox_files(
|
||||
execution_context=execution_context,
|
||||
return_format="for_block_output",
|
||||
)
|
||||
# Result is workspace://... or data:... depending on context
|
||||
if result.startswith("workspace://"):
|
||||
workspace_ref = result
|
||||
elif not file.is_text:
|
||||
# Non-workspace context (graph execution): store_media_file
|
||||
# returned a data URI — use it as content so binary data isn't lost.
|
||||
content_str = result
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to store file {file.name} to workspace: {e}")
|
||||
# For binary files, fall back to data URI to prevent data loss
|
||||
|
||||
Reference in New Issue
Block a user