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
42
examples/cloud-deployments/cloudflare-workers/wrangler.toml
Normal file
42
examples/cloud-deployments/cloudflare-workers/wrangler.toml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Cloudflare Workers configuration with Brainy models
|
||||
# Note: Cloudflare Workers have different constraints than traditional containers
|
||||
|
||||
name = "brainy-cloudflare-worker"
|
||||
main = "dist/worker.js"
|
||||
compatibility_date = "2024-01-15"
|
||||
compatibility_flags = ["nodejs_compat"]
|
||||
|
||||
# Cloudflare Workers with nodejs_compat support
|
||||
node_compat = true
|
||||
|
||||
# Environment variables
|
||||
[env.production]
|
||||
name = "brainy-cloudflare-worker-prod"
|
||||
|
||||
[env.staging]
|
||||
name = "brainy-cloudflare-worker-staging"
|
||||
|
||||
# Build configuration
|
||||
[build]
|
||||
command = "npm run build:cloudflare"
|
||||
cwd = "."
|
||||
watch_dir = "src"
|
||||
|
||||
# KV namespaces for model storage (alternative approach for Cloudflare)
|
||||
[[kv_namespaces]]
|
||||
binding = "BRAINY_MODELS"
|
||||
id = "your-kv-namespace-id"
|
||||
preview_id = "your-preview-kv-namespace-id"
|
||||
|
||||
# R2 bucket for large model files
|
||||
[[r2_buckets]]
|
||||
binding = "BRAINY_MODELS_BUCKET"
|
||||
bucket_name = "brainy-models"
|
||||
|
||||
# Durable Objects for state management
|
||||
[[durable_objects.bindings]]
|
||||
name = "BRAINY_STATE"
|
||||
class_name = "BrainyState"
|
||||
|
||||
# Size limits for Cloudflare Workers
|
||||
# Note: Standard workers have 1MB limit, but we can use modules with larger limits
|
||||
Loading…
Add table
Add a link
Reference in a new issue