Ignore Gemini VAD interrupts when VAD is disabled
When GeminiVADParams(disabled=True) is set, Pipecat correctly sends the disabled flag to Google's API. However, the API may still send interrupt signals despite this setting. Without a local guard, these interrupts are unconditionally broadcast, causing the bot to interrupt users even when the developer explicitly disabled server-side VAD. This adds a check to suppress interrupt broadcasting when VAD is configured as disabled, logging the ignored signal at debug level.
This commit is contained in:
@@ -828,7 +828,6 @@ class GeminiLiveLLMService(LLMService):
|
||||
if self._settings.language
|
||||
else "en-US"
|
||||
)
|
||||
self._vad_params = self._settings.vad
|
||||
|
||||
# Reconnection tracking
|
||||
self._consecutive_failures = 0
|
||||
@@ -1371,8 +1370,13 @@ class GeminiLiveLLMService(LLMService):
|
||||
# track turns, such as local Silero VAD in
|
||||
# combination with the context aggregator default
|
||||
# turn strategies.
|
||||
logger.debug("Gemini VAD: interrupted signal received")
|
||||
await self.broadcast_interruption()
|
||||
if self._settings.vad and self._settings.vad.disabled:
|
||||
logger.debug(
|
||||
"Gemini VAD: interrupted signal received (ignored, VAD disabled)"
|
||||
)
|
||||
else:
|
||||
logger.debug("Gemini VAD: interrupted signal received")
|
||||
await self.broadcast_interruption()
|
||||
elif message.server_content and message.server_content.model_turn:
|
||||
await self._handle_msg_model_turn(message)
|
||||
elif message.server_content and message.server_content.turn_complete:
|
||||
|
||||
Reference in New Issue
Block a user