Add REST API for preset-based generation and fallback cover images
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>
This commit is contained in:
@@ -29,9 +29,15 @@
|
||||
<img id="img-{{ outfit.slug }}" src="{{ url_for('static', filename='uploads/' + outfit.image_path) }}" alt="{{ outfit.name }}">
|
||||
<span id="no-img-{{ outfit.slug }}" class="text-muted d-none">No Image</span>
|
||||
{% else %}
|
||||
{% set fallback = random_gen_image('outfits', outfit.slug) %}
|
||||
{% if fallback %}
|
||||
<img id="img-{{ outfit.slug }}" src="{{ url_for('static', filename='uploads/' + fallback) }}" alt="{{ outfit.name }}" class="fallback-cover">
|
||||
<span id="no-img-{{ outfit.slug }}" class="text-muted d-none">No Image</span>
|
||||
{% else %}
|
||||
<img id="img-{{ outfit.slug }}" src="" alt="{{ outfit.name }}" class="d-none">
|
||||
<span id="no-img-{{ outfit.slug }}" class="text-muted">No Image</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if outfit.data.lora and outfit.data.lora.lora_name and lora_assignments.get(outfit.data.lora.lora_name, 0) > 0 %}
|
||||
<span class="assignment-badge" title="Assigned to {{ lora_assignments.get(outfit.data.lora.lora_name, 0) }} character(s)">{{ lora_assignments.get(outfit.data.lora.lora_name, 0) }}</span>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user