mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-21 06:04:23 +01:00
fix(agent): Fix artifact download method & response
- Update the return type of the `AgentProtocolServer.get_artifact` method to `StreamingResponse`. - Fix the Content-Disposition header in the response to include quotes around the filename.
This commit is contained in:
@@ -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}"'
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user