完善fastapi接口

This commit is contained in:
puke
2025-11-05 19:46:47 +08:00
parent eee604d8e9
commit 15899afb6f
11 changed files with 595 additions and 56 deletions

View File

@@ -2,19 +2,32 @@
TTS API schemas
"""
from typing import Optional
from pydantic import BaseModel, Field
class TTSSynthesizeRequest(BaseModel):
"""TTS synthesis request"""
text: str = Field(..., description="Text to synthesize")
voice_id: str = Field("[Chinese] zh-CN Yunjian", description="Voice ID")
workflow: Optional[str] = Field(
None,
description="TTS workflow key (e.g., 'runninghub/tts_edge.json' or 'selfhost/tts_edge.json'). If not specified, uses default workflow from config."
)
ref_audio: Optional[str] = Field(
None,
description="Reference audio path for voice cloning (optional). Can be a local file path or URL."
)
voice_id: Optional[str] = Field(
None,
description="Voice ID (deprecated, use workflow instead)"
)
class Config:
json_schema_extra = {
"example": {
"text": "Hello, welcome to Pixelle-Video!",
"voice_id": "[Chinese] zh-CN Yunjian"
"workflow": "runninghub/tts_edge.json",
"ref_audio": None
}
}