brainy/tests/verify-model-priority-simple.js
David Snelling 52a43d51d4 refactor: simplify build system and improve model loading flexibility
- Remove Rollup bundling in favor of direct TypeScript compilation
- Move from bundled models to dynamic model loading with configurable paths
- Add Docker deployment examples and documentation
- Implement robust model loader with fallback mechanisms
- Update storage adapters for better cross-environment compatibility
- Add comprehensive tests for model loading and package installation
- Simplify package.json scripts and remove complex build configurations
- Clean up deprecated demo files and old bundling scripts

BREAKING CHANGE: Models are no longer bundled with the package. They are now loaded dynamically from CDN or custom paths.
2025-08-05 16:09:30 -07:00

46 lines
No EOL
1.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Simple test to verify model loading priority messages
*/
import { BrainyData } from '../dist/unified.js'
console.log('Testing model loading priority system...\n')
const db = new BrainyData({
forceMemoryStorage: true,
dimensions: 512,
skipEmbeddings: true // Skip embeddings to avoid model loading for this test
})
console.log('Initializing BrainyData with skipEmbeddings=true...')
await db.init()
console.log('\n✅ BrainyData initialized successfully (embeddings skipped)')
// Now test with embeddings enabled to see the warnings
console.log('\n---')
console.log('Now testing with embeddings enabled to see model loading messages...\n')
const db2 = new BrainyData({
forceMemoryStorage: true,
dimensions: 512,
skipEmbeddings: false
})
try {
await db2.init()
console.log('\n✅ Model loaded successfully')
} catch (error) {
console.log('\n❌ Model loading failed (expected in test environment without actual models)')
console.log(` Error: ${error.message.split('\n')[0]}`)
}
console.log('\n---')
console.log('Check the output above to verify:')
console.log('1. "Checking for @soulcraft/brainy-models package..." appears')
console.log('2. Warning about falling back to remote loading appears')
console.log('3. Installation suggestion for @soulcraft/brainy-models appears')
process.exit(0)