add rule to forbiden repeat finish current task

This commit is contained in:
黄伟韬 2024-09-20 12:57:19 +08:00
parent 1fa20757c0
commit 8eab27e785
4 changed files with 38 additions and 21 deletions

View file

@ -696,7 +696,7 @@ class Editor(BaseModel):
new_content: str,
) -> str:
"""
Line numbers start from 1. Replaces lines start_line through end_line (inclusive) with the given text in the open file.
Line numbers start from 1. Replace lines from start_line to end_line (inclusive) with the new_content in the open file.
All of the new_content will be entered, so makesure your indentation is formatted properly.
The new_content must be a complete block of code.
@ -712,14 +712,14 @@ class Editor(BaseModel):
EDITING: If you want to replace line 2 and line 3
edit_file_by_replace(
'/workspace/example.txt',
first_replaced_line_number =2,
"/workspace/example.txt",
first_replaced_line_number=2,
first_replaced_line_content="contain g",
last_replaced_line_number =3,
last_replaced_line_number=3,
last_replaced_line_content="contain h",
new_content='new content',
new_content="new content",
)
This will replace only the second line 2 and line 3 with "new content".
This will replace the second line 2 and line 3 with "new content".
The resulting file will be:
```
@ -735,16 +735,16 @@ class Editor(BaseModel):
003|contain h
004|contain i
```
EDITING: If you want to remove the line 2 and line 3
EDITING: If you want to remove the line 2 and line 3.
edit_file_by_replace(
'/workspace/example.txt',
first_replaced_line_number =2,
"/workspace/example.txt",
first_replaced_line_number=2,
first_replaced_line_content="contain g",
last_replaced_line_number =3,
last_replaced_line_number=3,
last_replaced_line_content="contain h",
new_content='',
new_content="",
)
This will remove line 2 and line 3
This will remove line 2 and line 3.
The resulting file will be:
```
001|contain f
@ -752,12 +752,12 @@ class Editor(BaseModel):
003|contain i
```
Args:
file_name (str):The name of the file to edit.
first_replaced_line_number (int):The line number to start the edit at, starting from 1.
first_replaced_line_content (str):The content of the start replace line, according to the first_replaced_line_number .
last_replaced_line_number (int):The line number to end the edit at (inclusive), starting from 1.
last_replaced_line_content (str):The content of the end replace line, according to the last_replaced_line_number .
new_content (str): The text to replace the current selection with, must conform to PEP8 standards.The content in the start line and end line will also be replaced.
file_name (str): The name of the file to edit.
first_replaced_line_number (int): The line number to start the edit at, starting from 1.
first_replaced_line_content (str): The content of the start replace line, according to the first_replaced_line_number.
last_replaced_line_number (int): The line number to end the edit at (inclusive), starting from 1.
last_replaced_line_content (str): The content of the end replace line, according to the last_replaced_line_number.
new_content (str): The text to replace the current selection with, must conform to PEP8 standards. The content in the start line and end line will also be replaced.
"""
@ -938,7 +938,7 @@ class Editor(BaseModel):
Args:
file_name: (str): The name of the file to edit.
line_number (int): The line number (starting from 1) to insert the content after.the insert content will be add between the line of line_number-1 and line_number
insert_content (str): The content to insert betweed the previous_line_content and current_line_content.The insert_content must be a complete block of code at.
insert_content (str): The content to insert betweed the previous_line_content and current_line_content.The insert_content must be a complete block of code at.
NOTE:
This tool is exclusive. If you use this tool, you cannot use any other commands in the current response.