chore: recovery checkpoint - v3.0 API successfully recovered
CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
This commit is contained in:
parent
f65455fb22
commit
8ff382ca3b
895 changed files with 143654 additions and 28268 deletions
|
|
@ -0,0 +1,95 @@
|
|||
/**
|
||||
* Hybrid Model Manager - BEST OF BOTH WORLDS
|
||||
*
|
||||
* NOW A WRAPPER AROUND SingletonModelManager
|
||||
* Maintained for backward compatibility
|
||||
*
|
||||
* Previously combined:
|
||||
* 1. Multi-source downloading strategy (GitHub → CDN → Hugging Face)
|
||||
* 2. Singleton pattern preventing multiple ONNX model loads
|
||||
* 3. Environment-specific optimizations
|
||||
* 4. Graceful fallbacks and error handling
|
||||
*
|
||||
* Now delegates all operations to SingletonModelManager for true unification
|
||||
*/
|
||||
import { singletonModelManager, getUnifiedEmbeddingFunction } from '../embeddings/SingletonModelManager.js';
|
||||
/**
|
||||
* HybridModelManager - Now a wrapper around SingletonModelManager
|
||||
* Maintained for backward compatibility
|
||||
*/
|
||||
class HybridModelManager {
|
||||
constructor() {
|
||||
console.log('🔄 HybridModelManager now delegates to SingletonModelManager');
|
||||
}
|
||||
static getInstance() {
|
||||
if (!HybridModelManager.instance) {
|
||||
HybridModelManager.instance = new HybridModelManager();
|
||||
}
|
||||
return HybridModelManager.instance;
|
||||
}
|
||||
/**
|
||||
* Get the primary embedding model - delegates to SingletonModelManager
|
||||
*/
|
||||
async getPrimaryModel() {
|
||||
// Delegate to SingletonModelManager
|
||||
return await singletonModelManager.getModel();
|
||||
}
|
||||
/**
|
||||
* Get embedding function - delegates to SingletonModelManager
|
||||
*/
|
||||
async getEmbeddingFunction() {
|
||||
return await getUnifiedEmbeddingFunction();
|
||||
}
|
||||
/**
|
||||
* Check if model is ready - delegates to SingletonModelManager
|
||||
*/
|
||||
isModelReady() {
|
||||
return singletonModelManager.isInitialized();
|
||||
}
|
||||
/**
|
||||
* Force model reload - not supported with SingletonModelManager
|
||||
*/
|
||||
async reloadModel() {
|
||||
console.warn('⚠️ Model reload not supported with SingletonModelManager');
|
||||
console.log('ℹ️ Singleton model persists for consistency');
|
||||
// Just ensure model is initialized
|
||||
await this.getPrimaryModel();
|
||||
}
|
||||
/**
|
||||
* Get model status - delegates to SingletonModelManager
|
||||
*/
|
||||
getModelStatus() {
|
||||
const isReady = singletonModelManager.isInitialized();
|
||||
return {
|
||||
loaded: isReady,
|
||||
ready: isReady,
|
||||
modelType: 'SingletonModelManager (Unified model instance)'
|
||||
};
|
||||
}
|
||||
}
|
||||
HybridModelManager.instance = null;
|
||||
// Export singleton instance
|
||||
export const hybridModelManager = HybridModelManager.getInstance();
|
||||
/**
|
||||
* Get the hybrid singleton embedding function - Now delegates to SingletonModelManager
|
||||
* Maintained for backward compatibility
|
||||
*/
|
||||
export async function getHybridEmbeddingFunction() {
|
||||
return await getUnifiedEmbeddingFunction();
|
||||
}
|
||||
/**
|
||||
* Hybrid embedding function - Now delegates to SingletonModelManager
|
||||
* Maintained for backward compatibility
|
||||
*/
|
||||
export const hybridEmbeddingFunction = async (data) => {
|
||||
return await singletonModelManager.embed(data);
|
||||
};
|
||||
/**
|
||||
* Preload model for tests or production - Now delegates to SingletonModelManager
|
||||
*/
|
||||
export async function preloadHybridModel() {
|
||||
console.log('🚀 Preloading model via SingletonModelManager...');
|
||||
await singletonModelManager.getModel();
|
||||
console.log('✅ Singleton model preloaded and ready!');
|
||||
}
|
||||
//# sourceMappingURL=hybridModelManager.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue