feat(picture): add local image generation via mana-image-gen

Add LocalImageGenService that routes to the self-hosted FLUX.2 klein
model on the Mac Mini, eliminating Replicate API dependency for basic
image generation.

Changes:
- LocalImageGenService: wraps mana-image-gen HTTP API (/generate)
  with health checking, timeout handling, and GenerationResult compat
- GenerateService: routes to local or Replicate based on model config
  (replicateId starting with "local/" → LocalImageGenService)
- Local models always use sync mode (no webhooks needed, ~0.8s)
- Seed: add "FLUX.2 Klein (Lokal)" model with sortOrder -1 (shown first)
  - costPerGeneration: 0 (free, runs locally)
  - estimatedTimeSeconds: 1
- docker-compose: add IMAGE_GEN_SERVICE_URL env var for picture backend

Replicate remains available for premium models (Seedream, Nano Banana).
Local FLUX.2 klein becomes the default free option.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-24 10:38:30 +01:00
parent 0ddbad9aed
commit fc7d2942d0
5 changed files with 169 additions and 4 deletions

View file

@ -1712,6 +1712,7 @@ services:
DB_USER: postgres
MANA_CORE_AUTH_URL: http://mana-auth:3001
REPLICATE_API_TOKEN: ${REPLICATE_API_TOKEN}
IMAGE_GEN_SERVICE_URL: http://host.docker.internal:3025
APP_ID: picture-app
MANA_CORE_SERVICE_KEY: ${MANA_CORE_SERVICE_KEY}
S3_ENDPOINT: http://minio:9000