- 将默认AI生图模型升级为flux-dev及seedream-5.0版本 - SiliconFlow模型由FLUX.1-dev切换为Kolors,优化调用参数和返回值 - 火山引擎Seedream升级至5.0 lite版本,支持多视角参考图传入 - 设计图片字段由字符串改为Text扩展URL长度限制 - 设计图下载支持远程URL重定向和本地文件兼容 - 生成AI图片时多视角保持风格一致,SiliconFlow复用seed,Seedream传参考图 - 后台配置界面更改模型名称及价格显示,新增API Key状态检测 - 前端照片下载从链接改为按钮,远程文件新窗口打开 - 设计相关接口支持较长请求超时,下载走API路径无/api前缀 - 前端页面兼容驼峰与下划线格式URL参数识别 - 用户中心设计图下载支持本地文件Token授权下载 - 初始化数据库新增完整表结构与约束,适配新版设计业务逻辑
41 lines
2.1 KiB
Python
41 lines
2.1 KiB
Python
"""
|
|
设计作品模型
|
|
"""
|
|
from sqlalchemy import Column, BigInteger, Integer, String, Text, DateTime, ForeignKey
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from ..database import Base
|
|
|
|
|
|
class Design(Base):
|
|
"""设计作品表"""
|
|
__tablename__ = "designs"
|
|
|
|
id = Column(BigInteger, primary_key=True, autoincrement=True, comment="设计ID")
|
|
user_id = Column(BigInteger, ForeignKey("users.id"), nullable=False, comment="用户ID")
|
|
category_id = Column(Integer, ForeignKey("categories.id"), nullable=False, comment="品类ID")
|
|
sub_type_id = Column(Integer, ForeignKey("sub_types.id"), nullable=True, comment="子类型ID")
|
|
color_id = Column(Integer, ForeignKey("colors.id"), nullable=True, comment="颜色ID")
|
|
prompt = Column(Text, nullable=False, comment="设计需求")
|
|
carving_technique = Column(String(50), nullable=True, comment="雕刻工艺")
|
|
design_style = Column(String(50), nullable=True, comment="设计风格")
|
|
motif = Column(String(100), nullable=True, comment="题材纹样")
|
|
size_spec = Column(String(100), nullable=True, comment="尺寸规格")
|
|
surface_finish = Column(String(50), nullable=True, comment="表面处理")
|
|
usage_scene = Column(String(50), nullable=True, comment="用途场景")
|
|
image_url = Column(Text, nullable=True, comment="设计图URL")
|
|
status = Column(String(20), default="generating", comment="状态")
|
|
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
|
|
|
# 关联关系
|
|
user = relationship("User", back_populates="designs")
|
|
category = relationship("Category", back_populates="designs")
|
|
sub_type = relationship("SubType", back_populates="designs")
|
|
color = relationship("Color", back_populates="designs")
|
|
images = relationship("DesignImage", back_populates="design", cascade="all, delete-orphan", order_by="DesignImage.sort_order")
|
|
|
|
def __repr__(self):
|
|
return f"<Design(id={self.id}, status='{self.status}')>"
|