fix: prevent double TTS on Web UI voice messages

When voice mode is enabled and user sends a voice message on Web UI,
both the base adapter auto-TTS (play_audio) and the gateway voice reply
(send_voice) would fire, causing duplicate audio playback. Skip the
gateway voice reply for Web platform voice input since base adapter
already handles it.
This commit is contained in:
0xbyt4
2026-03-11 21:43:10 +03:00
parent e21a13488b
commit 815e83952e

View File

@@ -1635,8 +1635,12 @@ class GatewayRunner:
)
for msg in agent_messages
)
logger.info("Voice reply: has_agent_tts=%s, calling _send_voice_reply", has_agent_tts)
if not has_agent_tts:
# Skip if voice input on Web platform — base adapter auto-TTS
# already sent play_audio, so sending another would be double.
is_web = (source.platform == Platform.WEB)
skip_double = is_web and is_voice_input
logger.info("Voice reply: has_agent_tts=%s, skip_double=%s, calling _send_voice_reply", has_agent_tts, skip_double)
if not has_agent_tts and not skip_double:
await self._send_voice_reply(event, response)
return response