From 9cfaac080ce4d63e3b836306c7874dbcf129e7ba Mon Sep 17 00:00:00 2001 From: sharath <29162020+tnfssc@users.noreply.github.com> Date: Sat, 5 Jul 2025 11:00:00 +0000 Subject: [PATCH] refactor(sb_image_edit_tool): convert file operations to async for improved performance --- backend/agent/tools/sb_image_edit_tool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/agent/tools/sb_image_edit_tool.py b/backend/agent/tools/sb_image_edit_tool.py index 36f34ecb..96daaa90 100644 --- a/backend/agent/tools/sb_image_edit_tool.py +++ b/backend/agent/tools/sb_image_edit_tool.py @@ -139,13 +139,13 @@ class SandboxImageEditTool(SandboxToolsBase): full_path = f"{self.workspace_path}/{cleaned_path}" # Check if file exists and is not a directory - file_info = self.sandbox.fs.get_file_info(full_path) + file_info = await self.sandbox.fs.get_file_info(full_path) if file_info.is_dir: return self.fail_response( f"Path '{cleaned_path}' is a directory, not an image file." ) - return self.sandbox.fs.download_file(full_path) + return await self.sandbox.fs.download_file(full_path) except Exception as e: return self.fail_response( @@ -167,7 +167,7 @@ class SandboxImageEditTool(SandboxToolsBase): sandbox_path = f"{self.workspace_path}/{random_filename}" # Save image to sandbox - self.sandbox.fs.upload_file(sandbox_path, img_response.content) + await self.sandbox.fs.upload_file(sandbox_path, img_response.content) return random_filename except Exception as e: