From bbff506357f0ef2e944cba582bcfaf6fad7f7261 Mon Sep 17 00:00:00 2001 From: Zak Lee Date: Tue, 29 Oct 2024 08:28:55 -0700 Subject: [PATCH] fix issues in edit tool (#131) --- computer-use-demo/computer_use_demo/tools/edit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/computer-use-demo/computer_use_demo/tools/edit.py b/computer-use-demo/computer_use_demo/tools/edit.py index e538441f..b029625c 100644 --- a/computer-use-demo/computer_use_demo/tools/edit.py +++ b/computer-use-demo/computer_use_demo/tools/edit.py @@ -55,13 +55,13 @@ async def __call__( if command == "view": return await self.view(_path, view_range) elif command == "create": - if not file_text: + if file_text is None: raise ToolError("Parameter `file_text` is required for command: create") self.write_file(_path, file_text) self._file_history[_path].append(file_text) return ToolResult(output=f"File created successfully at: {_path}") elif command == "str_replace": - if not old_str: + if old_str is None: raise ToolError( "Parameter `old_str` is required for command: str_replace" ) @@ -71,7 +71,7 @@ async def __call__( raise ToolError( "Parameter `insert_line` is required for command: insert" ) - if not new_str: + if new_str is None: raise ToolError("Parameter `new_str` is required for command: insert") return self.insert(_path, insert_line, new_str) elif command == "undo_edit":