Merge pull request #1261 from pipecat-ai/aleix/emualted-frames-being-triggered-prematurely
LLMUserContextAggregator: don't reset timer with interim transcription
This commit is contained in:
@@ -36,7 +36,12 @@ stt = DeepgramSTTService(..., live_options=LiveOptions(model="nova-2-general"))
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed an issue where `EndTaskFrame` was not triggering `on_client_disconnected` or closing the WebSocket in FastAPI.
|
- Fixed an issue that would cause undesired interruptions via
|
||||||
|
`EmulateUserStartedSpeakingFrame` when only interim transcriptions (i.e. no
|
||||||
|
final transcriptions) where received.
|
||||||
|
|
||||||
|
- Fixed an issue where `EndTaskFrame` was not triggering
|
||||||
|
`on_client_disconnected` or closing the WebSocket in FastAPI.
|
||||||
|
|
||||||
- Fixed a context aggregator issue that would not append the LLM text response
|
- Fixed a context aggregator issue that would not append the LLM text response
|
||||||
to the context if a function call happened in the same LLM turn.
|
to the context if a function call happened in the same LLM turn.
|
||||||
|
|||||||
@@ -293,7 +293,13 @@ class LLMUserContextAggregator(LLMContextResponseAggregator):
|
|||||||
await self.push_aggregation()
|
await self.push_aggregation()
|
||||||
|
|
||||||
async def _handle_transcription(self, frame: TranscriptionFrame):
|
async def _handle_transcription(self, frame: TranscriptionFrame):
|
||||||
self._aggregation += f" {frame.text}" if self._aggregation else frame.text
|
text = frame.text
|
||||||
|
|
||||||
|
# Make sure we really have some text.
|
||||||
|
if not text.strip():
|
||||||
|
return
|
||||||
|
|
||||||
|
self._aggregation += f" {text}" if self._aggregation else text
|
||||||
# We just got a final result, so let's reset interim results.
|
# We just got a final result, so let's reset interim results.
|
||||||
self._seen_interim_results = False
|
self._seen_interim_results = False
|
||||||
# Reset aggregation timer.
|
# Reset aggregation timer.
|
||||||
@@ -301,8 +307,6 @@ class LLMUserContextAggregator(LLMContextResponseAggregator):
|
|||||||
|
|
||||||
async def _handle_interim_transcription(self, _: InterimTranscriptionFrame):
|
async def _handle_interim_transcription(self, _: InterimTranscriptionFrame):
|
||||||
self._seen_interim_results = True
|
self._seen_interim_results = True
|
||||||
# Reset aggregation timer.
|
|
||||||
self._aggregation_event.set()
|
|
||||||
|
|
||||||
def _create_aggregation_task(self):
|
def _create_aggregation_task(self):
|
||||||
self._aggregation_task = self.create_task(self._aggregation_task_handler())
|
self._aggregation_task = self.create_task(self._aggregation_task_handler())
|
||||||
|
|||||||
Reference in New Issue
Block a user