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
|
|
@ -4,7 +4,8 @@ import {
|
|||
AugmentationResponse
|
||||
} from '../types/augmentations.js'
|
||||
import {StorageAdapter, Vector} from '../coreTypes.js'
|
||||
import {MemoryStorage, FileSystemStorage, OPFSStorage} from '../storage/storageFactory.js'
|
||||
import {MemoryStorage, OPFSStorage} from '../storage/storageFactory.js'
|
||||
// FileSystemStorage will be dynamically imported when needed to avoid fs imports in browser
|
||||
import {cosineDistance} from '../utils/distance.js'
|
||||
|
||||
/**
|
||||
|
|
@ -253,9 +254,24 @@ export class MemoryStorageAugmentation extends BaseMemoryAugmentation {
|
|||
export class FileSystemStorageAugmentation extends BaseMemoryAugmentation {
|
||||
readonly description = 'Memory augmentation that stores data in the file system'
|
||||
enabled = true
|
||||
private rootDirectory: string
|
||||
|
||||
constructor(name: string, rootDirectory?: string) {
|
||||
super(name, new FileSystemStorage(rootDirectory || '.'))
|
||||
// Temporarily use MemoryStorage, will be replaced in initialize()
|
||||
super(name, new MemoryStorage())
|
||||
this.rootDirectory = rootDirectory || '.'
|
||||
}
|
||||
|
||||
async initialize(): Promise<void> {
|
||||
try {
|
||||
// Dynamically import FileSystemStorage
|
||||
const { FileSystemStorage } = await import('../storage/adapters/fileSystemStorage.js')
|
||||
this.storage = new FileSystemStorage(this.rootDirectory)
|
||||
await super.initialize()
|
||||
} catch (error) {
|
||||
console.error('Failed to load FileSystemStorage:', error)
|
||||
throw new Error(`Failed to initialize FileSystemStorage: ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
getType(): AugmentationType {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue