🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
Refactor: Update message publishing logic to handle multiple recipients
shenchucheng351cf18c3a49
diff --git a/metagpt/environment/mgx/mgx_env.py b/metagpt/environment/mgx/mgx_env.pyindex ab515e070..33160cfd8 100644--- a/metagpt/environment/mgx/mgx_env.py+++ b/metagpt/environment/mgx/mgx_env.py@@ -31,11 +31,11 @@ class MGXEnv(Environment):if user_defined_recipient:# human user's direct chat message to a certain role-- if self.get_role(user_defined_recipient).is_idle:- # User starts a new direct chat with a certain role, expecting a direct chat response from the role; Other roles including TL should not be involved.- # If the role is not idle, it means the user helps the role with its current work, in this case, we handle the role's response message as usual.- self.direct_chat_roles.add(user_defined_recipient)+ for role_name in message.send_to:+ if self.get_role(role_name).is_idle:+ # User starts a new direct chat with a certain role, expecting a direct chat response from the role; Other roles including TL should not be involved.+ # If the role is not idle, it means the user helps the role with its current work, in this case, we handle the role's response message as usual.+ self.direct_chat_roles.add(role_name)self._publish_message(message)# # bypass team leader, team leader only needs to know but not to react (commented out because TL doesn't understand the message well in actual experiments)