Files
datacat/env.docker.example
9628b5f868 fix(ai): give text analysis a real multi-vendor fallback chain (#238)
llm-analysis.js and aiAnalysisService.js each constructed their own
OpenAI client, hardcoded model: 'gpt-4', and threw/skipped outright
whenever OPENAI_API_KEY was unset — a single vendor, single model, with
no recovery path. The moment OpenAI has a billing hiccup, an outage, or
retires gpt-4, every text-analysis feature in this app goes dead until
someone notices and redeploys.

backend/lib/aiChain.js gives both services a real chain via ai-kit
(Groq -> OpenRouter free tier, same package already adopted fleet-wide
for this exact failure mode), plus a health tracker exposed
informationally on /health (never gates the endpoint's status — a dead
vendor key can't be fixed by a restart).

Vision/image analysis (imageIngestionService.js, video frame analysis,
openaiVisionService.ts) and Whisper audio transcription stay on OpenAI
directly: ai-kit's free chain carries no vision- or audio-capable free
models, so forcing those onto it would silently degrade output quality
rather than provide a real fallback. Documented as a known limitation
in .claude/CLAUDE.md's env var list.


Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 09:16:38 +00:00

47 lines
1.3 KiB
Plaintext

# Docker Environment Configuration
# Copy this file to .env and fill in your values
# Database Configuration
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=formbuilder
DB_USER=formbuilder
DB_PASSWORD=your-secure-password-here
# Application Configuration
NODE_ENV=development
PORT=5001
JWT_SECRET=your-super-secret-jwt-key-change-in-production
# Database URL (for Prisma)
DATABASE_URL=postgresql://formbuilder:your-secure-password-here@postgres:5432/formbuilder
# Redis Configuration
REDIS_URL=redis://redis:6379
# AI/LLM Configuration
# Text analysis uses a Groq/OpenRouter free-tier fallback chain (ai-kit) —
# see backend/.env.example for details. OPENAI_API_KEY is still required for
# vision/image ingestion and audio transcription (Whisper), which stay
# OpenAI-only.
GROQ_API_KEY=your-groq-api-key-here
OPENROUTER_API_KEY=your-openrouter-api-key-here
OPENAI_API_KEY=your-openai-api-key-here
# Frontend Configuration
NEXT_PUBLIC_API_URL=http://localhost:5001
NEXT_PUBLIC_BRAND_PRESET=generic
# Optional: Email Configuration (for production)
# SMTP_HOST=smtp.gmail.com
# SMTP_PORT=587
# SMTP_USER=your-email@gmail.com
# SMTP_PASS=your-app-password
# Optional: File Upload Configuration
# UPLOAD_MAX_SIZE=10485760
# UPLOAD_ALLOWED_TYPES=image/jpeg,image/png,application/pdf
# Optional: Rate Limiting
# RATE_LIMIT_WINDOW_MS=900000
# RATE_LIMIT_MAX_REQUESTS=100