ask llm are you sure? when REPLACE exists

This commit is contained in:
Paul Gauthier 2024-05-11 16:56:14 -07:00
parent 90c0a5b9a4
commit eea8e50c60

View file

@ -60,10 +60,8 @@ class EditBlockCoder(Coder):
res += f""" res += f"""
## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in {path} ## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in {path}
<<<<<<< SEARCH <<<<<<< SEARCH
{original} {original}=======
======= {updated}>>>>>>> REPLACE
{updated}
>>>>>>> REPLACE
""" """
did_you_mean = find_similar_lines(original, content) did_you_mean = find_similar_lines(original, content)
@ -76,6 +74,11 @@ class EditBlockCoder(Coder):
""" """
if updated in content:
res += f"""Are you sure you need this SEARCH/REPLACE block?
The REPLACE lines are already in {path}!
"""
res += ( res += (
"The SEARCH section must exactly match an existing block of lines including all white" "The SEARCH section must exactly match an existing block of lines including all white"
" space, comments, indentation, docstrings, etc\n" " space, comments, indentation, docstrings, etc\n"