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

52 lines
2.9 KiB
HTML

{% extends "base.html" %}
{% block title %}Gedächtnis{% endblock %}
{% block content %}
<div class="stack stack-sm">
<h1>Gedächtnis</h1>
<p class="text-muted">Was die KI in diesem Workspace über Chats hinweg festgehalten hat{% if memory %} ({{ memory.server.label }}){% endif %}. Einträge sind für alle Mitglieder sichtbar. Löschen können nur Workspace-Admins, nie die KI; gelöschte Einträge liegen in Munin 30 Tage im Papierkorb.</p>
</div>
{% include "_flash.html" %}
{% if not memory %}
<div class="alert alert-info" role="status"><div class="alert-content"><p>Für diesen Workspace ist kein Gedächtnis-Server freigeschaltet. Ein Workspace-Admin schaltet ihn unter <a href="/workspaces/{{ workspace.id }}/settings?tab=mcp">Einstellungen → MCP-Server</a> frei, mit dem Munin-Key des Projekts.</p></div></div>
{% else %}
<section class="card"><div class="card-body stack">
<form method="get" class="cluster">
<input name="q" value="{{ q }}" placeholder="Im Gedächtnis suchen" aria-label="Suche" class="flex-1">
<button class="btn btn-secondary btn-sm" type="submit">Suchen</button>
{% if q %}<a class="btn btn-ghost btn-sm" href="/workspaces/{{ workspace.id }}/memory">Alle</a>{% endif %}
</form>
{% if entry_text %}
<div class="card"><div class="card-body stack stack-sm">
<h2 class="text-lg">Eintrag <code>{{ entry_id }}</code></h2>
<div class="aiw-markdown">{{ entry_text|markdown }}</div>
{% if membership.is_admin %}
<form method="post" action="/workspaces/{{ workspace.id }}/memory/forget" data-confirm="Eintrag {{ entry_id }} löschen?">
<input type="hidden" name="_csrf" value="{{ p.csrf }}">
<input type="hidden" name="entry_id" value="{{ entry_id }}">
<button class="btn btn-ghost btn-sm" type="submit">Eintrag löschen</button>
</form>
{% endif %}
</div></div>
{% endif %}
<h2 class="text-lg">{{ 'Treffer' if q else 'Einträge' }}</h2>
{% if items %}
{% set columns = items[0].keys()|list %}
<div class="table-wrap"><table>
<thead><tr>{% for c in columns[:5] %}<th>{{ c }}</th>{% endfor %}</tr></thead>
<tbody>
{% for it in items %}
<tr>{% for c in columns[:5] %}<td class="text-sm aiw-break">{% if c in ('id', 'entry_id', 'key') %}<a href="?entry={{ it[c]|urlencode }}{% if q %}&q={{ q|urlencode }}{% endif %}"><code>{{ it[c] }}</code></a>{% else %}{{ it[c] if it[c] is string or it[c] is number else it[c]|tojson }}{% endif %}</td>{% endfor %}</tr>
{% endfor %}
</tbody>
</table></div>
{% elif text %}
<div class="aiw-markdown">{{ text|markdown }}</div>
{% else %}<p class="text-muted">Keine Einträge.</p>{% endif %}
<form method="get" class="cluster">
<input name="entry" placeholder="Eintrags-ID" aria-label="Eintrags-ID" value="{{ entry_id }}">
{% if q %}<input type="hidden" name="q" value="{{ q }}">{% endif %}
<button class="btn btn-ghost btn-sm" type="submit">Eintrag ansehen</button>
</form>
</div></section>
{% endif %}
{% endblock %}