mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-10 23:58:06 -05:00
AutoGPT: Fix artifact download
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user