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(
972972
973973 # --- NEW: If the model produced a hidden "thought," yield it as an event ---
974974 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 )
976976 yield thought_event
977977 inner_messages .append (thought_event )
978+ # Regenerate the message ID for correlation between streaming chunks and final message
979+ message_id = str (uuid .uuid4 ())
978980
979981 # Add the assistant message to the model context (including thought if present)
980982 await model_context .add_message (
@@ -1281,9 +1283,11 @@ async def _execute_tool_calls(
12811283
12821284 # Yield thought event if present
12831285 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 )
12851287 yield thought_event
12861288 inner_messages .append (thought_event )
1289+ # Regenerate the message ID for correlation between streaming chunks and final message
1290+ message_id = str (uuid .uuid4 ())
12871291
12881292 # Add the assistant message to the model context (including thought if present)
12891293 await model_context .add_message (
You can’t perform that action at this time.
0 commit comments