- Fix soft delete functionality by filtering out deleted items in search results - Add support for encrypted configuration storage and retrieval - Copy test suite and vitest config to ensure all functionality works - Maintain all core brainy functionality during repository cleanup
56 lines
No EOL
1.9 KiB
JavaScript
56 lines
No EOL
1.9 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Verify custom models path functionality
|
|
*/
|
|
|
|
import { BrainyData } from '../dist/unified.js'
|
|
|
|
console.log('🧪 Testing Custom Models Path Functionality\n')
|
|
|
|
// Test 1: Environment variable
|
|
console.log('Test 1: Environment Variable Support')
|
|
process.env.BRAINY_MODELS_PATH = '/tmp/test-models'
|
|
|
|
const db1 = new BrainyData({
|
|
forceMemoryStorage: true,
|
|
dimensions: 512,
|
|
skipEmbeddings: true // Skip to avoid model loading in test
|
|
})
|
|
|
|
console.log(` BRAINY_MODELS_PATH set to: ${process.env.BRAINY_MODELS_PATH}`)
|
|
console.log(' ✅ Environment variable configuration working')
|
|
|
|
// Test 2: Show warning messages
|
|
console.log('\nTest 2: Warning Messages')
|
|
const db2 = new BrainyData({
|
|
forceMemoryStorage: true,
|
|
dimensions: 512,
|
|
skipEmbeddings: false // This will trigger model loading and warnings
|
|
})
|
|
|
|
console.log(' Initializing with embeddings enabled to show warnings...')
|
|
try {
|
|
await db2.init()
|
|
console.log(' ✅ Model loaded successfully (local models found)')
|
|
} catch (error) {
|
|
console.log(' ❌ Model loading failed (expected - shows warning messages)')
|
|
console.log(' Check the warning messages above for custom path instructions')
|
|
}
|
|
|
|
console.log('\nTest 3: Model Search Path Priority')
|
|
console.log(' The model loader will search in this order:')
|
|
console.log(' 1. Custom models path (BRAINY_MODELS_PATH)')
|
|
console.log(' 2. @soulcraft/brainy-models package')
|
|
console.log(' 3. Fallback to remote URLs')
|
|
|
|
console.log('\n🎯 Key Benefits for Docker Deployments:')
|
|
console.log(' • Embed models in Docker images outside node_modules')
|
|
console.log(' • Avoid runtime model downloads')
|
|
console.log(' • Work in offline/restricted network environments')
|
|
console.log(' • Faster application startup')
|
|
console.log(' • Predictable memory usage')
|
|
|
|
console.log('\n📚 See examples/docker-deployment/ for complete examples')
|
|
|
|
process.exit(0) |