feat(backend): extend type unions to accept SaluteSpeechSegment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniil
2026-04-03 23:59:19 +03:00
parent dfcb0f96bc
commit 9a71fa9f25
+5 -2
View File
@@ -28,6 +28,7 @@ from cpv3.modules.transcription.schemas import (
GoogleSpeechSegment, GoogleSpeechSegment,
GoogleSpeechWord, GoogleSpeechWord,
LineNode, LineNode,
SaluteSpeechSegment,
SegmentNode, SegmentNode,
Tag, Tag,
TimeRange, TimeRange,
@@ -41,7 +42,9 @@ from cpv3.modules.transcription.schemas import (
class DocumentBuilder: class DocumentBuilder:
def compute_segment_lines( def compute_segment_lines(
self, segment: WhisperSegment | GoogleSpeechSegment, max_chars_per_line: int self,
segment: WhisperSegment | GoogleSpeechSegment | SaluteSpeechSegment,
max_chars_per_line: int,
) -> list[LineNode]: ) -> list[LineNode]:
words = segment.words or [] words = segment.words or []
lines: list[list[WhisperWord | GoogleSpeechWord]] = [] lines: list[list[WhisperWord | GoogleSpeechWord]] = []
@@ -219,7 +222,7 @@ async def _convert_local_to_ogg(input_path: str) -> tuple[str, Callable[[], None
def _make_document_from_segments( def _make_document_from_segments(
builder: DocumentBuilder, builder: DocumentBuilder,
segments: list[WhisperSegment] | list[GoogleSpeechSegment], segments: list[WhisperSegment] | list[GoogleSpeechSegment] | list[SaluteSpeechSegment],
*, *,
max_line_width: int, max_line_width: int,
) -> Document: ) -> Document: