From 3598c5c3a6930b17a0dea0322f39188dea8b13c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BC=9F=E9=9F=AC?= Date: Wed, 25 Sep 2024 19:18:57 +0800 Subject: [PATCH] The team leader can only send one message per round. --- metagpt/prompts/di/team_leader.py | 1 + metagpt/roles/di/team_leader.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/metagpt/prompts/di/team_leader.py b/metagpt/prompts/di/team_leader.py index 139021ae1..6f3b9ad3c 100644 --- a/metagpt/prompts/di/team_leader.py +++ b/metagpt/prompts/di/team_leader.py @@ -36,6 +36,7 @@ Note: 13. Instructions and reply must be in the same language. 14. Default technology stack is HTML (.html), CSS (.css), and Pure JavaScript (.js). Web app is the default option when developing software. 15. You are the only one who decides the programming language for the software, so the instruction must contain the programming language. +16. Data Collection and Web/Software Devlopment is two tasks. You must assign these tasks to Data Analysis and Engineer Separately. You muat wait for Data Collection to finish before starting coding. """ TL_THOUGHT_GUIDANCE = ( THOUGHT_GUIDANCE diff --git a/metagpt/roles/di/team_leader.py b/metagpt/roles/di/team_leader.py index 112ca5a84..a548ba785 100644 --- a/metagpt/roles/di/team_leader.py +++ b/metagpt/roles/di/team_leader.py @@ -74,7 +74,11 @@ class TeamLeader(RoleZero): Publish a message to a team member, use member name to fill send_to args. You may copy the full original content or add additional information from upstream. This will make team members start their work. DONT omit any necessary info such as path, link, environment, programming language, framework, requirement, constraint from original content to team members because you are their sole info source. """ + if self.rc.todo is None: + # Teamleader have send message to ask a teammember to do something in this turn, the following message will not be sent to team member + return "This message will not be sent to team leader, you have already sent a message to a team member in this turn." self._set_state(-1) # each time publishing a message, pause to wait for the response + if send_to == self.name: return # Avoid sending message to self # Specify the outer send_to to overwrite the default "no one" value. Use UserMessage because message from self is like a user request for others.