Skip to content

Commit

Permalink
fix issues in edit tool
Browse files Browse the repository at this point in the history
  • Loading branch information
x5a authored Oct 29, 2024
1 parent c8b5fb3 commit c1f4e91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions computer-use-demo/computer_use_demo/tools/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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":
Expand Down

0 comments on commit c1f4e91

Please # to comment.