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:
parent
a9c5fd0eeb
commit
1096d285f5
13 changed files with 1058 additions and 15 deletions
16
dist/brainyData.js
vendored
16
dist/brainyData.js
vendored
|
|
@ -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
|
||||
|
|
|
|||
2
dist/brainyData.js.map
vendored
2
dist/brainyData.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/utils/embedding.js
vendored
4
dist/utils/embedding.js
vendored
|
|
@ -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'
|
||||
|
|
|
|||
2
dist/utils/embedding.js.map
vendored
2
dist/utils/embedding.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue