Fixed race condition in OpenAIRealtimeBetaLLMService that could cause an error when truncating the conversation.
This commit is contained in:
@@ -525,6 +525,14 @@ class OpenAIRealtimeBetaLLMService(LLMService):
|
|||||||
# note: ttfb is faster by 1/2 RTT than ttfb as measured for other services, since we're getting
|
# note: ttfb is faster by 1/2 RTT than ttfb as measured for other services, since we're getting
|
||||||
# this event from the server
|
# this event from the server
|
||||||
await self.stop_ttfb_metrics()
|
await self.stop_ttfb_metrics()
|
||||||
|
|
||||||
|
if self._current_audio_response and self._current_audio_response.item_id != evt.item_id:
|
||||||
|
logger.warning(
|
||||||
|
f"Received a new audio delta for an already completed audio response before receiving the BotStoppedSpeakingFrame."
|
||||||
|
)
|
||||||
|
logger.debug("Forcing previous audio response to None")
|
||||||
|
self._current_audio_response = None
|
||||||
|
|
||||||
if not self._current_audio_response:
|
if not self._current_audio_response:
|
||||||
self._current_audio_response = CurrentAudioResponse(
|
self._current_audio_response = CurrentAudioResponse(
|
||||||
item_id=evt.item_id,
|
item_id=evt.item_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user