From 7be4b683d763b0b5b3cf39aa0b0e2bb30c774be9 Mon Sep 17 00:00:00 2001 From: Finessse Date: Sat, 20 Dec 2025 15:49:04 +0700 Subject: [PATCH] webui: add memory export-all and semantic toggle --- webui/src/App.tsx | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/webui/src/App.tsx b/webui/src/App.tsx index 2debff70..77ed5fca 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -91,6 +91,7 @@ export default function App() { const [memoryPinned, setMemoryPinned] = useState(''); const [memorySummary, setMemorySummary] = useState(''); const [memoryImportReplace, setMemoryImportReplace] = useState(false); + const [memorySemanticEnabled, setMemorySemanticEnabled] = useState(true); const [memoryPrune, setMemoryPrune] = useState({ maxAgeDays: 30, maxSessions: 200, @@ -360,6 +361,7 @@ export default function App() { setMemorySummary(session.summary || ''); setMemoryPinned(session.pinned || ''); setMemoryTodo(session.todo || ''); + setMemorySemanticEnabled(!session.semantic_disabled); } }; @@ -436,6 +438,18 @@ export default function App() { showToast('Saved anchor summary', 'success'); }; + const toggleMemorySemantic = async (enabled: boolean) => { + if (!memorySession) return; + await mgmtFetch('/v0/management/memory/semantic', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ session: memorySession, enabled }), + }); + setMemorySemanticEnabled(enabled); + await loadMemorySessionDetails(); + showToast(`Semantic ${enabled ? 'enabled' : 'disabled'}`, 'success'); + }; + const deleteMemorySession = async () => { if (!memorySession) return; await mgmtFetch(`/v0/management/memory/session?session=${encodeURIComponent(memorySession)}`, { @@ -467,6 +481,36 @@ export default function App() { URL.revokeObjectURL(url); }; + const exportAllMemory = async () => { + if (!mgmtKey) return; + const res = await fetch('/v0/management/memory/export-all', { + headers: { 'X-Management-Key': mgmtKey }, + }); + if (!res.ok) { + const msg = await res.text(); + throw new Error(msg); + } + const blob = await res.blob(); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = 'proxypilot-memory-all.zip'; + a.click(); + URL.revokeObjectURL(url); + }; + + const deleteAllMemory = async () => { + if (!mgmtKey) return; + if (!window.confirm('Delete all memory data? This cannot be undone.')) return; + await mgmtFetch('/v0/management/memory/delete-all?confirm=true', { method: 'POST' }); + setMemorySession(''); + setMemoryDetails(null); + setMemoryEvents(''); + setMemoryAnchors(''); + await loadMemorySessions(); + showToast('Deleted all memory', 'success'); + }; + const importMemorySession = async (file: File | null) => { if (!file || !memorySession || !mgmtKey) return; const form = new FormData(); @@ -1021,9 +1065,15 @@ export default function App() { + +
@@ -1058,6 +1108,15 @@ export default function App() { {memoryDetails?.updated_at ? `Updated ${memoryDetails.updated_at}` : 'No session loaded.'} +
@@ -1215,6 +1274,15 @@ export default function App() { {semanticHealth?.model} {semanticHealth?.version ? `v${semanticHealth.version}` : ''} + + {semanticHealth?.model_present === false ? 'model missing' : ''} + +
+
+ {semanticHealth?.latency_ms ? `latency ${semanticHealth.latency_ms}ms` : 'latency n/a'} + {semanticHealth?.queue + ? ` ยท queue q${semanticHealth.queue.queued} d${semanticHealth.queue.dropped} p${semanticHealth.queue.processed} f${semanticHealth.queue.failed}` + : ''}