ebc79b34f9
- Migration 0030: add conversations.rag_project_id (NULL=orphan-only, -1=all notes, positive=project), projects.auto_summary and projects.summary_updated_at - Three-value scope semantics thread from build_context() → semantic search and keyword fallback via orphan_only + effective_project_id - Project summarization background job (generate_project_summary, backfill_project_summaries) called via Ollama; triggered on project update and note saves (debounced 1h); runs at startup - New LLM tools: search_projects (SequenceMatcher scoring on title+description+auto_summary) and set_rag_scope (persists to DB, workspace-guarded, emits new_rag_scope in SSE done event) - execute_tool() accepts conv_id + workspace_project_id; generation_task passes both and captures scope changes for SSE done enrichment - Frontend: Conversation type gets rag_project_id; chat store adds ragProjectId computed + updateRagScope(); SSE done handler syncs scope - ChatView: replace sidebar ProjectSelector with a scope chip pill above the input bar, animated dropdown, pulse on model-driven scope change Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
734 B
Python
24 lines
734 B
Python
"""Add rag_project_id to conversations; auto_summary columns to projects."""
|
|
|
|
from alembic import op
|
|
|
|
revision = "0030"
|
|
down_revision = "0029"
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute("""
|
|
ALTER TABLE conversations
|
|
ADD COLUMN IF NOT EXISTS rag_project_id INTEGER DEFAULT NULL
|
|
""")
|
|
op.execute("""
|
|
ALTER TABLE projects
|
|
ADD COLUMN IF NOT EXISTS auto_summary TEXT DEFAULT NULL,
|
|
ADD COLUMN IF NOT EXISTS summary_updated_at TIMESTAMPTZ DEFAULT NULL
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("ALTER TABLE conversations DROP COLUMN IF EXISTS rag_project_id")
|
|
op.execute("ALTER TABLE projects DROP COLUMN IF EXISTS auto_summary, DROP COLUMN IF EXISTS summary_updated_at")
|