feat(ui): show auto image ranking reasons in article detail

This commit is contained in:
Oliver 2026-02-18 10:43:17 +01:00
parent 26e3d26b93
commit dcdf4d954a
2 changed files with 24 additions and 0 deletions

View file

@ -335,6 +335,7 @@ def admin_article_detail(request: Request, article_id: int):
if not article.get("press_contact") and isinstance(extraction.get("press_contact"), str):
article["press_contact"] = extraction.get("press_contact")
article["extraction"] = extraction
article["image_selection"] = extraction.get("image_selection") if isinstance(extraction.get("image_selection"), dict) else {}
article["image_entries"] = _build_image_entries(article, extraction, meta)
image_review = meta.get("image_review") if isinstance(meta.get("image_review"), dict) else {}
article["selected_image_url"] = image_review.get("selected_url") if isinstance(image_review.get("selected_url"), str) else None

View file

@ -75,6 +75,29 @@
{% endif %}
{% endif %}
{% if article.image_entries %}
{% if article.image_selection %}
<details>
<summary>Automatische Bildauswahl (Score + Gründe)</summary>
<div class="subtle">Primärbild (Auto): {{ article.image_selection.primary or "-" }}</div>
<div class="subtle">Ausgewählt: {{ article.image_selection.selected_count or 0 }} / Kandidaten: {{ article.image_selection.total_candidates or 0 }}</div>
{% if article.image_selection.ranked %}
<table>
<thead>
<tr><th>Bild</th><th>Score</th><th>Gründe</th></tr>
</thead>
<tbody>
{% for r in article.image_selection.ranked %}
<tr>
<td><a href="{{ r.url }}" target="_blank" rel="noopener">{{ r.url }}</a></td>
<td>{{ r.score }}</td>
<td>{{ r.reasons|join(", ") if r.reasons else "-" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</details>
{% endif %}
<div class="image-grid">
{% for image in article.image_entries %}
<article class="image-card {{ 'image-selected' if image.is_selected else '' }} {{ 'image-excluded' if image.is_excluded else '' }}">