mirror of
https://github.com/Anil-matcha/Open-Generative-AI.git
synced 2026-05-07 01:17:18 +00:00
Bundles three changes that were originally landed as stacked PRs into peer branches and never reached main. Combined here as a single PR targeting main. worker/index.js (new) --------------------- Long-lived Node process that: - Polls Postgres every 2s for batches in status='running'. - Claims queued jobs with SELECT ... FOR UPDATE SKIP LOCKED (single worker today, ready for N-worker scale tomorrow with no further code change). - Re-uploads local-only trainer images (/api/uploads/...) to MuAPI's /upload_file once and caches the resulting CDN URL on the trainer row so future jobs reuse it. - Submits POST /api/v1/<batch.model> with prompt, images_list, aspect_ratio, duration, quality. - Polls /api/v1/predictions/:id/result, extracts videoUrl from outputs[0]/url/output.url/video_url on success. - Backoff: min(10 * 3^retries, 300)s. After retries >= 3, status= 'failed', waiting for manual Retry from the UI. - Recovery on boot: re-queues anything left in 'submitting' from a crashed run; 'polling' jobs keep their muapiRequestId. Configuration: MUAPI_API_KEY (required to do work), MUAPI_BASE_URL (default https://api.muapi.ai), WORKER_TICK_MS (default 2000), UPLOAD_DIR (default /data/uploads). worker/package.json: { "type": "module" } so plain Node 20 runs the ESM imports. Dockerfile: copy /app/worker into the runner stage. docker-compose.override.yml: replace placeholder with the real 'npx prisma generate && node worker/index.js'. lib/promptTemplate.js (new) + worker integration ------------------------------------------------ renderPrompt({trainer, studio, job}) wraps each row's raw practice description in a fixed narrative template that pins identity, biomechanics, environment, lighting, clothing, expression, video style, and a list of forbidden behaviours (no camera movement, no cuts, no limb warping, no pose distortion, etc). duration, aspect_ratio, and quality remain SEPARATE fields in the MuAPI request body; they are never injected into the prompt text. lib/csvParser.js: stops appending 'Start position: ... Camera: ...' into the stored prompt. Just stores the raw practice description; startPosition + cameraAngle remain available as their own columns for the renderer to consume. components/SectionSwitcher.jsx (new) ------------------------------------ Two-pill switcher (Studio · Batch) rendered in the top-left of every shell. Active pill is yellow on black. Click writes the choice to localStorage so the home hub can highlight 'Last used'. StandaloneShell, BatchShell, BatchDetail headers all updated to host the switcher next to the logo. The redundant '← Studio' link in BatchShell's right-side actions is removed since the switcher replaces it. app/page.js + components/HomeHub.jsx ------------------------------------ / used to redirect to /studio. Now serves a hub with two cards: Batch (CSV-driven automation) and Studio (one-off generations). The card the user last opened gets a yellow accent + 'Last used' tag from localStorage. Stub-package copy ----------------- packages/ai-agent and packages/workflow-ui description strings and runtime 'feature unavailable' notices: removed organization-specific phrasing in favour of generic 'this fork' wording. |
||
|---|---|---|
| .. | ||
| agents | ||
| api | ||
| batch | ||
| studio/[[...slug]] | ||
| workflow/[id] | ||
| globals.css | ||
| layout.js | ||
| page.js | ||