feature: 新增小说封面图片生成功能
This commit is contained in:
@@ -32,6 +32,13 @@ class Project(Base):
|
||||
chapter_count = Column(Integer, comment="章节数量")
|
||||
narrative_perspective = Column(String(50), comment="叙事视角:first_person/third_person/omniscient")
|
||||
character_count = Column(Integer, default=5, comment="角色数量")
|
||||
|
||||
# 封面字段
|
||||
cover_image_url = Column(String(1000), comment="封面图片访问地址")
|
||||
cover_prompt = Column(Text, comment="最近一次生成封面使用的提示词")
|
||||
cover_status = Column(String(20), default="none", nullable=False, comment="封面状态: none/generating/ready/failed")
|
||||
cover_error = Column(Text, comment="最近一次封面生成失败原因")
|
||||
cover_updated_at = Column(DateTime, comment="最近一次封面生成成功时间")
|
||||
|
||||
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
||||
@@ -41,7 +48,11 @@ class Project(Base):
|
||||
"outline_mode IN ('one-to-one', 'one-to-many')",
|
||||
name='check_outline_mode'
|
||||
),
|
||||
CheckConstraint(
|
||||
"cover_status IN ('none', 'generating', 'ready', 'failed')",
|
||||
name='check_cover_status'
|
||||
),
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Project(id={self.id}, title={self.title})>"
|
||||
return f"<Project(id={self.id}, title={self.title})>"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""设置数据模型"""
|
||||
from sqlalchemy import Column, String, Text, Float, Integer, DateTime, Index
|
||||
from sqlalchemy import Column, String, Text, Float, Integer, DateTime, Boolean, Index
|
||||
from sqlalchemy.sql import func
|
||||
from app.database import Base
|
||||
import uuid
|
||||
@@ -18,6 +18,14 @@ class Settings(Base):
|
||||
temperature = Column(Float, default=0.7, comment="温度参数")
|
||||
max_tokens = Column(Integer, default=2000, comment="最大token数")
|
||||
system_prompt = Column(Text, comment="系统级别提示词,每次AI调用都会使用")
|
||||
|
||||
# 封面图片生成配置
|
||||
cover_api_provider = Column(String(50), comment="封面图片API提供商")
|
||||
cover_api_key = Column(String(500), comment="封面图片API密钥")
|
||||
cover_api_base_url = Column(String(500), comment="封面图片自定义API地址")
|
||||
cover_image_model = Column(String(100), comment="封面图片模型名称")
|
||||
cover_enabled = Column(Boolean, default=False, server_default="0", nullable=False, comment="是否启用封面图片生成")
|
||||
|
||||
preferences = Column(Text, comment="其他偏好设置(JSON)")
|
||||
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
||||
@@ -27,4 +35,4 @@ class Settings(Base):
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Settings(id={self.id}, user_id={self.user_id}, api_provider={self.api_provider})>"
|
||||
return f"<Settings(id={self.id}, user_id={self.user_id}, api_provider={self.api_provider})>"
|
||||
|
||||
Reference in New Issue
Block a user