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

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'