from typing import Any, Callable, Literal from pydantic import BaseModel, Field from uuid import UUID class TransResult(BaseModel): # trans_pattern: str seg_id: int context: str from_: str = Field(alias="from") to: str tran_content: str = Field(alias="tranContent") partial: bool = True class Config: populate_by_name = True class DebugResult(BaseModel): # trans_pattern: str seg_id: int transcribe_time: float translate_time:float context: str = Field(alias="transcribeContent") from_: str = Field(alias="from") to: str tran_content: str = Field(alias="translateContent") partial: bool = True class Config: populate_by_name = True class Message(BaseModel): result: TransResult = {} # action: str = "recognition" error_code: int = 0 request_id: UUID