bifroest/app/templates/chat.html
2026-10-27 08:34:17 +01:00

90 lines
4.8 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}{{ chat.title }}{% endblock %}
{% block main_class %}aiw-main-wide{% endblock %}
{% block content %}
<div class="aiw-chat stack stack-lg" data-chat>
<div class="stack stack-sm">
<div class="cluster">
<h1 class="flex-1">{{ chat.title }}</h1>
{% if messages %}<a class="btn btn-ghost btn-sm" href="/chats/{{ chat.id }}/export.md" download>Exportieren</a>{% endif %}
{% if may_manage %}
<details class="aiw-chat-actions">
<summary class="btn btn-ghost btn-sm">Bearbeiten</summary>
<div class="stack stack-sm">
<form method="post" action="/chats/{{ chat.id }}/rename" class="cluster">
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
<input name="title" required maxlength="200" value="{{ chat.title }}" aria-label="Titel">
<button class="btn btn-secondary btn-sm" type="submit">Umbenennen</button>
</form>
<form method="post" action="/chats/{{ chat.id }}/delete" data-confirm="Chat mit allen Nachrichten löschen? Das lässt sich nicht rückgängig machen.">
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
<button class="btn btn-ghost btn-sm" type="submit">Chat löschen</button>
</form>
</div>
</details>
{% endif %}
</div>
<p class="text-sm text-muted">Aktive Quellen:
{% for s in sources %}<span class="badge badge-dot {{ 'badge-success' if s.status == 'ok' else 'badge-default' }}">{{ s.name }}</span> {% endfor %}
{% if mcp_servers %} · MCP: {% for s in mcp_servers %}<span class="badge badge-info">{{ s.label }}</span> {% endfor %}{% endif %}
{% if chat_usage and chat_usage[0] %} · Bisher {{ '{:,}'.format(chat_usage[0]).replace(',', '.') }} Tokens{% if chat_usage[1] is not none %}, {{ chat_usage[1]|money }}{% endif %}{% endif %}
{% if chat.summary %} · <span title="Ältere Nachrichten gehen als automatische Zusammenfassung an die KI">mit Arbeitsnotiz</span>{% endif %}
</p>
{% if chat.summary %}
<details class="text-sm"><summary class="text-muted">Arbeitsnotiz der KI (Zusammenfassung des früheren Verlaufs)</summary>
<div class="aiw-markdown">{{ chat.summary|markdown }}</div></details>
{% endif %}
</div>
{% include "_plan.html" %}
{% include "_changes.html" %}
{% if not messages and not active and examples %}
<section class="stack stack-sm" id="examples" aria-label="Beispielfragen">
<p class="text-sm text-muted">Zum Beispiel:</p>
<ul class="aiw-examples">
{% for e in examples %}
<li><form method="post" action="/chats/{{ chat.id }}/ask">
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
<input type="hidden" name="content" value="{{ e }}">
<button class="aiw-example" type="submit">{{ e }}</button>
</form></li>
{% endfor %}
</ul>
</section>
{% endif %}
<div id="messages" class="stack">
{% for m in messages %}{% with latest = loop.last %}{% include "_message.html" %}{% endwith %}{% endfor %}
{% if active %}{% with run = active %}{% include "_answer_stream.html" %}{% endwith %}{% endif %}
</div>
{% if retry %}
<form method="post" action="/chats/{{ chat.id }}/regenerate" id="messages-end" class="cluster"
{% if retry == 'Antwort neu erzeugen' %}data-confirm="Die letzte Antwort verwerfen und neu erzeugen lassen?"{% endif %}>
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
<button class="btn btn-ghost btn-sm" type="submit">{{ retry }}</button>
</form>
{% endif %}
<form class="aiw-composer stack stack-sm" hx-post="/chats/{{ chat.id }}/messages" hx-target="#messages" hx-swap="beforeend"
data-reset-on-success>
<textarea name="content" required maxlength="20000" placeholder="Frage zum Workspace stellen …{% if commands %} (/ für Befehle){% endif %}" aria-label="Nachricht" data-submit-on-enter{% if commands %} data-commands="{{ command_suggestions }}" aria-autocomplete="list" aria-controls="command-suggest"{% endif %}></textarea>
{% if commands %}<div id="command-suggest" class="aiw-command-suggest" role="listbox" aria-label="Befehle aus Hugin" hidden></div>{% endif %}
<div class="cluster">
<button class="btn btn-primary btn-sm" type="submit">Senden</button>
{% include "_plan_toggle.html" %}
<span class="text-xs text-muted aiw-composer-hint">Strg+Enter sendet. Ein Neuladen der Seite unterbricht keine Antwort.</span>
</div>
{% if commands %}
<details class="text-xs">
<summary class="text-muted">Befehle aus Hugin ({{ commands|length }})</summary>
<ul class="aiw-command-list">
{% for c in commands %}
<li><code>/{{ c.id }}{% for a in c.arguments %} &lt;{{ a }}&gt;{% endfor %}</code> – {{ c.description }}</li>
{% endfor %}
</ul>
</details>
{% endif %}
</form>
</div>
{% endblock %}