Skip to content

Commit 598d9af

Browse files
authored
Merge pull request #82 from TEN-framework/wangyoucao577-patch-1
feat: add user translation
2 parents 4dfc594 + 4034ca4 commit 598d9af

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

interface/ten_ai_base/transcription.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,30 @@ class UserTranscription(BaseModel):
3535
user_id: str = ""
3636

3737
words: list[Word] | None = None
38-
merged_turns: list[int] | None = None
38+
merged_turns: list[int] | None = None # TODO: should be removed in the future
3939
interruptable: bool = False # whether the text can be interrupted
4040

4141
metadata: dict | None = None # additional metadata for the transcription
4242

43+
class UserTranslation(BaseModel):
44+
object: str = "user.translation" # [required] name of the object
45+
text: str = "" # [required] text for display
46+
final: bool = True # whether 'text' won't change anymore
47+
start_ms: int = 0 # start time of the text, milliseconds since epoch
48+
duration_ms: int = 0 # duration of the text, in milliseconds
49+
language: str = "" # IETF BCP 47(RFC 4646), such as 'en-US' or 'zh-CN'
50+
51+
turn_id: int = 0
52+
53+
# which stream/user the text belongs to
54+
stream_id: int = 0
55+
user_id: str = ""
56+
57+
transcript_text: str | None = None # corresponding transcribed text
58+
transcript_language: str | None = None # IETF BCP 47(RFC 4646), such as 'en-US' or 'zh-CN'
59+
60+
metadata: dict | None = None # additional metadata for the transcription
61+
4362

4463
class AssistantTranscription(BaseModel):
4564
object: str = "assistant.transcription" # [required] name of the object

0 commit comments

Comments
 (0)