From c280fcd885cde8e4ffa45b64bc9ff6f0cf5e7fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Sat, 12 Oct 2024 16:24:26 +0800 Subject: [PATCH] fix delopy path --- metagpt/memory/role_zero_memory.py | 2 +- metagpt/roles/di/engineer2.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/metagpt/memory/role_zero_memory.py b/metagpt/memory/role_zero_memory.py index 6e59af3ec..5c7fb94a2 100644 --- a/metagpt/memory/role_zero_memory.py +++ b/metagpt/memory/role_zero_memory.py @@ -129,7 +129,7 @@ class RoleZeroLongTermMemory(Memory): If adding long-term memory fails, it will only log the error without interrupting program execution. """ - if not item or not item.message.content: + if not item: return self.rag_engine.add_objs([item]) diff --git a/metagpt/roles/di/engineer2.py b/metagpt/roles/di/engineer2.py index 6776fdf3a..d218dd666 100644 --- a/metagpt/roles/di/engineer2.py +++ b/metagpt/roles/di/engineer2.py @@ -88,7 +88,7 @@ class Engineer2(RoleZero): "Terminal.run_command": self._eval_terminal_run, "RoleZero.ask_human": self._end, "RoleZero.reply_to_human": self._end, - "Deployer.deploy_to_public": self.deployer.deploy_to_public, + "Deployer.deploy_to_public": self.deploy_to_public, } ) else: @@ -140,6 +140,12 @@ class Engineer2(RoleZero): # TODO: Consider adding line no to be ready for editing. return f"The file {path} has been successfully created, with content:\n{code}" + def deploy_to_public(self, dist_dir): + """fix the path to absolute path""" + # fix the path according to the editor's working directory + dist_dir = self.editor._try_fix_path(dist_dir) + return self.deployer.deploy_to_public(dist_dir) + async def _eval_terminal_run(self, cmd): """change command pull/push/commit to end.""" if any([cmd_key_word in cmd for cmd_key_word in ["pull", "push", "commit"]]):