-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_rag.js
More file actions
56 lines (45 loc) · 1.99 KB
/
test_rag.js
File metadata and controls
56 lines (45 loc) · 1.99 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Test script to verify RAG indexing functionality
import { invoke } from '@tauri-apps/api/core'
async function testRAG() {
console.log('Testing RAG functionality...')
try {
// 1. Check embedding service
console.log('\n1. Checking embedding service...')
const serviceAvailable = await invoke('rag_check_embedding_service')
console.log('Embedding service available:', serviceAvailable)
if (!serviceAvailable) {
console.log('Pulling embedding model...')
await invoke('rag_pull_embedding_model')
console.log('Model pulled successfully')
}
// 2. Create a test note
console.log('\n2. Creating test note...')
const testNote = await invoke('create_note', {
title: 'RAG Test Note',
content: 'This is a test note for RAG indexing. It contains some content about machine learning, embeddings, and vector databases. The goal is to test if the RAG indexing pipeline is working correctly with Ollama embeddings.',
folder_id: null
})
console.log('Test note created:', testNote.id)
// 3. Index the note
console.log('\n3. Indexing the note...')
await invoke('rag_index_note', { noteId: testNote.id })
console.log('Note indexed successfully')
// 4. Check index status
console.log('\n4. Checking index status...')
const status = await invoke('rag_check_note_index_status', { noteId: testNote.id })
console.log('Index status:', status)
// 5. Get debug info
console.log('\n5. Getting debug info...')
const debugInfo = await invoke('rag_get_note_debug_info', { noteId: testNote.id })
console.log('Debug info:', JSON.stringify(debugInfo, null, 2))
// 6. Clean up - delete the test note
console.log('\n6. Cleaning up...')
await invoke('delete_note', { id: testNote.id })
console.log('Test note deleted')
console.log('\n✅ RAG test completed successfully!')
} catch (error) {
console.error('❌ RAG test failed:', error)
}
}
// Run the test
testRAG()