edit str_replace_editor.py

This commit is contained in:
xiangjinyu 2025-03-18 14:25:23 +08:00
parent 7703ea2cf7
commit cc550af04b

View File

@ -138,10 +138,7 @@ class StrReplaceEditor(BaseTool):
""" """
# Check if its an absolute path # Check if its an absolute path
if not path.is_absolute(): if not path.is_absolute():
suggested_path = Path("") / path raise ToolError(f"The path {path} is not an absolute path")
raise ToolError(
f"The path {path} is not an absolute path, it should start with `/`. Maybe you meant {suggested_path}?"
)
# Check if path exists # Check if path exists
if not path.exists() and command != "create": if not path.exists() and command != "create":
raise ToolError( raise ToolError(