Image generation: - Automatic model fallback: try gpt-image-1 first, fall back to dall-e-3 if it fails (e.g. org not verified on OpenAI) - Local filesystem fallback: if MinIO upload fails, write the image to backend/uploads/recipes/ and return a URL served by fastify-static - Unified handling of base64 vs URL responses from the Images API - DALL-E quality mapped automatically (low/medium/high -> standard) Local MinIO stack: - docker-compose.yml at repo root with minio + minio-init service that auto-creates the bucket and makes it publicly readable - Default credentials: freedge / freedge123 (configurable) - Console at :9001, API at :9000 - .env.example now points to the local stack by default Static file serving: - Register @fastify/static to serve ./uploads at /uploads/* - Enables local fallback to return usable URLs to the frontend - New PUBLIC_BASE_URL env var to build absolute URLs TypeScript errors (21 -> 0): - JWT typing via '@fastify/jwt' module augmentation (FastifyJWT interface with payload + user) fixes all request.user.id errors - Stripe constructor now passes required StripeConfig - fastify.createCustomer guards checked on the helper itself for proper TS narrowing (not on fastify.stripe) - Remove 'done' arg from async onClose hook - MinIO transport.agent + listFiles return type cast ignored README: - Add 'Stockage des fichiers' section explaining the two modes - Updated setup instructions to start with docker compose up Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
# ---- Requis ----
|
|
DATABASE_URL="file:./prisma/dev.db"
|
|
JWT_SECRET="change-me-please-use-at-least-32-characters"
|
|
OPENAI_API_KEY="sk-..."
|
|
|
|
|
|
# ---- Serveur ----
|
|
PORT=3000
|
|
LOG_LEVEL=info
|
|
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
|
|
FRONTEND_URL=http://localhost:5173
|
|
# Base URL publique du backend (utilisée pour les URLs de fichiers servis localement)
|
|
PUBLIC_BASE_URL=http://localhost:3000
|
|
|
|
# ---- IA ----
|
|
# Modèle texte (recette). Recommandé : gpt-4o-mini (rapide & cheap),
|
|
# ou gpt-4o pour un cran de qualité supplémentaire.
|
|
OPENAI_TEXT_MODEL=gpt-4o-mini
|
|
|
|
# Modèle de transcription audio.
|
|
# - gpt-4o-mini-transcribe : -50% par rapport à whisper-1, meilleur en français
|
|
# - whisper-1 : ancien, à éviter sauf compat
|
|
OPENAI_TRANSCRIBE_MODEL=gpt-4o-mini-transcribe
|
|
|
|
# Génération d'image
|
|
ENABLE_IMAGE_GENERATION=true
|
|
# Modèle principal : gpt-image-1 (meilleure qualité photographique)
|
|
# NOTE : gpt-image-1 requiert une vérification d'organisation sur OpenAI.
|
|
# Si ton org n'est pas vérifiée, mets dall-e-3 en principal.
|
|
OPENAI_IMAGE_MODEL=gpt-image-1
|
|
# Modèle de fallback automatique si le principal échoue (ex: org non vérifiée)
|
|
OPENAI_IMAGE_FALLBACK_MODEL=dall-e-3
|
|
# Pour gpt-image-1: low | medium | high
|
|
# Pour dall-e-3: standard | hd (mappé automatiquement)
|
|
OPENAI_IMAGE_QUALITY=medium
|
|
OPENAI_IMAGE_SIZE=1024x1024
|
|
|
|
# Robustesse OpenAI
|
|
OPENAI_MAX_RETRIES=3
|
|
OPENAI_TIMEOUT_MS=60000
|
|
|
|
# ---- Stripe (optionnel) ----
|
|
STRIPE_SECRET_KEY=
|
|
|
|
# ---- MinIO (démarré avec `docker-compose up -d` depuis la racine du projet) ----
|
|
# Laisse vide pour désactiver et utiliser uniquement le stockage local ./uploads
|
|
MINIO_ENDPOINT=localhost
|
|
MINIO_PORT=9000
|
|
MINIO_USE_SSL=false
|
|
MINIO_ACCESS_KEY=freedge
|
|
MINIO_SECRET_KEY=freedge123
|
|
MINIO_BUCKET=freedge
|
|
MINIO_ALLOW_SELF_SIGNED=false
|
|
|
|
# ---- Email (optionnel) ----
|
|
RESEND_API_KEY=
|