3 months ago
0cda296embeddings_vec had only chunk_id as primary key, so INSERT OR REPLACE discarded model identity. When a workspace had vectors from multiple providers/models, the vec table kept only the last-inserted vector per chunk — ANN retrieval could rank against the wrong model's vectors. Fix: - Add provider and model metadata columns to embeddings_vec schema - Include provider/model in INSERT OR REPLACE - Filter KNN query on embeddings_vec.provider/model directly (remove the join to embeddings table for filtering — vec0 metadata columns support WHERE clause filtering) - Delete remains chunk_id-based (correct — deletes all models for the chunk) Typecheck 8/8, tests 144 pass. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Parentbb91bbf