feat: integrate vectordb for note embeddings
- Added `vectordb` as a dependency in `package.json`. - Implemented `embedText` function in `src/main/ai/embeddings.ts` to handle text embeddings using GitHub Copilot OAuth token or OpenAI token. - Created `vectordb.ts` for managing LanceDB connection and embedding notes with upsert strategy. - Updated `index.ts` to initialize vector database and migrate existing notes on app ready. - Modified `router/index.ts` to fire-and-forget embedding calls on note creation and updates. - Enhanced `progress.txt` with detailed implementation notes and learnings regarding the integration.
This commit is contained in:
4
prd.json
4
prd.json
@@ -401,8 +401,8 @@
|
||||
"Typecheck passes"
|
||||
],
|
||||
"priority": 22,
|
||||
"passes": false,
|
||||
"notes": ""
|
||||
"passes": true,
|
||||
"notes": "Completed: vectordb npm package installed. src/main/ai/embeddings.ts reads GitHub Copilot OAuth token from ~/.copilot/config.json (falls back to stored OpenAI token) and calls OpenAIEmbeddings with Copilot base URL or standard OpenAI. src/main/db/vectordb.ts: initVectorDb() singleton, upsertNoteEmbedding() with delete-then-add strategy (table created on first upsert from schema inferred record), migrateNotesIfNeeded() embeds all SQLite notes sequentially on first launch. notes.create and notes.update made async with fire-and-forget .catch() embed calls; update re-fetches full note from SQLite to embed current title+content. initVectorDb().then(migrateNotesIfNeeded) chained in app.ready after initAI(). vectordb externalized in vite.main.config.mts. Typecheck passes (tsc --noEmit clean). Note: @github/copilot-sdk has no embeddings API; embeddings use @langchain/openai's OpenAIEmbeddings pointed at https://api.githubcopilot.com with the CLI OAuth token."
|
||||
},
|
||||
{
|
||||
"id": "US-023",
|
||||
|
||||
Reference in New Issue
Block a user