Merge pull request #2312 from pipecat-ai/aleix/srhinos/main

Enable Interruption Support for LLMUserResponseAggregator
This commit is contained in:
Aleix Conchillo Flaqué
2025-07-31 13:30:57 -07:00
committed by GitHub
2 changed files with 12 additions and 11 deletions

View File

@@ -115,6 +115,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed a `LLMUserResponseAggregator` issue where interruptions were not being
handled properly.
- Fixed `PiperTTSService` to work with newer Piper GPL.
- Fixed a race condition in `FastAPIWebsocketClient` that occurred when attempting to - Fixed a race condition in `FastAPIWebsocketClient` that occurred when attempting to
send a message while the client was disconnecting. send a message while the client was disconnecting.

View File

@@ -1013,17 +1013,13 @@ class LLMUserResponseAggregator(LLMUserContextAggregator):
""" """
super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs) super().__init__(context=OpenAILLMContext(messages), params=params, **kwargs)
async def push_aggregation(self): async def _process_aggregation(self):
"""Push the aggregated user input as an LLMMessagesFrame.""" """Process the current aggregation and push it downstream."""
if len(self._aggregation) > 0: aggregation = self._aggregation
await self.handle_aggregation(self._aggregation) await self.reset()
await self.handle_aggregation(aggregation)
# Reset the aggregation. Reset it before pushing it down, otherwise frame = LLMMessagesFrame(self._context.messages)
# if the tasks gets cancelled we won't be able to clear things up. await self.push_frame(frame)
await self.reset()
frame = LLMMessagesFrame(self._context.messages)
await self.push_frame(frame)
class LLMAssistantResponseAggregator(LLMAssistantContextAggregator): class LLMAssistantResponseAggregator(LLMAssistantContextAggregator):