mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-01 04:14:24 +01:00
fix(agent/workspace): Fix GCS workspace binary file upload
This commit is contained in:
@@ -339,7 +339,6 @@ class AgentProtocolServer:
|
||||
"""
|
||||
Create an artifact for the task.
|
||||
"""
|
||||
data = None
|
||||
file_name = file.filename or str(uuid4())
|
||||
data = b""
|
||||
while contents := file.file.read(1024 * 1024):
|
||||
|
||||
@@ -75,10 +75,15 @@ class GCSFileWorkspace(FileWorkspace):
|
||||
"""Write to a file in the workspace."""
|
||||
blob = self._get_blob(path)
|
||||
|
||||
if isinstance(content, str):
|
||||
blob.upload_from_string(content)
|
||||
else:
|
||||
blob.upload_from_file(content)
|
||||
blob.upload_from_string(
|
||||
data=content,
|
||||
content_type=(
|
||||
"text/plain"
|
||||
if type(content) is str
|
||||
# TODO: get MIME type from file extension or binary content
|
||||
else "application/octet-stream"
|
||||
),
|
||||
)
|
||||
|
||||
if self.on_write_file:
|
||||
path = Path(path)
|
||||
|
||||
Reference in New Issue
Block a user