
    qi                     B    d Z ddlmZ ddlmZ ddlmZ  G d de      Zy)zUser response aggregation for text frames.

This module provides an aggregator that collects user responses and outputs
them as TextFrame objects, useful for capturing and processing user input
in conversational pipelines.
    )	TextFrame)
LLMContext)LLMUserAggregatorc                   (     e Zd ZdZ fdZd Z xZS )UserResponseAggregatorzAggregates user responses into TextFrame objects.

    This aggregator extends LLMUserAggregator to specifically handle
    user input by collecting text responses and outputting them as TextFrame
    objects when the aggregation is complete.
    c                     t        |   ddt               i| ddl}|j	                         5  |j                  d       |j                  dt        d       ddd       y# 1 sw Y   yxY w)	a  Initialize the user response aggregator.

        .. deprecated:: 0.0.92
            `UserResponseAggregator` is deprecated and will be removed in a future version.

        Args:
            **kwargs: Additional arguments passed to parent LLMUserAggregator.
        contextr   NalwayszO`UserResponseAggregator` is deprecated and will be removed in a future version.   )
stacklevel )super__init__r   warningscatch_warningssimplefilterwarnDeprecationWarning)selfkwargsr   	__class__s      ^/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/processors/aggregators/user_response.pyr   zUserResponseAggregator.__init__   sh     	888$$& 	!!(+MMa"  	 	 	s   *A""A+c                    K   t        | j                        dkD  r\t        | j                  j                               }d| _        | j	                  |       d{    | j                          d{    yy7 7 w)zPush the aggregated user response as a TextFrame.

        Creates a TextFrame from the current aggregation if it contains content,
        resets the aggregation state, and pushes the frame downstream.
        r    N)len_aggregationr   strip
push_framereset)r   frames     r   push_aggregationz'UserResponseAggregator.push_aggregation0   sq      t  !A%d//5578E !#D//%((( **, & ) s$   AA<A8A<1A:2A<:A<)__name__
__module____qualname____doc__r   r!   __classcell__)r   s   @r   r   r      s    *    r   N)r%   pipecat.frames.framesr   *pipecat.processors.aggregators.llm_contextr   5pipecat.processors.aggregators.llm_response_universalr   r   r   r'   r   <module>r+      s"    , A S-. -r'   