feat(rag): lite-model document summaries — non-markdown docs summarized at import, summary chunk retrieves and resolves to the full source doc
This commit is contained in:
@@ -50,6 +50,12 @@ class Document(Base):
|
||||
content: Mapped[str] = mapped_column(Text) # full markdown — the RAG context
|
||||
content_hash: Mapped[str] = mapped_column(String(64), index=True) # sha256 for change detection
|
||||
indexed_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
#: Lite-model summary, phase 30. Natural-language summary of the
|
||||
#: document (non-markdown A9 docs only, generated at import time by the
|
||||
#: aipi ``lite`` model). NULL for markdown docs, pre-phase-30 rows, and
|
||||
#: the fail-soft path where summary generation failed but the document
|
||||
#: was still indexed.
|
||||
summary: Mapped[str | None] = mapped_column(Text, default=None)
|
||||
|
||||
chunks: Mapped[list[Chunk]] = relationship(
|
||||
back_populates="document", cascade="all, delete-orphan"
|
||||
@@ -66,6 +72,10 @@ class Chunk(Base):
|
||||
position: Mapped[int] = mapped_column(Integer)
|
||||
content: Mapped[str] = mapped_column(Text)
|
||||
embedding: Mapped[list[float] | None] = mapped_column(Vector(EMBEDDING_DIM))
|
||||
#: Summary chunk, position −1, phase 30. Marks the single extra embedded
|
||||
#: chunk mirroring ``Document.summary``; default False keeps every
|
||||
#: pre-phase-30 row (and ordinary content chunks) valid.
|
||||
is_summary: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
document: Mapped[Document] = relationship(back_populates="chunks")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user