This app now supports an async animation flow in the Animation tab:
- User prompt goes to
POST /api/chatwithmode: "animation". - Claude generates Python Manim code.
- The app creates a render job in Blob (
manim-jobs/...json). - The app enqueues your Render worker.
- Worker renders video and calls
POST /api/animation/callback. - Callback stores video in Blob (
manim-renders/<jobId>.mp4) and marks the job completed. - Frontend polls
GET /api/animation/jobs/[id]and displays the video.
Add these to .env.local:
ANTHROPIC_API_KEY=...
BLOB_READ_WRITE_TOKEN=...
RENDER_WORKER_URL=https://your-render-worker.onrender.com
RENDER_WORKER_SECRET=your-shared-secret
RENDER_CALLBACK_SECRET=your-callback-secret
# optional if callback origin differs from request origin
# RENDER_CALLBACK_URL=https://your-app-domain.com/api/animation/callbackWorker code is in worker/render_worker.py.
Expected deployment env var for worker:
RENDER_WORKER_SECRET=your-shared-secretDeploy on Render with:
- Runtime: Python
- Build command:
pip install -r worker/requirements.txt - Start command:
python worker/render_worker.py
npm run dev