fix: interrupt message output before tool result
This commit is contained in:
@@ -1541,8 +1541,8 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
):
|
||||
events.append("message_completed")
|
||||
|
||||
async def interrupt_output():
|
||||
events.append("interrupted")
|
||||
async def wait_for_output_stopped():
|
||||
events.append("output_stopped")
|
||||
|
||||
class OrderedCallEnd(FakeCallEnd):
|
||||
def __init__(self):
|
||||
@@ -1580,7 +1580,7 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
call_end=call_end,
|
||||
client_tools=client_tools,
|
||||
set_input_enabled=input_states.append,
|
||||
interrupt_output=interrupt_output,
|
||||
wait_for_output_stopped=wait_for_output_stopped,
|
||||
)
|
||||
brain._message_stages.set_client_tools(client_tools)
|
||||
|
||||
@@ -1598,6 +1598,7 @@ class WorkflowBrainTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(input_states, [False])
|
||||
self.assertEqual(client_tools.function_name, "show_message")
|
||||
self.assertEqual(client_tools.options["response_wait_mode"], "session")
|
||||
self.assertTrue(client_tools.options["interrupt_on_result"])
|
||||
|
||||
user_confirmed.set()
|
||||
result = await message_task
|
||||
@@ -1605,7 +1606,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"])
|
||||
self.assertEqual(events[-2:], ["output_stopped", "message_completed"])
|
||||
|
||||
async def test_speech_only_message_waits_for_transport_playback(self):
|
||||
brain = WorkflowBrain(
|
||||
|
||||
Reference in New Issue
Block a user