63 lines
2.3 KiB
Python
63 lines
2.3 KiB
Python
from pydantic import BaseModel, Field
|
|
|
|
from app.schemas.common import NaiveDatetime, NaiveDatetimeOptional
|
|
|
|
|
|
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,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]')
|
|
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 表示不支持音频参考")
|
|
multi_generation_enabled: bool = Field(
|
|
default=False,
|
|
description="是否允许客户端选择生成多个视频;关闭时客户端只能选择 1 份",
|
|
)
|
|
max_generation_count: int = Field(
|
|
default=1,
|
|
ge=1,
|
|
le=5,
|
|
description="客户端单次最多可选择的生成数量,范围 1-5",
|
|
)
|
|
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
|
|
deleted_at: NaiveDatetimeOptional = None
|
|
|
|
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
|
|
multi_generation_enabled: bool = False
|
|
max_generation_count: int = 1
|
|
supports_first_last_frame: bool = False
|
|
supports_universal_reference: bool = True
|
|
|
|
|
|
class VideoEngineListResponse(BaseModel):
|
|
items: list[VideoEnginePublic]
|