fix(diagnostic): Brain-Card live + Runtime-Konfig-Text + Konversation-Reset macht beides
Drei zusammenhaengende Fixes — alle aus der OpenClaw-Umstellung uebrig.
Brain-Card im Main-Tab
- updateState() schrieb "aria-core entfernt — Brain-Loop in Arbeit" in
die Card, weil state.gateway noch den alten OpenClaw-Status-Text
transportiert hat. Brain ist online, sah aber auf der Diagnostic
aus als waere alles tot.
- Fix: updateState laesst die Brain-Card jetzt in Ruhe. Daten kommen
exklusiv von loadBrainStatus() (fetch /api/brain/health).
- WS-onopen ruft jetzt loadBrainStatus(), plus 15s-Interval fuer
Live-Refresh.
Runtime-Konfiguration
- Hinweis-Text erwaehnte noch aria.env + "Bridge-Container neu starten".
aria.env gibt's nicht mehr, und Brain liest die Config auch.
- Neu: ".env / Bridge UND Brain lesen sie beim Start — nach Aenderung
den jeweiligen Container neu starten (Reparatur-Section oben)."
Konversation-Reset
- Vorher zwei verschiedene Konversations-Stores ohne klare UI:
chat_backup.jsonl (Diagnostic-Anzeige) und conversation.jsonl
(Brain Rolling Window). "Konversation leeren" leerte nur Brain,
die UI zeigte alle Turns weiter → verwirrend.
- Neu: ein Button "🧹 Konversation komplett zurücksetzen" leert
beides parallel (Promise.all auf /api/brain/conversation/reset
+ /api/chat-history-clear) plus die lokale Chat-View.
- Erklaerungstext darunter macht klar was passiert + was bleibt
(destillierte Facts + Memories in der Vector-DB).
- Neuer Endpoint /api/chat-history-clear loescht chat_backup.jsonl
und broadcastet leere chat_history an alle Browser-Clients.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+34
-19
@@ -592,14 +592,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Runtime-Konfiguration (migriert von .env) -->
|
||||
<!-- Runtime-Konfiguration -->
|
||||
<div class="settings-section">
|
||||
<h2>Runtime-Konfiguration</h2>
|
||||
<div style="font-size:11px;color:#8888AA;margin-bottom:8px;">
|
||||
Werte werden in <code>/shared/config/runtime.json</code> persistiert und
|
||||
ueberschreiben die ENV-Variablen aus <code>aria.env</code>. Bridge liest
|
||||
sie beim naechsten Start — nach Aenderung <b>Bridge-Container neu starten</b>
|
||||
(Diagnostic-Container bleibt auf ENV).
|
||||
ueberschreiben die ENV-Variablen aus der <code>.env</code>. Bridge und Brain
|
||||
lesen sie beim Start — nach Aenderung den jeweiligen Container neu starten
|
||||
(Reparatur-Section oben).
|
||||
</div>
|
||||
<div class="card" style="max-width:600px;">
|
||||
<div style="display:grid;grid-template-columns:140px 1fr;gap:8px 10px;align-items:center;font-size:13px;">
|
||||
@@ -696,7 +696,11 @@
|
||||
<div style="display:flex;gap:6px;flex-wrap:wrap;">
|
||||
<button class="btn secondary" onclick="loadBrainStatus()" style="padding:4px 12px;font-size:11px;">Aktualisieren</button>
|
||||
<button class="btn secondary" onclick="distillNow()" style="padding:4px 12px;font-size:11px;color:#FFD60A;border-color:#FFD60A;" title="Destilliert die aeltesten Turns sofort zu fact-Memories">⚗ Jetzt destillieren</button>
|
||||
<button class="btn secondary" onclick="resetConversation()" style="padding:4px 12px;font-size:11px;color:#FF6B6B;border-color:#FF6B6B;" title="Rolling-Window leeren — destillierte Facts bleiben in der DB">🧹 Konversation leeren</button>
|
||||
<button class="btn secondary" onclick="resetConversation()" style="padding:4px 12px;font-size:11px;color:#FF6B6B;border-color:#FF6B6B;" title="Leert ARIAs Rolling-Window (Brain) + die Chat-Anzeige (chat_backup). Memories bleiben in der Vector-DB.">🧹 Konversation komplett zurücksetzen</button>
|
||||
</div>
|
||||
<div style="margin-top:6px;font-size:10px;color:#555570;line-height:1.5;">
|
||||
<strong>Konversation zurücksetzen:</strong> leert ARIAs Rolling-Window (Brain "vergisst" die letzten Turns)
|
||||
UND die Chat-Anzeige hier (<code>chat_backup.jsonl</code>). Destillierte Facts + restliche Memories bleiben.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -993,7 +997,16 @@
|
||||
ws.onopen = () => {
|
||||
addLog('info', 'browser', 'Verbunden mit Diagnostic Server');
|
||||
send({ action: 'load_chat_history' });
|
||||
// Brain-Card initial laden (sonst zeigt sie "Lade...")
|
||||
try { loadBrainStatus(); } catch {}
|
||||
};
|
||||
|
||||
// Brain-Status periodisch refreshen damit die Card live bleibt
|
||||
if (!window.__brainStatusInterval) {
|
||||
window.__brainStatusInterval = setInterval(() => {
|
||||
try { loadBrainStatus(); } catch {}
|
||||
}, 15000);
|
||||
}
|
||||
ws.onclose = () => {
|
||||
addLog('warn', 'browser', 'Verbindung zum Diagnostic Server verloren — Reconnect in 2s');
|
||||
setTimeout(connectWS, 2000);
|
||||
@@ -1471,15 +1484,8 @@
|
||||
}
|
||||
|
||||
function updateState(state) {
|
||||
// Brain-Status (loest die alte gw-* Gateway-Card ab — wenn loadBrainStatus
|
||||
// gleich danach laeuft, kriegt es die korrekten Werte; hier nur Default)
|
||||
const brainDot = document.getElementById('brain-dot');
|
||||
const brainShort = document.getElementById('brain-status-short');
|
||||
const brainErr = document.getElementById('brain-error');
|
||||
const gw = state.gateway || {};
|
||||
if (brainDot) brainDot.className = `dot ${gw.status === 'connected' ? 'connected' : 'disconnected'}`;
|
||||
if (brainShort) brainShort.textContent = gw.status === 'disabled' ? 'aria-core entfernt — Brain-Loop' : (STATUS_LABELS[gw.status] || gw.status || '-');
|
||||
if (brainErr) brainErr.textContent = gw.lastError || '';
|
||||
// Brain-Card holt ihre Daten via loadBrainStatus() (fetch /api/brain/health).
|
||||
// state.gateway ist Reststruktur aus OpenClaw-Zeit — wir ignorieren das hier.
|
||||
|
||||
// RVS
|
||||
const rvs = state.rvs || {};
|
||||
@@ -2895,14 +2901,23 @@
|
||||
}
|
||||
|
||||
async function resetConversation() {
|
||||
if (!confirm('Konversation leeren?\n\nDer Rolling-Window-Verlauf wird komplett verworfen. Destillierte Facts bleiben in der DB.')) return;
|
||||
if (!confirm('Konversation komplett zurücksetzen?\n\n• ARIAs Rolling-Window (Brain) wird geleert — sie "vergisst" die letzten Turns\n• Chat-Anzeige in der Diagnostic wird geleert\n\nDestillierte Facts + andere Memories bleiben in der Vector-DB.')) return;
|
||||
try {
|
||||
const r = await fetch('/api/brain/conversation/reset', { method: 'POST' });
|
||||
const d = await r.json();
|
||||
if (d.ok) {
|
||||
// Beides parallel — Brain Window + Diagnostic chat_backup
|
||||
const [brainR, histR] = await Promise.all([
|
||||
fetch('/api/brain/conversation/reset', { method: 'POST' }),
|
||||
fetch('/api/chat-history-clear', { method: 'POST' }),
|
||||
]);
|
||||
const brainOk = brainR.ok;
|
||||
const histOk = histR.ok;
|
||||
if (brainOk && histOk) {
|
||||
// Chat-View leeren (Server broadcasted das eh, aber sicherheitshalber)
|
||||
if (chatBox) chatBox.innerHTML = '';
|
||||
const fsBox = document.getElementById('chat-box-fs');
|
||||
if (fsBox) fsBox.innerHTML = '';
|
||||
loadBrainStatus();
|
||||
} else {
|
||||
alert('Reset fehlgeschlagen');
|
||||
alert(`Reset teilweise fehlgeschlagen — Brain: ${brainOk ? 'OK' : 'fail'}, History: ${histOk ? 'OK' : 'fail'}`);
|
||||
}
|
||||
} catch (e) {
|
||||
alert('Reset fehlgeschlagen: ' + e.message);
|
||||
|
||||
@@ -1448,6 +1448,23 @@ const server = http.createServer((req, res) => {
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else if (req.url === "/api/chat-history-clear" && req.method === "POST") {
|
||||
// Leert die Diagnostic-Anzeige-History (chat_backup.jsonl).
|
||||
// Brain's Rolling-Window (conversation.jsonl) ist davon unabhaengig —
|
||||
// der Caller sollte zusaetzlich /api/brain/conversation/reset triggern.
|
||||
log("warn", "server", "HTTP /api/chat-history-clear");
|
||||
try {
|
||||
const file = "/shared/config/chat_backup.jsonl";
|
||||
if (fs.existsSync(file)) fs.unlinkSync(file);
|
||||
// Broadcast: alle Browser-Clients sollen ihre lokale Chat-View leeren
|
||||
broadcast({ type: "chat_history", messages: [] });
|
||||
res.writeHead(200, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ ok: true }));
|
||||
} catch (err) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ ok: false, error: err.message }));
|
||||
}
|
||||
return;
|
||||
} else if (req.url === "/api/wipe-all" && req.method === "POST") {
|
||||
// Komplett-Reset — Gedaechtnis, Stimmen, Config alle weg. SSH-Keys
|
||||
// und .env bleiben, RVS-Anbindung bleibt. Brain + Qdrant werden
|
||||
|
||||
Reference in New Issue
Block a user