- Extract 8 common route patterns into factory functions in routes/shared.py
(favourite, upload, replace cover, save defaults, clone, save JSON,
get missing, clear covers) — removes ~1,100 lines across 9 route files
- Extract generic _sync_category() in sync.py — 7 sync functions become
one-liner wrappers, removing ~350 lines
- Extract shared detail page JS into static/js/detail-common.js — all 9
detail templates now call initDetailPage() with minimal config
- Extract layout inline JS into static/js/layout-utils.js (~185 lines)
- Extract library toolbar JS into static/js/library-toolbar.js
- Fix finalize missing-image bug: raise RuntimeError instead of logging
warning so job is marked failed
- Fix missing scheduler default in _default_checkpoint_data()
- Fix N+1 query in Character.get_available_outfits() with batch IN query
- Convert all print() to logger across services and routes
- Add missing tags display to styles, scenes, detailers, checkpoints detail
- Update delete buttons to use trash.png icon with solid red background
- Update CLAUDE.md to reflect new architecture
Net reduction: ~1,600 lines
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
REST API (routes/api.py): Three endpoints behind API key auth for
programmatic image generation via presets — list presets, queue
generation with optional overrides, and poll job status.
Shared generation logic extracted from routes/presets.py into
services/generation.py so both web UI and API use the same code path.
Fallback covers: library index pages now show a random generated image
at reduced opacity when no cover is assigned, instead of "No Image".
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add extra positive/negative prompt textareas to all 9 detail pages with session persistence
- Add Endless generation button to all detail pages (continuous preview generation until stopped)
- Default character selector to "Random Character" on all secondary detail pages
- Fix queue clear endpoint (remove spurious auth check)
- Refactor app.py into routes/ and services/ modules
- Update CLAUDE.md with new architecture documentation
- Various data file updates and cleanup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increase card density with more columns per breakpoint (2→6 across sm/xl).
Refactor style.css for consistent card sizing, spacing, and responsive layout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Implements sequential job queue with background worker thread (_enqueue_job, _queue_worker)
- All generate routes now return job_id instead of prompt_id; frontend polls /api/queue/<id>/status
- Queue management UI in navbar with live badge, job list, pause/resume/remove controls
- Fix: replaced url_for() calls inside finalize callbacks with direct string paths (url_for raises RuntimeError without request context in background threads)
- Batch cover generation now uses two-phase pattern: queue all jobs upfront, then poll concurrently via Promise.all so page navigation doesn't interrupt the process
- Strengths gallery sweep migrated to same two-phase pattern; sgStop() cancels queued jobs server-side
- LoRA weight randomisation via lora_weight_min/lora_weight_max already present in _resolve_lora_weight
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- app.py: add subprocess import; add _ensure_mcp_repo() to clone/pull
danbooru-mcp from https://git.liveaodh.com/aodhan/danbooru-mcp into
tools/danbooru-mcp/ at startup; add ensure_mcp_server_running() which
calls _ensure_mcp_repo() then starts the Docker container if not running;
add GET /api/status/comfyui and GET /api/status/mcp health endpoints;
fix call_llm() to retry up to 3 times on unexpected response format
(KeyError/IndexError), logging the raw response and prompting the LLM
to respond with valid JSON before each retry
- templates/layout.html: add ComfyUI and MCP status dot indicators to
navbar; add polling JS that checks both endpoints on load and every 30s
- static/style.css: add .service-status, .status-dot, .status-ok,
.status-error, .status-checking styles and status-pulse keyframe animation
- .gitignore: add tools/ to exclude the cloned danbooru-mcp repo