from pydantic import BaseModel, Field from app.schemas.common import NaiveDatetime class VideoEngineCreate(BaseModel): name: str = Field(..., max_length=64) provider: str = Field(..., max_length=32) api_base: str = Field(..., max_length=512) api_key: str = Field(default="", max_length=256) model_name: str = Field(default="", max_length=128) supported_ratios: str = Field(default='["16:9","4:3","1:1","3:4","9:16","21:9"]') supported_resolutions: str = Field(default='["480p","720p","1080p"]') supported_durations: str = Field(default='[4,5,6,7,8,9,10,11,12,13,14,15]') max_duration: int = Field(default=15) max_image_count: int = Field(default=2) max_video_count: int = Field(default=0) max_audio_count: int = Field(default=0, ge=0, le=3, description="最大参考音频数量,0 表示不支持音频参考") supports_first_last_frame: bool = Field(default=False, description="是否支持首尾帧模式") supports_universal_reference: bool = Field(default=True, description="是否支持全能参考模式") generate_url: str = Field(default="", max_length=512) query_url: str = Field(default="", max_length=512) is_active: bool = True priority: int = 0 class VideoEngineOut(VideoEngineCreate): id: str created_at: NaiveDatetime model_config = {"from_attributes": True} class VideoEnginePublic(BaseModel): id: str name: str provider: str supported_ratios: list[str] = [] supported_resolutions: list[str] = [] supported_durations: list[int] = [] max_image_count: int = 2 max_video_count: int = 0 max_audio_count: int = 0 supports_first_last_frame: bool = False supports_universal_reference: bool = True class VideoEngineListResponse(BaseModel): items: list[VideoEnginePublic]