From 0b048a9a810cf8d46b5222d3d2b742b0b0bd1233 Mon Sep 17 00:00:00 2001 From: Mark Sze Date: Fri, 30 Aug 2024 07:50:10 +0000 Subject: [PATCH] Updates to a_resume to match resume --- autogen/agentchat/groupchat.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/autogen/agentchat/groupchat.py b/autogen/agentchat/groupchat.py index 2578ef5a59f7..20a22f393a85 100644 --- a/autogen/agentchat/groupchat.py +++ b/autogen/agentchat/groupchat.py @@ -1378,13 +1378,15 @@ async def a_resume( if not message_speaker_agent and message["name"] == self.name: message_speaker_agent = self - # Add previous messages to each agent (except their own messages and the last message, as we'll kick off the conversation with it) + # Add previous messages to each agent (except the last message, as we'll kick off the conversation with it) if i != len(messages) - 1: for agent in self._groupchat.agents: - if agent.name != message["name"]: - await self.a_send( - message, self._groupchat.agent_by_name(agent.name), request_reply=False, silent=True - ) + if agent.name == message["name"]: + # An agent`s message is sent to the Group Chat Manager + agent.a_send(message, self, request_reply=False, silent=True) + else: + # Otherwise, messages are sent from the Group Chat Manager to the agent + self.a_send(message, agent, request_reply=False, silent=True) # Add previous message to the new groupchat, if it's an admin message the name may not match so add the message directly if message_speaker_agent: