[WIP] AWS Nova Sonic service - remove _handling_bot_stopped_speaking, which no longer seems to be necessary; I'm no longer observing back-to-back BotStoppedSpeaking frames

This commit is contained in:
Paul Kompfner
2025-05-07 11:10:54 -04:00
parent c78f779800
commit 1491462d15

View File

@@ -171,7 +171,6 @@ class AWSNovaSonicLLMService(LLMService):
self._assistant_is_responding = False
self._context_available = False
self._ready_to_send_context = False
self._handling_bot_stopped_speaking = False
self._triggering_assistant_response = False
self._assistant_response_trigger_audio: Optional[bytes] = (
None # Not cleared on _disconnect()
@@ -248,10 +247,6 @@ class AWSNovaSonicLLMService(LLMService):
await self._send_user_audio_event(frame.audio)
async def _handle_bot_stopped_speaking(self):
# Protect against back-to-back BotStoppedSpeaking calls, which I've observed
if self._handling_bot_stopped_speaking:
return
self._handling_bot_stopped_speaking = True
if self._assistant_is_responding:
# Consider the assistant finished with their response (after a short delay, to allow for
@@ -272,8 +267,6 @@ class AWSNovaSonicLLMService(LLMService):
self._assistant_is_responding = False
await self._report_assistant_response_ended()
self._handling_bot_stopped_speaking = False
async def _handle_function_call_result(self, frame: AWSNovaSonicFunctionCallResultFrame):
result = frame.result_frame
await self._send_tool_result(tool_call_id=result.tool_call_id, result=result.result)
@@ -398,7 +391,6 @@ class AWSNovaSonicLLMService(LLMService):
self._assistant_is_responding = False
self._context_available = False
self._ready_to_send_context = False
self._handling_bot_stopped_speaking = False
self._triggering_assistant_response = False
self._disconnecting = False
self._connected_time = None