fix: interrupt message speech on confirmation
This commit is contained in:
@@ -8,6 +8,7 @@ from unittest.mock import AsyncMock, patch
|
||||
from models import AssistantConfig, RuntimeTool
|
||||
from pipecat.flows import FlowManager
|
||||
from pipecat.frames.frames import (
|
||||
InterruptionFrame,
|
||||
LLMContextFrame,
|
||||
LLMFullResponseEndFrame,
|
||||
LLMFullResponseStartFrame,
|
||||
@@ -1475,6 +1476,13 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def queue_frame(frame):
|
||||
if isinstance(frame, TTSSpeakFrame):
|
||||
events.append(("speech", frame.text))
|
||||
elif isinstance(frame, InterruptionFrame):
|
||||
events.append("interrupted")
|
||||
elif (
|
||||
isinstance(frame, OutputTransportMessageUrgentFrame)
|
||||
and frame.message.get("event") == "message_completed"
|
||||
):
|
||||
events.append("message_completed")
|
||||
|
||||
class OrderedCallEnd(FakeCallEnd):
|
||||
def __init__(self):
|
||||
@@ -1536,6 +1544,7 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(result.action, "confirmed")
|
||||
self.assertFalse(call_end.playback_completion.done())
|
||||
self.assertEqual(input_states, [False, True])
|
||||
self.assertEqual(events[-2:], ["interrupted", "message_completed"])
|
||||
|
||||
async def test_speech_only_message_waits_for_transport_playback(self):
|
||||
brain = WorkflowBrain(
|
||||
|
||||
Reference in New Issue
Block a user