48 lines
2.8 KiB
HTML
48 lines
2.8 KiB
HTML
{% set waiting = run.status == 'waiting_approval' %}
|
|
<article class="card aiw-message-assistant" {% if waiting %}hx-get="/runs/{{ run.id }}/answer" hx-trigger="every 5s" hx-swap="outerHTML"{% endif %}>
|
|
<div class="card-body stack stack-sm">
|
|
<p class="aiw-meta"><span class="aiw-meta-who">Antwort</span></p>
|
|
{% if run.status in ('cancelled', 'failed', 'blocked_by_guardrail') %}
|
|
{% if run.status == 'cancelled' %}<p class="text-muted">Abgebrochen.</p>
|
|
{% else %}<p class="form-error">{{ run.result.get('message') or 'Die Antwort ist fehlgeschlagen. Bitte erneut versuchen.' }}</p>{% endif %}
|
|
{% if run.chat_session_id %}
|
|
<form method="post" action="/chats/{{ run.chat_session_id }}/regenerate">
|
|
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
|
|
<button class="btn btn-ghost btn-sm" type="submit">Erneut versuchen</button>
|
|
</form>
|
|
{% endif %}
|
|
{% elif waiting or run.status == 'needs_reconciliation' %}
|
|
{% set texts = (run.state or {}).get('texts', []) %}
|
|
{% if texts %}<div class="aiw-markdown">{{ texts|join('\n\n')|markdown }}</div>{% endif %}
|
|
{% if waiting %}
|
|
<div class="alert alert-info" role="status"><div class="alert-content">
|
|
<p>Wartet auf Freigabe. Die Antwort geht weiter, sobald entschieden ist; die Seite kann solange geschlossen werden.</p>
|
|
</div></div>
|
|
{% else %}
|
|
<div class="alert alert-warning" role="status"><div class="alert-content stack stack-sm">
|
|
<p>{{ run.result.get('message') or 'Abgleich mit dem Zielsystem nötig.' }}</p>
|
|
{% if is_admin %}
|
|
<div class="cluster">
|
|
<form method="post" action="/runs/{{ run.id }}/reconcile">
|
|
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
|
|
<button class="btn btn-secondary btn-sm" type="submit">Abgleichen und fortsetzen</button>
|
|
</form>
|
|
<form method="post" action="/runs/{{ run.id }}/reconcile" data-confirm="Run beenden? Das Zielsystem muss dann von Hand geprüft werden.">
|
|
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
|
|
<input type="hidden" name="give_up" value="1">
|
|
<button class="btn btn-ghost btn-sm" type="submit">Beenden</button>
|
|
</form>
|
|
</div>
|
|
<p class="text-xs text-muted">Beim Abgleich wird zuerst geprüft, ob die Aktion im Zielsystem schon angekommen ist; nichts wird doppelt ausgeführt.</p>
|
|
{% endif %}
|
|
</div></div>
|
|
{% endif %}
|
|
{% for r in requests|default([]) %}
|
|
<p class="text-sm cluster"><a href="/approvals/{{ r.id }}">{{ r.arguments.get('title') or r.tool }}</a> <span class="badge badge-default">{{ labels[r.status] }}</span></p>
|
|
{% endfor %}
|
|
{% if waiting %}<button class="btn btn-ghost btn-xs" hx-post="/runs/{{ run.id }}/cancel" hx-swap="none">Abbrechen</button>{% endif %}
|
|
{% else %}
|
|
<p class="text-muted">Status: {{ run.status }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|