Initial implementation of IRC LLM bot
Full implementation from spec: ZNC/IRC client with TLS, Ollama LLM backend, per-user SQLite conversation memory, and Flask web admin portal with 7 pages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
73
portal/templates/memory.html
Normal file
73
portal/templates/memory.html
Normal file
@@ -0,0 +1,73 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Memory — IRC Bot Portal{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Conversation Memory</h1>
|
||||
|
||||
<div class="cards">
|
||||
<div class="card">
|
||||
<div class="card-label">Total Exchanges</div>
|
||||
<div class="card-value">{{ stats.total_exchanges }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-label">Database Size</div>
|
||||
<div class="card-value">{{ (stats.total_size_bytes / 1024)|round(1) }} KB</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Browse History</h2>
|
||||
<form method="get" class="inline-form">
|
||||
<select name="channel" onchange="this.form.submit()">
|
||||
<option value="">— Select channel —</option>
|
||||
{% for ch in channels %}
|
||||
<option value="{{ ch }}" {% if ch == selected_chan %}selected{% endif %}>{{ ch }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if selected_chan %}
|
||||
<select name="nick" onchange="this.form.submit()">
|
||||
<option value="">— Select nick —</option>
|
||||
{% for n in nicks %}
|
||||
<option value="{{ n }}" {% if n == selected_nick %}selected{% endif %}>{{ n }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{% if selected_chan and selected_nick and exchanges %}
|
||||
<div class="exchange-list">
|
||||
{% for ex in exchanges %}
|
||||
<div class="exchange">
|
||||
<div class="exchange-meta">{{ ex.timestamp }}</div>
|
||||
<div class="exchange-user"><strong>{{ selected_nick }}:</strong> {{ ex.user }}</div>
|
||||
<div class="exchange-bot"><strong>bot:</strong> {{ ex.assistant }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% elif selected_chan and selected_nick %}
|
||||
<p class="muted">No exchanges found.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Clear History</h2>
|
||||
<div class="actions">
|
||||
{% if selected_chan and selected_nick %}
|
||||
<form method="post" action="{{ url_for('memory_clear_user') }}">
|
||||
<input type="hidden" name="channel_dir" value="{{ selected_chan }}">
|
||||
<input type="hidden" name="nick" value="{{ selected_nick }}">
|
||||
<button class="btn btn-danger">Clear {{ selected_nick }}'s history in {{ selected_chan }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if selected_chan %}
|
||||
<form method="post" action="{{ url_for('memory_clear_channel') }}">
|
||||
<input type="hidden" name="channel_dir" value="{{ selected_chan }}">
|
||||
<button class="btn btn-danger">Clear all history in {{ selected_chan }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ url_for('memory_clear_all') }}" onsubmit="return confirm('Wipe ALL conversation history? This cannot be undone.')">
|
||||
<input type="hidden" name="confirm" value="yes">
|
||||
<button class="btn btn-danger">Clear ALL History</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user