| 123456789101112131415161718192021 |
- from datetime import datetime
- from core_db import AuditMixin, Base, EntityMixin
- from core_shared import JSONValue
- from sqlalchemy import DateTime, String, Text
- from sqlalchemy import JSON
- from sqlalchemy.orm import Mapped, mapped_column
- class KnowledgeDocument(EntityMixin, AuditMixin, Base):
- __tablename__ = "knowledge_document"
- knowledge_base_id: Mapped[str] = mapped_column(String(36), index=True)
- title: Mapped[str] = mapped_column(String(256))
- source_type: Mapped[str] = mapped_column(String(32), default="text", index=True)
- source_uri: Mapped[str | None] = mapped_column(String(512), nullable=True)
- status: Mapped[str] = mapped_column(String(32), default="draft", index=True)
- content_text: Mapped[str] = mapped_column(Text)
- content_hash: Mapped[str | None] = mapped_column(String(64), nullable=True, index=True)
- metadata_json: Mapped[dict[str, JSONValue] | None] = mapped_column(JSON, nullable=True)
- indexed_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|