Spaces:
Build error
Build error
anwarKXC commited on
Commit ·
a905058
1
Parent(s): ac6396f
feat: add materials_used column to chat_messages
Browse filesFiles changed (2)
123456789101112131415161718192021222324252627282930"""Add materials_used column to chat_messages.
Snapshots the resolved materials[] selection (page-anchored IDs, pageranges, and human-readable titles) that a generation turn searchedagainst — populated before generation, distinct from the existing`sources` column which is populated after generation with the chunksactually cited in the answer.
Revision ID: b8c9d0e1f2a3Revises: a7b8c9d0e1f2"""from alembic import opimport sqlalchemy as safrom sqlalchemy.dialects.postgresql import JSONB
revision = 'b8c9d0e1f2a3'down_revision = 'a7b8c9d0e1f2'branch_labels = Nonedepends_on = None
def upgrade() -> None: op.add_column( 'chat_messages', sa.Column('materials_used', JSONB, nullable=True), )
def downgrade() -> None: op.drop_column('chat_messages', 'materials_used')299 unmodified lines300301302303304305306299 unmodified linessession_id = Column(UUID(as_uuid=True), nullable=False)role = Column(Text, nullable=False) # user|assistant|systemcontent = Column(Text, nullable=False)sources = Column(JSONB)tokens_used = Column(Integer, nullable=False, server_default=text("0"))created_at = _now()299 unmodified lines300301302303304305306307299 unmodified linessession_id = Column(UUID(as_uuid=True), nullable=False)role = Column(Text, nullable=False) # user|assistant|systemcontent = Column(Text, nullable=False)sources = Column(JSONB)materials_used = Column(JSONB)tokens_used = Column(Integer, nullable=False, server_default=text("0"))created_at = _now()
alembic/versions/b8c9d0e1f2a3_add_materials_used_to_chat_messages.pyAdded+30
app/models/rag_db.py+2-1