fix: interrupt message output before tool result
This commit is contained in:
@@ -95,7 +95,7 @@ class BrainRuntime:
|
||||
set_vision_scope: Callable[[dict[str, Any]], None] | None = None
|
||||
vision_function: Any = None
|
||||
set_input_enabled: Callable[[bool], None] | None = None
|
||||
interrupt_output: Callable[[], Awaitable[None]] | None = None
|
||||
wait_for_output_stopped: Callable[[], Awaitable[None]] | None = None
|
||||
apply_turn_config: (
|
||||
Callable[[bool, dict[str, Any]], Awaitable[None]] | None
|
||||
) = None
|
||||
|
||||
@@ -1097,12 +1097,12 @@ class WorkflowBrain(BaseBrain):
|
||||
completion_policy == MESSAGE_CONFIRMATION
|
||||
and result.action == "confirmed"
|
||||
):
|
||||
if runtime.interrupt_output is None:
|
||||
raise RuntimeError("当前管线不支持中断 Message 确认语音")
|
||||
# Keep the client-tool result as the confirmation gate, then
|
||||
# wait for the pipeline-owned interruption boundary before the
|
||||
# next node is allowed to enqueue new output.
|
||||
await runtime.interrupt_output()
|
||||
if runtime.wait_for_output_stopped is None:
|
||||
raise RuntimeError("当前管线不支持等待 Message 确认语音停止")
|
||||
# ClientToolBroker has already broadcast the interruption
|
||||
# before resolving the confirmation. Keep the next node behind
|
||||
# the pipeline and transport playback boundaries.
|
||||
await runtime.wait_for_output_stopped()
|
||||
await self._emit_trace(
|
||||
"message_completed",
|
||||
nodeId=node_id,
|
||||
|
||||
Reference in New Issue
Block a user