fix(backend): 修复视频生成接口401认证失败问题

- 修正可灵视频任务提交时认证失败导致的视频生成错误
- 解决接口返回500错误的问题
- 优化视频生成相关的错误日志提示
- 保证上传目录准备状态的正确显示
- 提升后台服务日志的稳定性和连续性
This commit is contained in:
2026-04-13 14:41:02 +08:00
parent 7f84a04e27
commit 18dfc75372
10 changed files with 228 additions and 14 deletions

View File

@@ -27,8 +27,9 @@ class DesignCreate(BaseModel):
"""创建设计请求"""
category_id: int = Field(..., description="品类ID")
sub_type_id: Optional[int] = Field(None, description="子类型ID")
sub_type_name: Optional[str] = Field(None, max_length=50, description="自定义子类型名称")
color_id: Optional[int] = Field(None, description="颜色ID")
prompt: str = Field(..., min_length=1, max_length=2000, description="设计需求")
prompt: Optional[str] = Field(None, max_length=2000, description="设计需求")
carving_technique: Optional[str] = Field(None, max_length=50, description="雕刻工艺")
design_style: Optional[str] = Field(None, max_length=50, description="设计风格")
motif: Optional[str] = Field(None, max_length=100, description="题材纹样")

View File

@@ -139,7 +139,7 @@ async def _generate_ai_images(
prompt_text = build_prompt(
category_name=category.name,
view_name=view_name,
sub_type_name=sub_type.name if sub_type else None,
sub_type_name=sub_type.name if sub_type else design_data.sub_type_name,
color_name=color.name if color else None,
user_prompt=design_data.prompt,
carving_technique=design_data.carving_technique,
@@ -244,7 +244,7 @@ def _generate_mock_fallback(
save_path = os.path.join(settings.UPLOAD_DIR, "designs", f"{design.id}.png")
image_url = generate_mock_design(
category_name=category.name,
sub_type_name=sub_type.name if sub_type else None,
sub_type_name=sub_type.name if sub_type else design_data.sub_type_name,
color_name=color.name if color else None,
prompt=design_data.prompt,
save_path=save_path,