Fix Gemini Live session resumption hanging after reconnect
After a reconnect, _ready_for_realtime_input was never set back to True because _create_initial_response (which sets the flag) is only called on initial connection. This caused all audio/video/text to be silently dropped after reconnecting, making the bot appear to hang. Set the flag in _handle_session_ready when context already exists (i.e. reconnect case) since we don't need to go through _create_initial_response again.
This commit is contained in:
@@ -1360,6 +1360,9 @@ class GeminiLiveLLMService(LLMService):
|
||||
if self._run_llm_when_session_ready:
|
||||
self._run_llm_when_session_ready = False
|
||||
await self._create_initial_response()
|
||||
elif self._context:
|
||||
# Reconnect case: context already exists, no need for _create_initial_response
|
||||
self._ready_for_realtime_input = True
|
||||
|
||||
async def _handle_msg_model_turn(self, msg: LiveServerMessage):
|
||||
"""Handle the model turn message."""
|
||||
|
||||
Reference in New Issue
Block a user