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.
This commit is contained in:
parent
89413ebec2
commit
52a43d51d4
51 changed files with 4835 additions and 8007 deletions
37
tests/verify-model-loading.js
Normal file
37
tests/verify-model-loading.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Simple script to verify model loading behavior
|
||||
* Run with: node tests/verify-model-loading.js
|
||||
*/
|
||||
|
||||
import { BrainyData } from '../dist/unified.js'
|
||||
|
||||
console.log('Testing Brainy model loading behavior...\n')
|
||||
|
||||
const db = new BrainyData({
|
||||
forceMemoryStorage: true,
|
||||
dimensions: 512
|
||||
})
|
||||
|
||||
console.log('Initializing BrainyData...')
|
||||
await db.init()
|
||||
|
||||
console.log('\nAttempting to embed text...')
|
||||
const text = 'This is a test sentence for embedding'
|
||||
const id = await db.add({ content: text })
|
||||
|
||||
console.log(`\n✅ Successfully added text with ID: ${id}`)
|
||||
|
||||
// Test search
|
||||
const results = await db.search('test sentence', 1)
|
||||
console.log(`\n✅ Search returned ${results.length} result(s)`)
|
||||
|
||||
console.log('\n---')
|
||||
console.log('Model loading test complete!')
|
||||
console.log('\nNOTE: Check the console output above to see:')
|
||||
console.log('1. If @soulcraft/brainy-models was found and used (best performance)')
|
||||
console.log('2. If fallback to URL loading occurred (with warning)')
|
||||
console.log('3. Verification that the correct model was loaded')
|
||||
|
||||
process.exit(0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue