Files
BiliNote/backend/app/models/transcriber_model.py
Jefferyhcool 0e0b8da317 first commit
2025-04-13 17:44:54 +08:00

16 lines
636 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class TranscriptSegment:
start: float # 开始时间(秒)
end: float # 结束时间(秒)
text: str # 该段文字
@dataclass
class TranscriptResult:
language: Optional[str] # 检测语言(如 "zh"、"en"
full_text: str # 完整合并后的文本(用于摘要)
segments: List[TranscriptSegment] # 分段结构,适合前端显示时间轴字幕等
raw: Optional[dict] = None # 原始响应数据,便于调试或平台特性处理