feat: AI 生图、图片下载优化
This commit is contained in:
@@ -38,12 +38,15 @@ def texts_to_raw(texts: list[TextMaterial]) -> dict:
|
||||
|
||||
def validate_model(provider_name: str, model: str | None) -> None:
|
||||
"""按 provider 校验模型名白名单,不合法抛 ValueError。"""
|
||||
from schemas.suite import RIGHTAPI_MODELS, TONGYI_MODELS
|
||||
from schemas.suite import PCORE_MODELS, RIGHTAPI_MODELS, TONGYI_MODELS, api_model
|
||||
|
||||
if provider_name == "tongyi" and model and model not in TONGYI_MODELS:
|
||||
raise ValueError(f"不支持的模型: {model}(tongyi 支持: {TONGYI_MODELS})")
|
||||
if provider_name == "rightapi" and model and model not in RIGHTAPI_MODELS:
|
||||
raise ValueError(f"不支持的模型: {model}(rightapi 支持: {RIGHTAPI_MODELS})")
|
||||
m = api_model(model) # 'gpt-image-2@pcore' → 'gpt-image-2'
|
||||
if provider_name == "tongyi" and m and m not in TONGYI_MODELS:
|
||||
raise ValueError(f"不支持的模型: {m}(tongyi 支持: {TONGYI_MODELS})")
|
||||
if provider_name == "rightapi" and m and m not in RIGHTAPI_MODELS:
|
||||
raise ValueError(f"不支持的模型: {m}(rightapi 支持: {RIGHTAPI_MODELS})")
|
||||
if provider_name == "pcore" and m and m not in PCORE_MODELS:
|
||||
raise ValueError(f"不支持的模型: {m}(pcore 支持: {PCORE_MODELS})")
|
||||
|
||||
|
||||
async def append_generated_asset(
|
||||
|
||||
Reference in New Issue
Block a user