diff --git a/src/pipecat/processors/frameworks/rtvi/frames.py b/src/pipecat/processors/frameworks/rtvi/frames.py index 37d25c764..6a771f7e4 100644 --- a/src/pipecat/processors/frameworks/rtvi/frames.py +++ b/src/pipecat/processors/frameworks/rtvi/frames.py @@ -65,7 +65,7 @@ class RTVIServerResponseFrame(SystemFrame): and include the original RTVIClientMessageFrame to ensure the response is properly attributed to the original request. To respond with an error, set the `error` field to a string describing the error. This will result - in the client receiving a `response-error` message instead of a + in the client receiving an `error-response` message instead of a `server-response` message. """ diff --git a/src/pipecat/processors/frameworks/rtvi/models_v0.py b/src/pipecat/processors/frameworks/rtvi/models_v0.py index b3826902e..e1d0c8aa4 100644 --- a/src/pipecat/processors/frameworks/rtvi/models_v0.py +++ b/src/pipecat/processors/frameworks/rtvi/models_v0.py @@ -12,6 +12,7 @@ server messages instead. """ from typing import ( + TYPE_CHECKING, Any, Awaitable, Callable, @@ -26,6 +27,9 @@ from pydantic import BaseModel, Field, PrivateAttr import pipecat.processors.frameworks.rtvi.models_v1 as RTVI +if TYPE_CHECKING: + from pipecat.processors.frameworks.rtvi.processor import RTVIProcessor + ActionResult = Union[bool, int, float, str, list, dict] diff --git a/src/pipecat/processors/frameworks/rtvi/observer.py b/src/pipecat/processors/frameworks/rtvi/observer.py index 83837ad6e..2f097b0ac 100644 --- a/src/pipecat/processors/frameworks/rtvi/observer.py +++ b/src/pipecat/processors/frameworks/rtvi/observer.py @@ -316,7 +316,7 @@ class RTVIObserver(BaseObserver): """Send an RTVI message. By default, we push a transport frame. But this function can be - overriden by subclass to send RTVI messages in different ways. + overridden by subclass to send RTVI messages in different ways. Args: model: The message to send. @@ -539,15 +539,15 @@ class RTVIObserver(BaseObserver): return text = frame.text - type = frame.aggregated_by + agg_type = frame.aggregated_by for aggregation_type, transform in self._aggregation_transforms: - if aggregation_type == type or aggregation_type == "*": - text = await transform(text, type) + if aggregation_type == agg_type or aggregation_type == "*": + text = await transform(text, agg_type) isTTS = isinstance(frame, TTSTextFrame) if self._params.bot_output_enabled: message = RTVI.BotOutputMessage( - data=RTVI.BotOutputMessageData(text=text, spoken=isTTS, aggregated_by=type) + data=RTVI.BotOutputMessageData(text=text, spoken=isTTS, aggregated_by=agg_type) ) await self.send_rtvi_message(message) diff --git a/src/pipecat/processors/frameworks/rtvi/processor.py b/src/pipecat/processors/frameworks/rtvi/processor.py index 345dcb8c4..4b4ea2123 100644 --- a/src/pipecat/processors/frameworks/rtvi/processor.py +++ b/src/pipecat/processors/frameworks/rtvi/processor.py @@ -566,10 +566,6 @@ class RTVIProcessor(FrameProcessor): async def _handle_client_message(self, msg_id: str, data: RTVI.RawClientMessageData): """Handle a client message frame.""" - if not data: - await self._send_error_response(msg_id, "Malformed client message") - return - # Create a RTVIClientMessageFrame to push the message frame = RTVIClientMessageFrame(msg_id=msg_id, type=data.t, data=data.d) await self.push_frame(frame)