Files
bookapp/docker-compose.yml
Mike Wichers 2a9a605800 v1.2.0: Prefer Gemini 2.x models, improve cover generation and Docker health
Model selection (ai.py):
- get_optimal_model() now scores Gemini 2.5 > 2.0 > 1.5 when ranking candidates
- get_default_models() fallbacks updated to gemini-2.0-pro-exp (logic) and gemini-2.0-flash (writer/artist)
- AI selection prompt rewritten: includes Gemini 2.x pricing context, guidance to avoid 'thinking' models for writer/artist roles, and instructions to prefer 2.x over 1.5
- Added image_model_name and image_model_source globals for UI visibility
- init_models() now reads MODEL_IMAGE_HINT; tries imagen-3.0-generate-001 then imagen-3.0-fast-generate-001 on both Gemini API and Vertex AI paths

Cover generation (marketing.py):
- Fixed display bug: "Attempt X/5" now correctly reads "Attempt X/3"
- Added imagen-3.0-fast-generate-001 as intermediate fallback before legacy Imagen 2
- Quality threshold: images with score < 5 are only kept if nothing better exists
- Smarter prompt refinement on retry: deformity, blur, and watermark critique keywords each append targeted corrections to the art prompt
- Fixed missing sys import (sys.platform check for macOS was silently broken)

Config / Docker:
- config.py: added MODEL_IMAGE_HINT env var, bumped version to 1.2.0
- docker-compose.yml: added MODEL_IMAGE environment variable
- Dockerfile: added libpng-dev and libfreetype6-dev for better font/PNG rendering; added HEALTHCHECK so Portainer detects unhealthy containers

System status UI:
- system_status.html: added Image row showing active Imagen model and provider (Gemini API / Vertex AI)
- Added cache expiry countdown with colour-coded badges

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 10:31:02 -05:00

40 lines
1.6 KiB
YAML

version: '3.8'
services:
bookapp:
build: .
container_name: bookapp
restart: unless-stopped
ports:
- "5000:5000"
working_dir: /app
volumes:
# --- PERSISTENCE (Data & Login) ---
# These mounts ensure your projects and login tokens survive container resets
# HOST_PATH is defined in Portainer Environment Variables (e.g. /opt/bookapp)
- ${HOST_PATH:-.}/data:/app/data
- ${HOST_PATH:-.}/token.json:/app/token.json
- ${HOST_PATH:-.}/credentials.json:/app/credentials.json
# --- DEVELOPMENT (Code Sync) ---
# UNCOMMENT these lines only if you are developing and want to see changes instantly.
# For production/deployment, keep them commented out so the container uses the built image code.
# - ./modules:/app/modules
# - ./templates:/app/templates
# - ./main.py:/app/main.py
# - ./wizard.py:/app/wizard.py
# - ./config.py:/app/config.py
environment:
- PYTHONUNBUFFERED=1
- GOOGLE_APPLICATION_CREDENTIALS=/app/credentials.json
- PYTHONPATH=/app
- FLASK_SECRET_KEY=${FLASK_SECRET_KEY:-change_this_to_a_random_string}
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-change_me_in_portainer}
- FLASK_DEBUG=${FLASK_DEBUG:-False}
- GEMINI_API_KEY=${GEMINI_API_KEY}
- GCP_PROJECT=${GCP_PROJECT:-}
- GCP_LOCATION=${GCP_LOCATION:-us-central1}
- MODEL_LOGIC=${MODEL_LOGIC:-AUTO}
- MODEL_WRITER=${MODEL_WRITER:-AUTO}
- MODEL_ARTIST=${MODEL_ARTIST:-AUTO}
- MODEL_IMAGE=${MODEL_IMAGE:-AUTO}