25 lines
1.6 KiB
Python
25 lines
1.6 KiB
Python
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, ForeignKey, func
|
|
from database import Base
|
|
|
|
class Paragraph(Base):
|
|
__tablename__ = "paragraphs"
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
template_id = Column(Integer, ForeignKey("templates.id"), nullable=False)
|
|
sort_index = Column(Integer, default=0, comment="排序")
|
|
anchor_title = Column(String(500), default="", comment="原始标题锚点")
|
|
title = Column(String(500), default="", comment="段落标题")
|
|
content = Column(Text, default="", comment="正文内容/上下文")
|
|
style_json = Column(Text, default="{}", comment="段落样式定义JSON")
|
|
is_table = Column(Boolean, default=False, comment="是否为表格")
|
|
table_json = Column(Text, default="{}", comment="表格结构JSON")
|
|
edit_mode = Column(String(20), default="manual", comment="manual/ai")
|
|
write_mode = Column(String(30), default="replace_section", comment="replace_section/append_after_heading/replace_heading_only")
|
|
model_id = Column(Integer, ForeignKey("ai_models.id"), nullable=True, comment="指定模型")
|
|
need_prompt = Column(Boolean, default=True, comment="是否需要提示词")
|
|
prompt_text = Column(Text, default="", comment="预设提示词")
|
|
need_file = Column(Boolean, default=False, comment="是否需要上传参考文件")
|
|
file_note = Column(Text, default="", comment="备注说明(传什么文件)")
|
|
output_format = Column(String(20), default="text", comment="text/table/mixed/chart")
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|