File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
python/packages/autogen-agentchat/src/autogen_agentchat/agents Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -972,9 +972,11 @@ async def on_messages_stream(
972
972
973
973
# --- NEW: If the model produced a hidden "thought," yield it as an event ---
974
974
if model_result .thought :
975
- thought_event = ThoughtEvent (content = model_result .thought , source = agent_name )
975
+ thought_event = ThoughtEvent (content = model_result .thought , source = agent_name , id = message_id )
976
976
yield thought_event
977
977
inner_messages .append (thought_event )
978
+ # Regenerate the message ID for correlation between streaming chunks and final message
979
+ message_id = str (uuid .uuid4 ())
978
980
979
981
# Add the assistant message to the model context (including thought if present)
980
982
await model_context .add_message (
@@ -1281,9 +1283,11 @@ async def _execute_tool_calls(
1281
1283
1282
1284
# Yield thought event if present
1283
1285
if current_model_result .thought :
1284
- thought_event = ThoughtEvent (content = current_model_result .thought , source = agent_name )
1286
+ thought_event = ThoughtEvent (content = current_model_result .thought , source = agent_name , id = message_id )
1285
1287
yield thought_event
1286
1288
inner_messages .append (thought_event )
1289
+ # Regenerate the message ID for correlation between streaming chunks and final message
1290
+ message_id = str (uuid .uuid4 ())
1287
1291
1288
1292
# Add the assistant message to the model context (including thought if present)
1289
1293
await model_context .add_message (
You can’t perform that action at this time.
0 commit comments