fix issues

This commit is contained in:
黄伟韬 2024-09-13 18:02:28 +08:00
parent fa68d071a5
commit 99d8cbc28b
2 changed files with 3 additions and 8 deletions

View file

@ -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):

View file

@ -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