Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(agent): Fix artifact download method & response

Reinier van der Leera17f752705f7
diff --git a/autogpts/autogpt/autogpt/app/agent_protocol_server.py b/autogpts/autogpt/autogpt/app/agent_protocol_server.py
index 3bd3ce683c..99eb598ed8 100644
--- a/autogpts/autogpt/autogpt/app/agent_protocol_server.py
+++ b/autogpts/autogpt/autogpt/app/agent_protocol_server.py
@@ -357,9 +357,9 @@ class AgentProtocolServer:
)
return artifact
- async def get_artifact(self, task_id: str, artifact_id: str) -> Artifact:
+ async def get_artifact(self, task_id: str, artifact_id: str) -> StreamingResponse:
"""
- Get an artifact by ID.
+ Download a task artifact by ID.
"""
try:
artifact = await self.db.get_artifact(artifact_id)
@@ -378,7 +378,7 @@ class AgentProtocolServer:
BytesIO(retrieved_artifact),
media_type="application/octet-stream",
headers={
- "Content-Disposition": f"attachment; filename={artifact.file_name}"
+ "Content-Disposition": f'attachment; filename="{artifact.file_name}"'
},
)