From cf45fba8219f742458767cd786b560d094294827 Mon Sep 17 00:00:00 2001 From: Stitch-z <284618289@qq.com> Date: Wed, 12 Jun 2024 15:06:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=88=B6=E7=B1=BBrole?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=94=B9=E5=8A=A8=E8=80=8C=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E5=88=B0=E5=AD=90=E7=B1=BBrole-=E6=95=99=E7=A8=8B=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E5=8A=9F=E8=83=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metagpt/roles/tutorial_assistant.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/metagpt/roles/tutorial_assistant.py b/metagpt/roles/tutorial_assistant.py index 6cf3a6469..4cd81f9db 100644 --- a/metagpt/roles/tutorial_assistant.py +++ b/metagpt/roles/tutorial_assistant.py @@ -56,7 +56,7 @@ class TutorialAssistant(Role): self.main_title = titles.get("title") directory = f"{self.main_title}\n" self.total_content += f"# {self.main_title}" - actions = list() + actions = list(self.actions) for first_dir in titles.get("directory"): actions.append(WriteContent(language=self.language, directory=first_dir)) key = list(first_dir.keys())[0] @@ -64,6 +64,8 @@ class TutorialAssistant(Role): for second_dir in first_dir[key]: directory += f" - {second_dir}\n" self.set_actions(actions) + self.rc.max_react_loop = len(self.actions) + return Message() async def _act(self) -> Message: """Perform an action as determined by the role. @@ -77,8 +79,7 @@ class TutorialAssistant(Role): self.topic = msg.content resp = await todo.run(topic=self.topic) logger.info(resp) - await self._handle_directory(resp) - return await super().react() + return await self._handle_directory(resp) resp = await todo.run(topic=self.topic) logger.info(resp) if self.total_content != "":