rtvi: reset bot transcription with interruptions
This commit is contained in:
@@ -459,14 +459,18 @@ class RTVIBotTranscriptionProcessor(RTVIFrameProcessor):
|
|||||||
|
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
if isinstance(frame, TextFrame):
|
if isinstance(frame, UserStartedSpeakingFrame):
|
||||||
|
await self._push_aggregation()
|
||||||
|
elif isinstance(frame, TextFrame):
|
||||||
self._aggregation += frame.text
|
self._aggregation += frame.text
|
||||||
if match_endofsentence(self._aggregation):
|
if match_endofsentence(self._aggregation):
|
||||||
message = RTVIBotTranscriptionMessage(
|
await self._push_aggregation()
|
||||||
data=RTVITextMessageData(text=self._aggregation)
|
|
||||||
)
|
async def _push_aggregation(self):
|
||||||
await self._push_transport_message_urgent(message)
|
if len(self._aggregation) > 0:
|
||||||
self._aggregation = ""
|
message = RTVIBotTranscriptionMessage(data=RTVITextMessageData(text=self._aggregation))
|
||||||
|
await self._push_transport_message_urgent(message)
|
||||||
|
self._aggregation = ""
|
||||||
|
|
||||||
|
|
||||||
class RTVIBotLLMProcessor(RTVIFrameProcessor):
|
class RTVIBotLLMProcessor(RTVIFrameProcessor):
|
||||||
|
|||||||
Reference in New Issue
Block a user