""" 提示词模板模型 存储可后台配置的提示词模板和映射数据 """ from sqlalchemy import Column, BigInteger, Integer, String, Text, DateTime from sqlalchemy.sql import func from ..database import Base class PromptTemplate(Base): """提示词模板表""" __tablename__ = "prompt_templates" id = Column(BigInteger, primary_key=True, autoincrement=True, comment="模板ID") template_key = Column(String(100), unique=True, nullable=False, comment="模板键: main_template / quality_suffix") template_value = Column(Text, nullable=False, comment="模板内容,支持{变量}占位符") description = Column(String(255), nullable=True, comment="模板说明") updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间") def __repr__(self): return f"" class PromptMapping(Base): """提示词映射表 - 中文参数到英文描述的映射""" __tablename__ = "prompt_mappings" id = Column(BigInteger, primary_key=True, autoincrement=True, comment="映射ID") mapping_type = Column(String(50), nullable=False, comment="映射类型: category/color/carving/style/motif/finish/scene/view/sub_type") cn_key = Column(String(100), nullable=False, comment="中文键") en_value = Column(Text, nullable=False, comment="英文描述") sort_order = Column(Integer, default=0, comment="排序") updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间") def __repr__(self): return f""