- 在Design模型中新增video_url字段用于存储360度展示视频URL - 在DesignImage模型中新增model_3d_url字段用于存储3D模型URL - 设计路由新增生成视频接口,调用火山引擎即梦3.0 Pro API生成展示视频 - 设计路由新增生成3D模型接口,调用腾讯混元3D服务生成.glb格式3D模型 - 新增本地文件删除工具,支持强制重新生成时清理旧文件 - 设计响应Schema中添加video_url和model_3d_url字段支持前后端数据传递 - 前端设计详情页新增360度旋转3D模型展示区,支持生成、重新生成和下载3D模型 - 实现录制3D模型展示视频功能,支持捕获model-viewer旋转画面逐帧合成WebM文件下载 - 引入@google/model-viewer库作为3D模型Web组件展示支持 - 管理后台新增即梦视频生成和腾讯混元3D模型生成配置界面,方便服务密钥管理 - 前端API增加生成视频和生成3D模型接口请求方法,超时设置为10分钟以支持长时间处理 - 优化UI交互提示,新增生成中状态显示和错误提示,提升用户体验和操作反馈
71 lines
2.3 KiB
Python
71 lines
2.3 KiB
Python
"""
|
|
设计作品相关 Pydantic Schemas
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import Optional, List
|
|
|
|
from .category import CategoryResponse, SubTypeResponse, ColorResponse
|
|
|
|
|
|
class DesignImageResponse(BaseModel):
|
|
"""设计图片响应(单张视角图)"""
|
|
id: int
|
|
view_name: str
|
|
image_url: Optional[str] = None
|
|
model_used: Optional[str] = None
|
|
prompt_used: Optional[str] = None
|
|
sort_order: int = 0
|
|
model_3d_url: Optional[str] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
protected_namespaces = ()
|
|
|
|
|
|
class DesignCreate(BaseModel):
|
|
"""创建设计请求"""
|
|
category_id: int = Field(..., description="品类ID")
|
|
sub_type_id: Optional[int] = Field(None, description="子类型ID")
|
|
color_id: Optional[int] = Field(None, description="颜色ID")
|
|
prompt: str = Field(..., min_length=1, 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="题材纹样")
|
|
size_spec: Optional[str] = Field(None, max_length=100, description="尺寸规格")
|
|
surface_finish: Optional[str] = Field(None, max_length=50, description="表面处理")
|
|
usage_scene: Optional[str] = Field(None, max_length=50, description="用途场景")
|
|
|
|
|
|
class DesignResponse(BaseModel):
|
|
"""设计作品响应"""
|
|
id: int
|
|
user_id: int
|
|
category: CategoryResponse
|
|
sub_type: Optional[SubTypeResponse] = None
|
|
color: Optional[ColorResponse] = None
|
|
prompt: str
|
|
carving_technique: Optional[str] = None
|
|
design_style: Optional[str] = None
|
|
motif: Optional[str] = None
|
|
size_spec: Optional[str] = None
|
|
surface_finish: Optional[str] = None
|
|
usage_scene: Optional[str] = None
|
|
image_url: Optional[str] = None
|
|
video_url: Optional[str] = None
|
|
images: List[DesignImageResponse] = []
|
|
status: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class DesignListResponse(BaseModel):
|
|
"""设计作品列表响应"""
|
|
items: List[DesignResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|