Merge branch 'add_swe_agent_ablilities_to_engineer2' of https://gitlab.deepwisdomai.com/pub/MetaGPT into add_swe_agent_ablilities_to_engineer2

This commit is contained in:
黄伟韬 2024-09-05 17:00:01 +08:00
commit 7d859a10fb

View file

@ -358,6 +358,7 @@ class Editor(BaseModel):
output = self._cur_file_header(path, total_lines)
output += self._print_window(path, self.current_line, self._clamp(context_lines, 1, 2000))
self.resource.report(path, "path")
return output
def goto_line(self, line_number: int) -> str:
@ -854,6 +855,7 @@ class Editor(BaseModel):
)
# lint_error = bool(LINTER_ERROR_MSG in ret_str)
# TODO: automatically tries to fix linter error (maybe involve some static analysis tools on the location near the edit to figure out indentation)
self.resource.report(file_name, "path")
return ret_str
def insert_content_at_line(self, file_name: str, line_number: int, content: str) -> str:
@ -982,6 +984,9 @@ class Editor(BaseModel):
res_list.append(f'[End of matches for "{search_term}" in {file_path}]')
else:
res_list.append(f'[No matches found for "{search_term}" in {file_path}]')
extra = {"type": "search", "symbol": search_term, "lines": [i[0] - 1 for i in matches]} if matches else None
self.resource.report(file_path, "path", extra=extra)
return "\n".join(res_list)
def find_file(self, file_name: str, dir_path: str = "./") -> str: