TurnAnalyzerBotTurnStartStrategy: don't use text on interim transcriptions
This commit is contained in:
@@ -89,8 +89,10 @@ class TurnAnalyzerBotTurnStartStrategy(BaseBotTurnStartStrategy):
|
|||||||
await self._handle_vad_user_stopped_speaking(frame)
|
await self._handle_vad_user_stopped_speaking(frame)
|
||||||
elif isinstance(frame, InputAudioRawFrame):
|
elif isinstance(frame, InputAudioRawFrame):
|
||||||
await self._handle_input_audio(frame)
|
await self._handle_input_audio(frame)
|
||||||
elif isinstance(frame, (TranscriptionFrame, InterimTranscriptionFrame)):
|
elif isinstance(frame, TranscriptionFrame):
|
||||||
await self._handle_transcription(frame)
|
await self._handle_transcription(frame)
|
||||||
|
elif isinstance(frame, InterimTranscriptionFrame):
|
||||||
|
await self._handle_interim_transcription(frame)
|
||||||
|
|
||||||
async def _start(self, frame: StartFrame):
|
async def _start(self, frame: StartFrame):
|
||||||
"""Process the start frame to configure the turn analyzer."""
|
"""Process the start frame to configure the turn analyzer."""
|
||||||
@@ -116,12 +118,16 @@ class TurnAnalyzerBotTurnStartStrategy(BaseBotTurnStartStrategy):
|
|||||||
await self._handle_prediction_result(prediction)
|
await self._handle_prediction_result(prediction)
|
||||||
await self._handle_end_of_turn(state)
|
await self._handle_end_of_turn(state)
|
||||||
|
|
||||||
async def _handle_transcription(self, frame: TranscriptionFrame | InterimTranscriptionFrame):
|
async def _handle_transcription(self, frame: TranscriptionFrame):
|
||||||
"""Handle user transcription."""
|
"""Handle user transcription."""
|
||||||
# We don't really care about the content.
|
# We don't really care about the content.
|
||||||
self._text = frame.text
|
self._text = frame.text
|
||||||
self._event.set()
|
self._event.set()
|
||||||
|
|
||||||
|
async def _handle_interim_transcription(self, frame: InterimTranscriptionFrame):
|
||||||
|
"""Handle user interim transcription."""
|
||||||
|
self._event.set()
|
||||||
|
|
||||||
async def _handle_end_of_turn(self, state: EndOfTurnState):
|
async def _handle_end_of_turn(self, state: EndOfTurnState):
|
||||||
"""Handle completion of end-of-turn analysis."""
|
"""Handle completion of end-of-turn analysis."""
|
||||||
if state == EndOfTurnState.COMPLETE:
|
if state == EndOfTurnState.COMPLETE:
|
||||||
|
|||||||
Reference in New Issue
Block a user