We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ab90fd2 commit 2f5e54dCopy full SHA for 2f5e54d
livekit-agents/livekit/agents/pipeline/pipeline_agent.py
@@ -721,6 +721,12 @@ async def _synthesize_answer_task(
721
# the speech is playing but not committed yet, add it to the chat context for this new reply synthesis
722
# First add the previous function call message if any
723
if playing_speech.extra_tools_messages:
724
+ if playing_speech.fnc_text_message_id is not None:
725
+ # there is a message alongside the function calls
726
+ msgs = copied_ctx.messages
727
+ if msgs and msgs[-1].id == playing_speech.fnc_text_message_id:
728
+ # replace it with the tool call message if it's the last in the ctx
729
+ msgs.pop()
730
copied_ctx.messages.extend(playing_speech.extra_tools_messages)
731
732
# Then add the previous assistant message
0 commit comments