mirror of
https://github.com/Hommy-master/capcut-mate.git
synced 2026-08-28 23:27:50 +08:00
优化接口提示。
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ class CustomError(Enum):
|
||||
IMAGE_ANIMATION_GET_FAILED = (2033, "获取图片动画失败", "Get image animation failed")
|
||||
AUDIO_DURATION_GET_FAILED = (2034, "获取音频时长失败", "Get audio duration failed")
|
||||
INSUFFICIENT_ACCOUNT_BALANCE = (2035, "账户余额不足,当前积分需大于 1 才可继续使用服务,请完成充值后重试", "Insufficient account balance. A minimum of 1 point is required to continue using the service. Please recharge and try again.")
|
||||
INVALID_APIKEY = (2036, "无效的 apiKey", "Invalid apiKey")
|
||||
INVALID_APIKEY = (2036, "无效的 apiKey,请登录官网 https://jcaigc.cn 获取", "Invalid apiKey. Please log in at https://jcaigc.cn to obtain one")
|
||||
INVALID_FILTER_INFO = (2037, "无效的滤镜信息,请检查 filter_infos 字段值是否正确", "Invalid filter information, please check if the value of the filter_infos field is correct.")
|
||||
FILTER_ADD_FAILED = (2038, "滤镜添加失败", "Filter addition failed")
|
||||
FILTER_NOT_FOUND = (2039, "滤镜未找到,请检查滤镜名称是否正确", "Filter not found, please check if the filter name is correct.")
|
||||
|
||||
@@ -7,7 +7,10 @@ from typing import Optional
|
||||
class GenVideoRequest(BaseModel):
|
||||
"""根据草稿导出视频"""
|
||||
draft_url: str = Field(default="", description="草稿URL")
|
||||
apiKey: Optional[str] = Field(default=None, description="apiKey必须是合法的UUID格式")
|
||||
apiKey: Optional[str] = Field(
|
||||
default=None,
|
||||
description="apiKey 必须是合法的 UUID 格式;可登录官网 https://jcaigc.cn 获取",
|
||||
)
|
||||
|
||||
@field_validator('apiKey')
|
||||
@classmethod
|
||||
@@ -17,7 +20,9 @@ class GenVideoRequest(BaseModel):
|
||||
try:
|
||||
uuid.UUID(v)
|
||||
except ValueError:
|
||||
raise ValueError('API密钥格式不正确,必须是合法的UUID')
|
||||
raise ValueError(
|
||||
"API密钥格式不正确,必须是合法的UUID;请登录官网 https://jcaigc.cn 获取 apiKey"
|
||||
)
|
||||
return v
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def gen_video(draft_url: str, apiKey: str = None) -> str:
|
||||
|
||||
try:
|
||||
if config.ENABLE_APIKEY:
|
||||
if apiKey == "": # 开启API密钥验证
|
||||
if not apiKey: # 未传或空字符串
|
||||
raise CustomException(CustomError.INVALID_APIKEY)
|
||||
|
||||
# 查询用户积分
|
||||
|
||||
Reference in New Issue
Block a user