From 08b24b849994de488f8ddfbc2cfa942868027af4 Mon Sep 17 00:00:00 2001 From: yakamoz221 Date: Thu, 30 Jul 2026 04:46:58 +0300 Subject: [PATCH] =?UTF-8?q?feat(memory-graph):=20Milestone=203=20polish=20?= =?UTF-8?q?=E2=80=94=20legend,=20isolate,=20keyboard=20nav?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Collapsible legend: click "Legend" to expand/collapse (caret rotates, pointer-events re-enabled now that the legend has something clickable). - "Isolate connected component" detail-panel action: a pure _componentNodeIds() BFS (undirected, no DOM dependency) feeds into _applyFilters() alongside the existing category filter, with a toggle button and a banner reporting how many memories are shown. Clears on background click and on every graph reload. - Keyboard shortcuts: `f` focuses the search box; arrow keys cycle selection through the currently visible (filter-respecting) nodes and re-center the camera. Both guarded against firing while typing or while the modal is minimized. - MODULE_SUMMARY.md: documented the memoryGraph.js module. --- static/js/MODULE_SUMMARY.md | 1 + static/js/memoryGraph.js | 128 +++++++++++++++++++++++++++++++----- static/style.css | 15 ++++- 3 files changed, 127 insertions(+), 17 deletions(-) diff --git a/static/js/MODULE_SUMMARY.md b/static/js/MODULE_SUMMARY.md index df5b0cb33..92d3b9e55 100644 --- a/static/js/MODULE_SUMMARY.md +++ b/static/js/MODULE_SUMMARY.md @@ -106,6 +106,7 @@ The largest and most central subsystem. Chat submission → backend SSE → prog | Module | Responsibility | |---|---| | **`memory.js`** | AI memory CRUD, search/filter UI, memory extraction, count badge. | +| **`memoryGraph.js`** | Memory Graph View (beta): Cytoscape.js-based interactive graph over a user's memories and their derived (similarity/session) and manual relationships. Lazily vendors `static/lib/cytoscape.min.js`, follows `calendar.js`'s self-registering modal pattern. Node click + neighborhood highlight, arrow-key node navigation, `f`-to-focus search, category/similarity filtering, collapsible legend, connected-component isolation, link-mode manual relationship editing, detail panel (pin/edit/delete/link management), demo-data fallback. Backed by `GET /api/memory/graph` + `POST`/`DELETE /api/memory/{id}/links` (`routes/memory/memory_graph_routes.py`). | | **`rag.js`** | Personal document RAG: load documents, add directories/files, show included paths. | | **`group.js`** | Group-chat UI and model orchestration. | diff --git a/static/js/memoryGraph.js b/static/js/memoryGraph.js index 211862b77..7beb1bae2 100644 --- a/static/js/memoryGraph.js +++ b/static/js/memoryGraph.js @@ -67,7 +67,8 @@ let _minSimilarity = 0.75; let _linkMode = false; let _linkSourceId = null; let _selectedId = null; -let _escHandler = null; +let _isolateRootId = null; // set = only this node's connected component is shown +let _keyHandler = null; let _resizeWired = false; // ---- lazy-load Cytoscape, mirroring documentLibrary.js's ensureXLSX/ensureMammoth ---- @@ -117,10 +118,16 @@ function _getModal() {
+
-
similarity
-
same session
-
manual link
+
+ Legend +
+
+
similarity
+
same session
+
manual link
+