This commit is contained in:
amb
2026-09-01 20:51:46 +08:00
parent 70ece67910
commit b80161972a
18 changed files with 1878 additions and 359 deletions
+22 -8
View File
@@ -37,12 +37,23 @@ class Document(UUIDPrimaryKeyMixin, TimestampMixin, Base):
original_filename: Mapped[str] = mapped_column(
String(512),
nullable=False,
comment="原始文件名 (仅展示)",
comment="原始文件名或文本标题 (仅展示)",
)
storage_path: Mapped[str] = mapped_column(
storage_path: Mapped[str | None] = mapped_column(
String(1024),
nullable=True,
comment="相对于 data/ 的物理存储路径(文本内容文档为 NULL)",
)
content: Mapped[str | None] = mapped_column(
Text,
nullable=True,
comment="直接输入的文本内容(非文件上传时使用)",
)
content_format: Mapped[str] = mapped_column(
String(16),
default="markdown",
nullable=False,
comment="相对于 data/ 的物理存储路径",
comment="内容格式:markdown / text",
)
markdown_path: Mapped[str | None] = mapped_column(
String(1024),
@@ -51,23 +62,26 @@ class Document(UUIDPrimaryKeyMixin, TimestampMixin, Base):
)
file_size: Mapped[int] = mapped_column(
Integer,
default=0,
nullable=False,
comment="文件大小 (字节)",
comment="文件大小 (字节),文本内容文档为内容长度",
)
mime_type: Mapped[str] = mapped_column(
String(127),
default="text/markdown",
nullable=False,
comment="MIME 类型",
)
file_ext: Mapped[str] = mapped_column(
String(16),
default=".md",
nullable=False,
comment="文件扩展名 (.docx/.pdf)",
comment="文件扩展名 (.docx/.pdf/.md)",
)
sha256: Mapped[str] = mapped_column(
sha256: Mapped[str | None] = mapped_column(
String(64),
nullable=False,
comment="文件 SHA-256 哈希",
nullable=True,
comment="文件 SHA-256 哈希(文本内容文档为 NULL",
)
doc_token_hash: Mapped[str] = mapped_column(
String(64),