Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

feat: Update message append logic for `handle_stream_response` (#916)

Wendong-Fan38ffe735dcb8
diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.py
index 6fdd1c912..9c1bf181f 100644
--- a/camel/agents/chat_agent.py
+++ b/camel/agents/chat_agent.py
@@ -815,7 +815,7 @@ class ChatAgent(BaseAgent):
# When response has not been stopped
# Notice that only the first chunk_dict has the "role"
content_dict[index] += delta.content
- else:
+ elif choice.finish_reason:
finish_reasons_dict[index] = choice.finish_reason
chat_message = BaseMessage(
role_name=self.role_name,