mirror of https://github.com/kortix-ai/suna.git
fix(upload_file): swap parameters in upload_file calls for consistency across the codebase
This commit is contained in:
parent
34b18954fc
commit
fc71a35675
|
@ -977,9 +977,9 @@ async def initiate_agent_with_files(
|
|||
if hasattr(sandbox, 'fs') and hasattr(sandbox.fs, 'upload_file'):
|
||||
import inspect
|
||||
if inspect.iscoroutinefunction(sandbox.fs.upload_file):
|
||||
await sandbox.fs.upload_file(target_path, content)
|
||||
await sandbox.fs.upload_file(content, target_path)
|
||||
else:
|
||||
sandbox.fs.upload_file(target_path, content)
|
||||
sandbox.fs.upload_file(content, target_path)
|
||||
logger.debug(f"Called sandbox.fs.upload_file for {target_path}")
|
||||
upload_successful = True
|
||||
else:
|
||||
|
|
|
@ -135,7 +135,7 @@ class SandboxFilesTool(SandboxToolsBase):
|
|||
self.sandbox.fs.create_folder(parent_dir, "755")
|
||||
|
||||
# Write the file content
|
||||
self.sandbox.fs.upload_file(full_path, file_contents.encode())
|
||||
self.sandbox.fs.upload_file(file_contents.encode(), full_path)
|
||||
self.sandbox.fs.set_file_permissions(full_path, permissions)
|
||||
|
||||
message = f"File '{file_path}' created successfully."
|
||||
|
@ -219,7 +219,7 @@ class SandboxFilesTool(SandboxToolsBase):
|
|||
|
||||
# Perform replacement
|
||||
new_content = content.replace(old_str, new_str)
|
||||
self.sandbox.fs.upload_file(full_path, new_content.encode())
|
||||
self.sandbox.fs.upload_file(new_content.encode(), full_path)
|
||||
|
||||
# Show snippet around the edit
|
||||
replacement_line = content.split(old_str)[0].count('\n')
|
||||
|
@ -294,7 +294,7 @@ class SandboxFilesTool(SandboxToolsBase):
|
|||
if not self._file_exists(full_path):
|
||||
return self.fail_response(f"File '{file_path}' does not exist. Use create_file to create a new file.")
|
||||
|
||||
self.sandbox.fs.upload_file(full_path, file_contents.encode())
|
||||
self.sandbox.fs.upload_file(file_contents.encode(), full_path)
|
||||
self.sandbox.fs.set_file_permissions(full_path, permissions)
|
||||
|
||||
message = f"File '{file_path}' completely rewritten successfully."
|
||||
|
|
|
@ -353,8 +353,8 @@ class SandboxWebSearchTool(SandboxToolsBase):
|
|||
logging.info(f"Saving content to file: {results_file_path}, size: {len(json_content)} bytes")
|
||||
|
||||
self.sandbox.fs.upload_file(
|
||||
results_file_path,
|
||||
json_content.encode()
|
||||
json_content.encode(),
|
||||
results_file_path,
|
||||
)
|
||||
|
||||
return {
|
||||
|
|
|
@ -166,7 +166,7 @@ async def create_file(
|
|||
content = await file.read()
|
||||
|
||||
# Create file using raw binary content
|
||||
sandbox.fs.upload_file(path, content)
|
||||
sandbox.fs.upload_file(content, path)
|
||||
logger.info(f"File created at {path} in sandbox {sandbox_id}")
|
||||
|
||||
return {"status": "success", "created": True, "path": path}
|
||||
|
|
Loading…
Reference in New Issue