update: editor

This commit is contained in:
liushaojie 2024-08-26 13:40:11 +08:00 committed by seeker-jie
parent fedc771478
commit 8e7696b8e6
7 changed files with 1516 additions and 232 deletions

View file

@ -109,9 +109,6 @@ class RoleZero(Role):
"Plan.append_task": self.planner.plan.append_task,
"Plan.reset_task": self.planner.plan.reset_task,
"Plan.replace_task": self.planner.plan.replace_task,
"Editor.write": self.editor.write,
"Editor.write_content": self.editor.write_content,
"Editor.read": self.editor.read,
"RoleZero.ask_human": self.ask_human,
"RoleZero.reply_to_human": self.reply_to_human,
}
@ -132,6 +129,26 @@ class RoleZero(Role):
]
}
)
self.tool_execution_map.update(
{
f"Editor.{i}": getattr(self.editor, i)
for i in [
"append_file",
"create_file",
"edit_file_by_replace",
"find_file",
"goto_line",
"insert_content_at_line",
"open_file",
# "read",
"scroll_down",
"scroll_up",
"search_dir",
"search_file",
# "write",
]
}
)
# can be updated by subclass
self._update_tool_execution()
return self

View file

@ -19,10 +19,11 @@ class SWEAgent(RoleZero):
goal: str = "Resolve GitHub issue or bug in any existing codebase"
_instruction: str = NEXT_STEP_TEMPLATE
tools: list[str] = [
"Bash",
# "Bash",
"Browser:goto,scroll",
"RoleZero",
"git_create_pull",
"Editor",
]
terminal: Bash = Field(default_factory=Bash, exclude=True)
output_diff: str = ""