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.

AutoGPT: Fix artifact download

Reinier van der Leer11eeaeb4b95e
diff --git a/autogpts/autogpt/autogpt/app/agent_protocol_server.py b/autogpts/autogpt/autogpt/app/agent_protocol_server.py
index 4bfc1940ef..08b2f2125e 100644
--- a/autogpts/autogpt/autogpt/app/agent_protocol_server.py
+++ b/autogpts/autogpt/autogpt/app/agent_protocol_server.py
@@ -334,7 +334,7 @@ class AgentProtocolServer:
else:
file_path = artifact.relative_path
workspace = get_task_agent_file_workspace(task_id, self.agent_manager)
- retrieved_artifact = workspace.read_file(file_path)
+ retrieved_artifact = workspace.read_file(file_path, binary=True)
except NotFoundError as e:
raise
except FileNotFoundError as e:
diff --git a/autogpts/autogpt/autogpt/file_workspace/file_workspace.py b/autogpts/autogpt/autogpt/file_workspace/file_workspace.py
index 7fe918b6e4..37da359e1a 100644
--- a/autogpts/autogpt/autogpt/file_workspace/file_workspace.py
+++ b/autogpts/autogpt/autogpt/file_workspace/file_workspace.py
@@ -60,9 +60,9 @@ class FileWorkspace:
full_path = self.get_path(path)
return open(full_path, mode)
- def read_file(self, path: str | Path):
+ def read_file(self, path: str | Path, binary: bool = False):
"""Read a file in the workspace."""
- with self.open_file(path, "r") as file:
+ with self.open_file(path, "rb" if binary else "r") as file:
return file.read()
def write_file(self, path: str | Path, content: str | bytes):