add skip_tts to LLMFullResponseStartFrame/LLMFullResponseEndFrame

This commit is contained in:
Aleix Conchillo Flaqué
2025-08-26 14:47:19 -07:00
parent 16f57be72c
commit eb248fedc1
3 changed files with 17 additions and 5 deletions

View File

@@ -1351,14 +1351,22 @@ class LLMFullResponseStartFrame(ControlFrame):
more TextFrames and a final LLMFullResponseEndFrame.
"""
pass
skip_tts: bool = field(init=False)
def __post_init__(self):
super().__post_init__()
self.skip_tts = False
@dataclass
class LLMFullResponseEndFrame(ControlFrame):
"""Frame indicating the end of an LLM response."""
pass
skip_tts: bool = field(init=False)
def __post_init__(self):
super().__post_init__()
self.skip_tts = False
@dataclass

View File

@@ -14,7 +14,6 @@ from typing import (
Awaitable,
Callable,
Dict,
List,
Mapping,
Optional,
Protocol,
@@ -38,6 +37,8 @@ from pipecat.frames.frames import (
FunctionCallResultProperties,
FunctionCallsStartedFrame,
LLMConfigureOutputFrame,
LLMFullResponseEndFrame,
LLMFullResponseStartFrame,
LLMTextFrame,
StartFrame,
StartInterruptionFrame,
@@ -285,7 +286,7 @@ class LLMService(AIService):
frame: The frame to push.
direction: The direction of frame pushing.
"""
if isinstance(frame, LLMTextFrame):
if isinstance(frame, (LLMTextFrame, LLMFullResponseStartFrame, LLMFullResponseEndFrame)):
frame.skip_tts = self._skip_tts
await super().push_frame(frame, direction)

View File

@@ -296,7 +296,10 @@ class TTSService(AIService):
"""
await super().process_frame(frame, direction)
if isinstance(frame, TextFrame) and frame.skip_tts:
if (
isinstance(frame, (TextFrame, LLMFullResponseStartFrame, LLMFullResponseEndFrame))
and frame.skip_tts
):
await self.push_frame(frame, direction)
elif (
isinstance(frame, TextFrame)