支持fastapi服务

This commit is contained in:
puke
2025-10-28 01:33:36 +08:00
committed by puke
parent c387137446
commit c200761b97
28 changed files with 1854 additions and 4 deletions

28
api/schemas/tts.py Normal file
View File

@@ -0,0 +1,28 @@
"""
TTS API schemas
"""
from pydantic import BaseModel, Field
class TTSSynthesizeRequest(BaseModel):
"""TTS synthesis request"""
text: str = Field(..., description="Text to synthesize")
voice_id: str = Field("zh-CN-YunjianNeural", description="Voice ID")
class Config:
json_schema_extra = {
"example": {
"text": "Hello, welcome to ReelForge!",
"voice_id": "zh-CN-YunjianNeural"
}
}
class TTSSynthesizeResponse(BaseModel):
"""TTS synthesis response"""
success: bool = True
message: str = "Success"
audio_path: str = Field(..., description="Path to generated audio file")
duration: float = Field(..., description="Audio duration in seconds")