Refactor: Update message publishing logic to handle multiple recipients

This commit is contained in:
shenchucheng 2024-06-18 12:01:53 +08:00
parent 991bfd6f68
commit 351cf18c3a

View file

@ -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)