rag-memory-epf-mcp 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -8
- package/dist/src/migrations/migrations.js +5 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78,17 +78,22 @@ class RAGKnowledgeGraphManager {
|
|
|
78
78
|
// Configure environment to allow remote model downloads
|
|
79
79
|
env.allowRemoteModels = true;
|
|
80
80
|
env.allowLocalModels = true;
|
|
81
|
-
this.embeddingModel = await pipeline('feature-extraction', EMBEDDING_MODEL, {
|
|
82
|
-
revision: 'main',
|
|
83
|
-
dtype: 'fp16',
|
|
84
|
-
});
|
|
81
|
+
this.embeddingModel = await pipeline('feature-extraction', EMBEDDING_MODEL, { revision: 'main' });
|
|
85
82
|
this.modelInitialized = true;
|
|
86
|
-
console.error(`✅ ${EMBEDDING_MODEL} model loaded successfully`);
|
|
83
|
+
console.error(`✅ ${EMBEDDING_MODEL} model loaded successfully (fp32)`);
|
|
87
84
|
}
|
|
88
85
|
catch (error) {
|
|
89
|
-
console.error('❌ Failed to load embedding model:', error);
|
|
90
|
-
console.error('
|
|
91
|
-
|
|
86
|
+
console.error('❌ Failed to load embedding model (fp32):', error instanceof Error ? error.message : error);
|
|
87
|
+
console.error('🔄 Retrying with fp16...');
|
|
88
|
+
try {
|
|
89
|
+
this.embeddingModel = await pipeline('feature-extraction', EMBEDDING_MODEL, { revision: 'main', dtype: 'fp16' });
|
|
90
|
+
this.modelInitialized = true;
|
|
91
|
+
console.error(`✅ ${EMBEDDING_MODEL} model loaded successfully (fp16 fallback)`);
|
|
92
|
+
}
|
|
93
|
+
catch (retryError) {
|
|
94
|
+
console.error('❌ Embedding model failed to load. Search will not work.', retryError instanceof Error ? retryError.message : retryError);
|
|
95
|
+
this.modelInitialized = false;
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
async runMigrations() {
|
|
@@ -336,10 +336,10 @@ export const migrations = [
|
|
|
336
336
|
db.exec(`DROP TABLE IF EXISTS chunks_fts`);
|
|
337
337
|
}
|
|
338
338
|
},
|
|
339
|
-
// Migration 8:
|
|
339
|
+
// Migration 8: Rebuild FTS5 with remove_diacritics for better multilingual matching
|
|
340
340
|
{
|
|
341
341
|
version: 8,
|
|
342
|
-
description: '
|
|
342
|
+
description: 'Rebuild FTS5 with unicode61 remove_diacritics for multilingual support',
|
|
343
343
|
up: (db) => {
|
|
344
344
|
// Drop existing triggers
|
|
345
345
|
db.exec(`DROP TRIGGER IF EXISTS entities_fts_insert`);
|
|
@@ -351,21 +351,19 @@ export const migrations = [
|
|
|
351
351
|
// Drop old FTS5 tables
|
|
352
352
|
db.exec(`DROP TABLE IF EXISTS entities_fts`);
|
|
353
353
|
db.exec(`DROP TABLE IF EXISTS chunks_fts`);
|
|
354
|
-
// Recreate with
|
|
354
|
+
// Recreate with remove_diacritics=2 for better multilingual matching
|
|
355
355
|
db.exec(`
|
|
356
356
|
CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
357
357
|
name, observations, entityType,
|
|
358
358
|
content='entities', content_rowid='rowid',
|
|
359
|
-
tokenize='unicode61
|
|
360
|
-
detail=full
|
|
359
|
+
tokenize='unicode61 remove_diacritics 2'
|
|
361
360
|
)
|
|
362
361
|
`);
|
|
363
362
|
db.exec(`
|
|
364
363
|
CREATE VIRTUAL TABLE IF NOT EXISTS chunks_fts USING fts5(
|
|
365
364
|
text, chunk_id,
|
|
366
365
|
content='chunk_metadata', content_rowid='rowid',
|
|
367
|
-
tokenize='unicode61
|
|
368
|
-
detail=full
|
|
366
|
+
tokenize='unicode61 remove_diacritics 2'
|
|
369
367
|
)
|
|
370
368
|
`);
|
|
371
369
|
// Repopulate
|