processors(rtvi): use only user-transcription
This commit is contained in:
@@ -131,6 +131,7 @@ class RTVITranscriptionMessageData(BaseModel):
|
|||||||
text: str
|
text: str
|
||||||
user_id: str
|
user_id: str
|
||||||
timestamp: str
|
timestamp: str
|
||||||
|
final: bool
|
||||||
|
|
||||||
|
|
||||||
class RTVITranscriptionMessage(BaseModel):
|
class RTVITranscriptionMessage(BaseModel):
|
||||||
@@ -139,12 +140,6 @@ class RTVITranscriptionMessage(BaseModel):
|
|||||||
data: RTVITranscriptionMessageData
|
data: RTVITranscriptionMessageData
|
||||||
|
|
||||||
|
|
||||||
class RTVIInterimTranscriptionMessage(BaseModel):
|
|
||||||
label: Literal["rtvi"] = "rtvi"
|
|
||||||
type: Literal["user-interim-transcription"] = "user-interim-transcription"
|
|
||||||
data: RTVITranscriptionMessageData
|
|
||||||
|
|
||||||
|
|
||||||
class RTVIUserStartedSpeakingMessage(BaseModel):
|
class RTVIUserStartedSpeakingMessage(BaseModel):
|
||||||
label: Literal["rtvi"] = "rtvi"
|
label: Literal["rtvi"] = "rtvi"
|
||||||
type: Literal["user-started-speaking"] = "user-started-speaking"
|
type: Literal["user-started-speaking"] = "user-started-speaking"
|
||||||
@@ -318,11 +313,15 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
data=RTVITranscriptionMessageData(
|
data=RTVITranscriptionMessageData(
|
||||||
text=frame.text,
|
text=frame.text,
|
||||||
user_id=frame.user_id,
|
user_id=frame.user_id,
|
||||||
timestamp=frame.timestamp))
|
timestamp=frame.timestamp,
|
||||||
|
final=True))
|
||||||
elif isinstance(frame, InterimTranscriptionFrame):
|
elif isinstance(frame, InterimTranscriptionFrame):
|
||||||
message = RTVIInterimTranscriptionMessage(
|
message = RTVITranscriptionMessage(
|
||||||
data=RTVITranscriptionMessageData(
|
data=RTVITranscriptionMessageData(
|
||||||
text=frame.text, user_id=frame.user_id, timestamp=frame.timestamp))
|
text=frame.text,
|
||||||
|
user_id=frame.user_id,
|
||||||
|
timestamp=frame.timestamp,
|
||||||
|
final=False))
|
||||||
|
|
||||||
if message:
|
if message:
|
||||||
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))
|
||||||
|
|||||||
Reference in New Issue
Block a user