feat: prepare RAG evidence and compatible chat requests

This commit is contained in:
2026-10-16 20:01:00 +08:00
committed by saint
parent ed8780cacc
commit d91a6808a9
16 changed files with 1066 additions and 5 deletions
@@ -0,0 +1,30 @@
"""Persist prepared evidence and Chat Completions requests without invoking a model."""
import sqlalchemy as sa
from alembic import op
revision = "0007_rag_contexts"
down_revision = "0006_vectors"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"rag_contexts",
sa.Column("id", sa.String(36), primary_key=True),
sa.Column(
"retrieval_run_id", sa.String(36), sa.ForeignKey("retrieval_runs.id"), nullable=False
),
sa.Column("created_by", sa.Integer(), sa.ForeignKey("users.id"), nullable=False),
sa.Column("response", sa.JSON(), nullable=False),
sa.Column(
"created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False
),
)
op.create_index("ix_rag_contexts_retrieval_run_id", "rag_contexts", ["retrieval_run_id"])
op.create_index("ix_rag_contexts_created_at", "rag_contexts", ["created_at"])
def downgrade():
op.drop_table("rag_contexts")