TextFrame: add skip_tts field

This lets a text frame bypass TTS while still being included in the LLM
context. Useful for cases like structured text that isn’t meant to be spoken but
should still contribute to context.
This commit is contained in:
Aleix Conchillo Flaqué
2025-08-26 12:38:30 -07:00
parent d9837dd1e5
commit 5803936838
3 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added `skip_tts` field to `TextFrame`. This lets a text frame bypass TTS while
still being included in the LLM context. Useful for cases like structured text
that isnt meant to be spoken but should still contribute to context.
- Added a `cancel_timeout_secs` argument to `PipelineTask` which defines how
long the pipeline has to complete cancellation. When `PipelineTask.cancel()`
is called, a `CancelFrame` is pushed through the pipeline and must reach the

View File

@@ -305,6 +305,11 @@ class TextFrame(DataFrame):
"""
text: str
skip_tts: bool = field(init=False)
def __post_init__(self):
super().__post_init__()
self.skip_tts = False
def __str__(self):
pts = format_pts(self.pts)

View File

@@ -296,7 +296,9 @@ class TTSService(AIService):
"""
await super().process_frame(frame, direction)
if (
if isinstance(frame, TextFrame) and frame.skip_tts:
await self.push_frame(frame, direction)
elif (
isinstance(frame, TextFrame)
and not isinstance(frame, InterimTranscriptionFrame)
and not isinstance(frame, TranscriptionFrame)