fix: interrupt message output before tool result
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import unittest
|
||||
|
||||
from pipecat.frames.frames import BotStartedSpeakingFrame, BotStoppedSpeakingFrame
|
||||
@@ -36,6 +37,20 @@ class CallEndCoordinatorTest(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
self.assertEqual(self.reasons, ["prompt_end_call"])
|
||||
|
||||
async def test_wait_until_silent_tracks_transport_boundary(self):
|
||||
self.assertFalse(self.coordinator.speaking)
|
||||
await self.coordinator.wait_until_silent()
|
||||
|
||||
await self.coordinator.observe(BotStartedSpeakingFrame())
|
||||
self.assertTrue(self.coordinator.speaking)
|
||||
wait_task = asyncio.create_task(self.coordinator.wait_until_silent())
|
||||
await asyncio.sleep(0)
|
||||
self.assertFalse(wait_task.done())
|
||||
|
||||
await self.coordinator.observe(BotStoppedSpeakingFrame())
|
||||
await wait_task
|
||||
self.assertFalse(self.coordinator.speaking)
|
||||
|
||||
async def test_tool_only_end_call_finishes_without_waiting(self):
|
||||
self.coordinator.begin_response()
|
||||
self.coordinator.begin("tool_only")
|
||||
|
||||
Reference in New Issue
Block a user