From 99d8cbc28b12c240364473de6eb4ba62ee0d112c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Fri, 13 Sep 2024 18:02:28 +0800 Subject: [PATCH] fix issues --- metagpt/roles/di/role_zero.py | 2 +- metagpt/tools/libs/editor.py | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/metagpt/roles/di/role_zero.py b/metagpt/roles/di/role_zero.py index 6ea2bf7b4..e308f4bc9 100644 --- a/metagpt/roles/di/role_zero.py +++ b/metagpt/roles/di/role_zero.py @@ -543,7 +543,7 @@ class RoleZero(Role): from metagpt.environment.mgx.mgx_env import MGXEnv # avoid circular import if not isinstance(self.rc.env, MGXEnv): - return "Not in MGXEnv, command will not be executed. If you no longer need to take action, use the command ‘end’ to stop." + return "Not in MGXEnv, command will not be executed." return await self.rc.env.reply_to_human(content, sent_from=self) async def _end(self, **kwarg): diff --git a/metagpt/tools/libs/editor.py b/metagpt/tools/libs/editor.py index 1d3f4c38b..2ba1d4341 100644 --- a/metagpt/tools/libs/editor.py +++ b/metagpt/tools/libs/editor.py @@ -57,9 +57,9 @@ Your changes have NOT been applied. Please fix your edit command and try again SUCCESS_EDIT_INFO = """ [File: {file_name} ({n_total_lines} lines total after edit)] {window_after_applied} -[File updated (edited at line {line_number}). +[File updated (edited at line {line_number})]. """ -# Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.] +# Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary. class FileBlock(BaseModel): @@ -727,11 +727,7 @@ class Editor(BaseModel): new_content str: The text to replace the current selection with, must conform to PEP8 standards. """ - # FIXME: support replacing *all* occurrences - # search for `to_replace` in the file - # if found, replace it with `new_content` - # if not found, perform a fuzzy search to find the closest match and replace it with `new_content` file_name = self._try_fix_path(file_name) ret_str = self._edit_file_impl( @@ -740,7 +736,6 @@ class Editor(BaseModel): end=end_line, content=new_content, ) - # 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