feat: Add Google Cloud Storage CDN for models.soulcraft.com

- Primary source: models.soulcraft.com on GCS
- Backup: GitHub releases
- Fallback: Hugging Face
- Immutable with SHA256 verification
This commit is contained in:
David Snelling 2025-08-18 18:58:26 -07:00
parent a9c5fd0eeb
commit 1096d285f5
13 changed files with 1058 additions and 15 deletions

16
dist/brainyData.js vendored
View file

@ -656,6 +656,22 @@ export class BrainyData {
return;
}
this.isInitializing = true;
// CRITICAL: Ensure model is available before ANY operations
// This is THE most critical part of the system
// Without the model, users CANNOT access their data
if (typeof this.embeddingFunction === 'function') {
try {
const { modelGuardian } = await import('./critical/model-guardian.js');
await modelGuardian.ensureCriticalModel();
}
catch (error) {
console.error('🚨 CRITICAL: Model verification failed!');
console.error('Brainy cannot function without the transformer model.');
console.error('Users cannot access their data without it.');
this.isInitializing = false;
throw error;
}
}
try {
// Pre-load the embedding model early to ensure it's always available
// This helps prevent issues with the Universal Sentence Encoder not being loaded

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
* Complete rewrite to eliminate TensorFlow.js and use ONNX-based models
*/
import { isBrowser } from './environment.js';
import { ModelManager } from '../embeddings/model-manager.js';
// @ts-ignore - Transformers.js is now the primary embedding library
import { pipeline, env } from '@huggingface/transformers';
/**
@ -192,6 +193,9 @@ export class TransformerEmbedding {
}
// Always use real implementation - no mocking
try {
// Ensure models are available (downloads if needed)
const modelManager = ModelManager.getInstance();
await modelManager.ensureModels(this.options.model);
// Resolve device configuration and cache directory
const device = await resolveDevice(this.options.device);
const cacheDir = this.options.cacheDir === './models'

File diff suppressed because one or more lines are too long