Merge pull request #834 from pipecat-ai/aleix/transcription-are-text
frames: transcriptions should be TextFrames as before
This commit is contained in:
@@ -83,8 +83,8 @@ async def on_audio_data(processor, audio, sample_rate, num_channels):
|
|||||||
delays. The sample rate of the provided sound files now need to match the
|
delays. The sample rate of the provided sound files now need to match the
|
||||||
sample rate of the output transport.
|
sample rate of the output transport.
|
||||||
|
|
||||||
- All input frames (text, audio, image, etc.) are now system frames. This means
|
- Input frames (audio, image and transport messages) are now system frames. This
|
||||||
they are processed immediately by all processors instead of being queued
|
means they are processed immediately by all processors instead of being queued
|
||||||
internally.
|
internally.
|
||||||
|
|
||||||
- Expanded the transcriptions.language module to support a superset of
|
- Expanded the transcriptions.language module to support a superset of
|
||||||
|
|||||||
@@ -177,6 +177,35 @@ class TextFrame(DataFrame):
|
|||||||
return f"{self.name}(pts: {pts}, text: [{self.text}])"
|
return f"{self.name}(pts: {pts}, text: [{self.text}])"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class TranscriptionFrame(TextFrame):
|
||||||
|
"""A text frame with transcription-specific data. Will be placed in the
|
||||||
|
transport's receive queue when a participant speaks.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
user_id: str
|
||||||
|
timestamp: str
|
||||||
|
language: Language | None = None
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.name}(user: {self.user_id}, text: [{self.text}], language: {self.language}, timestamp: {self.timestamp})"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class InterimTranscriptionFrame(TextFrame):
|
||||||
|
"""A text frame with interim transcription-specific data. Will be placed in
|
||||||
|
the transport's receive queue when a participant speaks."""
|
||||||
|
|
||||||
|
text: str
|
||||||
|
user_id: str
|
||||||
|
timestamp: str
|
||||||
|
language: Language | None = None
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.name}(user: {self.user_id}, text: [{self.text}], language: {self.language}, timestamp: {self.timestamp})"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LLMMessagesFrame(DataFrame):
|
class LLMMessagesFrame(DataFrame):
|
||||||
"""A frame containing a list of LLM messages. Used to signal that an LLM
|
"""A frame containing a list of LLM messages. Used to signal that an LLM
|
||||||
@@ -441,36 +470,6 @@ class TransportMessageUrgentFrame(SystemFrame):
|
|||||||
return f"{self.name}(message: {self.message})"
|
return f"{self.name}(message: {self.message})"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class TranscriptionFrame(SystemFrame):
|
|
||||||
"""A text frame with transcription-specific data. Will be placed in the
|
|
||||||
transport's receive queue when a participant speaks.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
text: str
|
|
||||||
user_id: str
|
|
||||||
timestamp: str
|
|
||||||
language: Language | None = None
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.name}(user: {self.user_id}, text: [{self.text}], language: {self.language}, timestamp: {self.timestamp})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class InterimTranscriptionFrame(SystemFrame):
|
|
||||||
"""A text frame with interim transcription-specific data. Will be placed in
|
|
||||||
the transport's receive queue when a participant speaks."""
|
|
||||||
|
|
||||||
text: str
|
|
||||||
user_id: str
|
|
||||||
timestamp: str
|
|
||||||
language: Language | None = None
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.name}(user: {self.user_id}, text: [{self.text}], language: {self.language}, timestamp: {self.timestamp})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UserImageRequestFrame(SystemFrame):
|
class UserImageRequestFrame(SystemFrame):
|
||||||
"""A frame user to request an image from the given user."""
|
"""A frame user to request an image from the given user."""
|
||||||
|
|||||||
Reference in New Issue
Block a user