fix: switch embedding dimension from 1536 to 2560 for qwen-embedding-4b
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s

This commit is contained in:
Antigravity
2026-05-12 09:07:55 +00:00
parent feaeb075ce
commit e09ea3a145
10 changed files with 105 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
-- Phase 1: Enable pgvector extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Phase 2: Convert embedding column from text to vector(1536)
-- Phase 2: Convert embedding column from text to vector(2560)
-- Idempotent: detects current column type and only converts when needed.
-- Handles all partial states from previous failed migration attempts:
-- A) embedding is text → direct ALTER COLUMN TYPE conversion
@@ -25,8 +25,8 @@ BEGIN
IF _emb_type IS NOT NULL THEN
ALTER TABLE "NoteEmbedding" DROP COLUMN IF EXISTS "_vec_tmp";
ALTER TABLE "NoteEmbedding"
ALTER COLUMN "embedding" TYPE vector(1536)
USING "embedding"::vector(1536);
ALTER COLUMN "embedding" TYPE vector(2560)
USING "embedding"::vector(2560);
RETURN;
END IF;

View File

@@ -300,7 +300,7 @@ model UserAISettings {
model NoteEmbedding {
id String @id @default(cuid())
noteId String @unique
embedding Unsupported("vector(1536)")
embedding Unsupported("vector(2560)")
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
note Note @relation(fields: [noteId], references: [id], onDelete: Cascade)