rag-memory-epf-mcp 3.1.2 → 3.1.4
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 +9 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78,20 +78,21 @@ 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, { revision: 'main' });
|
|
81
|
+
this.embeddingModel = await pipeline('feature-extraction', EMBEDDING_MODEL, { revision: 'main', dtype: 'fp16' });
|
|
82
82
|
this.modelInitialized = true;
|
|
83
|
-
console.error(`✅ ${EMBEDDING_MODEL} model loaded successfully (
|
|
83
|
+
console.error(`✅ ${EMBEDDING_MODEL} model loaded successfully (fp16)`);
|
|
84
84
|
}
|
|
85
85
|
catch (error) {
|
|
86
|
-
console.error('❌ Failed to load embedding model (
|
|
87
|
-
|
|
86
|
+
console.error('❌ Failed to load embedding model (fp16):', error instanceof Error ? error.message : error);
|
|
87
|
+
const FALLBACK_MODEL = 'Xenova/all-MiniLM-L6-v2';
|
|
88
|
+
console.error(`🔄 Falling back to ${FALLBACK_MODEL}...`);
|
|
88
89
|
try {
|
|
89
|
-
this.embeddingModel = await pipeline('feature-extraction',
|
|
90
|
+
this.embeddingModel = await pipeline('feature-extraction', FALLBACK_MODEL, { revision: 'main' });
|
|
90
91
|
this.modelInitialized = true;
|
|
91
|
-
console.error(`✅ ${
|
|
92
|
+
console.error(`✅ ${FALLBACK_MODEL} loaded (fallback — 384-dim, English-focused)`);
|
|
92
93
|
}
|
|
93
94
|
catch (retryError) {
|
|
94
|
-
console.error('❌
|
|
95
|
+
console.error('❌ All embedding models failed to load. Search will not work.', retryError instanceof Error ? retryError.message : retryError);
|
|
95
96
|
this.modelInitialized = false;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
@@ -1802,7 +1803,7 @@ class RAGKnowledgeGraphManager {
|
|
|
1802
1803
|
const similarEntities = Array.from(entityMap.values()).sort((a, b) => a.distance - b.distance);
|
|
1803
1804
|
for (const entity of similarEntities) {
|
|
1804
1805
|
const similarity = Math.max(0, 1 - entity.distance / 2);
|
|
1805
|
-
if (similarity > 0.
|
|
1806
|
+
if (similarity > 0.4) {
|
|
1806
1807
|
queryMatchedEntities.add(entity.name);
|
|
1807
1808
|
// Get connected entities via relationships
|
|
1808
1809
|
const connected = this.db.prepare(`
|