fix: release input mute after async client tools
This commit is contained in:
@@ -257,8 +257,12 @@ class UserInputProcessor(FrameProcessor):
|
||||
return
|
||||
|
||||
if self._should_ignore_input():
|
||||
logger.debug("通话正在结束,忽略后续文字输入")
|
||||
await self._emit_result(user_input.input_id, "error", "当前不能接收新的用户输入")
|
||||
logger.debug("当前会话输入已暂停,忽略用户输入")
|
||||
await self._emit_result(
|
||||
user_input.input_id,
|
||||
"error",
|
||||
"当前暂不能接收新的用户输入",
|
||||
)
|
||||
return
|
||||
|
||||
await self._call_event_handler("on_user_input", user_input)
|
||||
@@ -438,8 +442,22 @@ class ToolInterruptionUserMuteStrategy(BaseUserMuteStrategy):
|
||||
elif isinstance(frame, FunctionCallResultFrame):
|
||||
call = self._calls.get(frame.tool_call_id)
|
||||
if call is not None:
|
||||
call.tool_finished = True
|
||||
self._release_completed()
|
||||
properties = frame.properties
|
||||
is_final = properties.is_final if properties else True
|
||||
if is_final:
|
||||
call.tool_finished = True
|
||||
run_llm = (
|
||||
properties.run_llm
|
||||
if properties and properties.run_llm is not None
|
||||
else frame.run_llm
|
||||
)
|
||||
if run_llm is False and not call.response_started:
|
||||
# A tool-only result has no following bot response whose
|
||||
# speech boundary could release the mute. If a preamble
|
||||
# is already playing, BotStoppedSpeakingFrame still owns
|
||||
# the release so allow_interruptions=False is respected.
|
||||
call.response_finished = True
|
||||
self._release_completed()
|
||||
elif isinstance(frame, FunctionCallCancelFrame):
|
||||
# A canceled call cannot reliably produce a follow-up response.
|
||||
self._calls.pop(frame.tool_call_id, None)
|
||||
|
||||
Reference in New Issue
Block a user