26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
"""知识库文档元数据模型。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import BigInteger, Integer, TIMESTAMP, VARCHAR
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from .base import Base
|
|
|
|
|
|
class KnowledgeBaseDoc(Base):
|
|
__tablename__ = "knowledge_base_docs"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
title: Mapped[str] = mapped_column(VARCHAR(255), nullable=False)
|
|
file_type: Mapped[str] = mapped_column(VARCHAR(32), nullable=False)
|
|
source_type: Mapped[str] = mapped_column(VARCHAR(32), nullable=False, default="file")
|
|
file_url: Mapped[Optional[str]] = mapped_column(VARCHAR(1024), nullable=True)
|
|
uploaded_by: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True)
|
|
status: Mapped[str] = mapped_column(VARCHAR(20), nullable=False, default="processing")
|
|
last_fetched_at: Mapped[Optional[datetime]] = mapped_column(TIMESTAMP, nullable=True)
|
|
error_message: Mapped[Optional[str]] = mapped_column(VARCHAR(500), nullable=True)
|