-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreindex_notes.js
More file actions
31 lines (24 loc) · 1006 Bytes
/
reindex_notes.js
File metadata and controls
31 lines (24 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Script to trigger RAG re-indexing of all notes
// Run this in the browser console
async function reindexAllNotes() {
try {
console.log('Starting RAG indexing of all notes...');
// Import the AI API
const { aiApi } = await import('/src/lib/aiApi.ts');
// Trigger indexing
const stats = await aiApi.ragIndexAllNotes();
console.log('Indexing complete!', stats);
console.log(`Indexed ${stats.indexed_notes} out of ${stats.total_notes} notes`);
console.log(`Created ${stats.total_chunks} chunks, ${stats.chunks_with_embeddings} with embeddings`);
if (stats.failed_notes.length > 0) {
console.warn('Failed to index notes:', stats.failed_notes);
}
return stats;
} catch (error) {
console.error('Failed to index notes:', error);
throw error;
}
}
// Execute the function
console.log('To re-index all notes, run: reindexAllNotes()');
console.log('Or go to Settings -> AI Configuration and click "Index All Notes" button');