From f6e901bad86bbb0186e391ba64fe976760ca31f4 Mon Sep 17 00:00:00 2001 From: Frank Schwenk Date: Fri, 12 Jun 2026 17:28:55 +0200 Subject: [PATCH] feat: verwendete Prompts im Archiv ausklappbar anzeigen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Speichert OpenRouter- und SDXL-Prompts pro Archiv-Eintrag und zeigt sie auf der Übersichtsseite in aufklappbaren Details an. Co-authored-by: Cursor --- generator/generate.py | 8 ++ generator/templates/archiv.html.j2 | 150 +++++++++++++++++++++++++---- 2 files changed, 139 insertions(+), 19 deletions(-) diff --git a/generator/generate.py b/generator/generate.py index ca947be..4bc306d 100644 --- a/generator/generate.py +++ b/generator/generate.py @@ -255,6 +255,7 @@ def render_template(name: str, context: dict) -> str: def build_archiv_entries(archive: list[dict]) -> list[dict]: entries = [] for item in sorted(archive, key=lambda e: e["date"], reverse=True): + prompts = item.get("prompts") entries.append( { "date": item["date"], @@ -264,6 +265,7 @@ def build_archiv_entries(archive: list[dict]) -> list[dict]: "url": f"/archiv/{item['date']}.html", "image": f"/img/{item['date']}.jpg" if item.get("has_image") else None, "topics": item.get("topics", []), + "prompts": prompts if isinstance(prompts, dict) else None, } ) return entries @@ -343,6 +345,12 @@ def main() -> int: "theme": theme, "topics": [topic["name"] for topic in selected_topics], "has_image": hero_image is not None, + "prompts": { + "content_system": build_system_prompt(), + "content_user": build_user_prompt(selected_topics), + "image_prompt": llm_json["image_prompt"], + "image_negative_prompt": llm_json["image_negative_prompt"], + }, } archive = [entry for entry in archive if entry.get("date") != date_iso] archive.append(archive_entry) diff --git a/generator/templates/archiv.html.j2 b/generator/templates/archiv.html.j2 index b4bf949..b70ef9a 100644 --- a/generator/templates/archiv.html.j2 +++ b/generator/templates/archiv.html.j2 @@ -114,12 +114,19 @@ transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; } - .entry-card:hover { + .entry-card:has(.entry-link:hover) { border-color: #4a4a60; transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35); } + .entry-link { + display: flex; + flex-direction: column; + flex: 1; + color: inherit; + } + .entry-thumb { aspect-ratio: 16 / 9; overflow: hidden; @@ -177,6 +184,80 @@ border: 1px solid #3a3a50; } + .entry-prompts { + border-top: 1px solid #2a2a38; + font-size: 0.8rem; + } + + .entry-prompts > summary { + padding: 0.75rem 1.25rem; + cursor: pointer; + color: #8888a0; + font-weight: 600; + list-style: none; + user-select: none; + transition: color 0.2s, background 0.2s; + } + + .entry-prompts > summary::-webkit-details-marker { display: none; } + + .entry-prompts > summary::before { + content: "▸ "; + display: inline-block; + transition: transform 0.2s; + } + + .entry-prompts[open] > summary::before { + transform: rotate(90deg); + } + + .entry-prompts > summary:hover { + color: #c8c8d8; + background: #222230; + } + + .prompt-panel { + padding: 0 1.25rem 1.25rem; + display: flex; + flex-direction: column; + gap: 1rem; + } + + .prompt-block h3 { + font-size: 0.7rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.06em; + color: #686880; + margin-bottom: 0.4rem; + } + + .prompt-text { + font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace; + font-size: 0.72rem; + line-height: 1.5; + color: #b8b8cc; + background: #111118; + border: 1px solid #2a2a38; + border-radius: 8px; + padding: 0.75rem; + white-space: pre-wrap; + word-break: break-word; + max-height: 14rem; + overflow-y: auto; + } + + .prompt-label { + font-size: 0.65rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: #585870; + margin: 0.6rem 0 0.25rem; + } + + .prompt-label:first-child { margin-top: 0; } + /* Footer */ .footer { border-top: 1px solid #2a2a38; @@ -229,25 +310,56 @@ {% if entries %}
{% for entry in entries %} - -
- {% if entry.image %} - {{ entry.backronym }} - {% endif %} -
-
- -

{{ entry.backronym }}

- - {% if entry.topics %} -
- {% for topic in entry.topics %} - {{ topic }} - {% endfor %} +
- +
+ +

{{ entry.backronym }}

+ + {% if entry.topics %} +
+ {% for topic in entry.topics %} + {{ topic }} + {% endfor %} +
+ {% endif %} +
+ + {% if entry.prompts %} +
+ Prompts anzeigen +
+
+

Seiteninhalt (OpenRouter)

+ {% if entry.prompts.content_system %} +

System

+
{{ entry.prompts.content_system }}
+ {% endif %} + {% if entry.prompts.content_user %} +

User

+
{{ entry.prompts.content_user }}
+ {% endif %} +
+
+

Bildgenerierung (SDXL)

+ {% if entry.prompts.image_prompt %} +

Prompt

+
{{ entry.prompts.image_prompt }}
+ {% endif %} + {% if entry.prompts.image_negative_prompt %} +

Negative Prompt

+
{{ entry.prompts.image_negative_prompt }}
+ {% endif %} +
+
+
+ {% endif %} + {% endfor %}
{% else %}