Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fix: 修复父类role代码改动而影响到子类role-教程助手功能的问题

Stitch-zcf45fba8219f
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 != "":