Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Added append write

Dillon DuPont3f4a2b76b4a0
diff --git a/libs/python/computer-server/computer_server/handlers/generic.py b/libs/python/computer-server/computer_server/handlers/generic.py
index cdf9df7d30..03472fbda5 100644
--- a/libs/python/computer-server/computer_server/handlers/generic.py
+++ b/libs/python/computer-server/computer_server/handlers/generic.py
@@ -47,9 +47,11 @@ class GenericFileHandler(BaseFileHandler):
except Exception as e:
return {"success": False, "error": str(e)}
- async def write_bytes(self, path: str, content_b64: str) -> Dict[str, Any]:
+ async def write_bytes(self, path: str, content_b64: str, append: bool = False) -> Dict[str, Any]:
try:
- resolve_path(path).write_bytes(base64.b64decode(content_b64))
+ mode = 'ab' if append else 'wb'
+ with open(resolve_path(path), mode) as f:
+ f.write(base64.b64decode(content_b64))
return {"success": True}
except Exception as e:
return {"success": False, "error": str(e)}