Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat: Implement debounced hover handling in WikiBrowser for improved node interaction
wizardchen3b89598c6cd9
diff --git a/frontend/src/views/knowledge/wiki/WikiBrowser.vue b/frontend/src/views/knowledge/wiki/WikiBrowser.vueindex 4be8f0e58..1b56d6ac2 100644--- a/frontend/src/views/knowledge/wiki/WikiBrowser.vue+++ b/frontend/src/views/knowledge/wiki/WikiBrowser.vue@@ -1024,6 +1024,9 @@ interface GNode {let graphNodes: GNode[] = []let graphSvg: SVGSVGElement | null = nulllet graphAnimFrame = 0+// Shared timer for debouncing node mouseleave -> mouseenter transitions.+// Prevents flickering when the pointer quickly moves between adjacent nodes.+let graphHoverLeaveTimer: ReturnType<typeof setTimeout> | null = null// Used for graph search centering interactionlet graphPanZoomRef: {@@ -1054,6 +1057,7 @@ function renderGraph() {// Stop any previous animationif (graphAnimFrame) { cancelAnimationFrame(graphAnimFrame); graphAnimFrame = 0 }+ if (graphHoverLeaveTimer) { clearTimeout(graphHoverLeaveTimer); graphHoverLeaveTimer = null }const width = container.clientWidth || 800const height = container.clientHeight || 600@@ -1247,26 +1251,36 @@ function renderGraph() {g.appendChild(text)// Hover highlight+ // We debounce the "leave" side so that quickly sliding the pointer from+ // one node to the next doesn't flash through the fully-unhighlighted state+ // (which is what caused the whole-graph flickering).g.addEventListener('mouseenter', () => {- // Don't change highlight on hover if we have a selected node+ if (graphHoverLeaveTimer) {+ clearTimeout(graphHoverLeaveTimer)+ graphHoverLeaveTimer = null+ }if (!graphSelectedSlug.value) {+ if (graphHighlightSlug.value === n.slug) returngraphHighlightSlug.value = n.slugapplyHighlight(n.slug, adjacency, nodeEls, edgeEls)} else if (graphSelectedSlug.value !== n.slug) {- // If a node is selected, hover over others should just add to highlight- // but we'll keep the selected one as the main focus+ if (graphHighlightSlug.value === n.slug) return+ graphHighlightSlug.value = n.slugapplyHighlight(graphSelectedSlug.value, adjacency, nodeEls, edgeEls, n.slug)}})g.addEventListener('mouseleave', () => {- // Only clear if we were just highlighting on hover, not selected- if (!graphSelectedSlug.value) {- graphHighlightSlug.value = null- clearHighlight(nodeEls, edgeEls)- } else {- // Restore pure selected state- applyHighlight(graphSelectedSlug.value, adjacency, nodeEls, edgeEls)- }+ if (graphHoverLeaveTimer) clearTimeout(graphHoverLeaveTimer)+ graphHoverLeaveTimer = setTimeout(() => {+ graphHoverLeaveTimer = null+ if (!graphSelectedSlug.value) {+ graphHighlightSlug.value = null+ clearHighlight(nodeEls, edgeEls)+ } else {+ graphHighlightSlug.value = null+ applyHighlight(graphSelectedSlug.value, adjacency, nodeEls, edgeEls)+ }+ }, 60)})// Click to select & open drawer directly@@ -1833,6 +1847,14 @@ onUnmounted(() => {if (statsTimer) {clearInterval(statsTimer)}+ if (graphHoverLeaveTimer) {+ clearTimeout(graphHoverLeaveTimer)+ graphHoverLeaveTimer = null+ }+ if (graphAnimFrame) {+ cancelAnimationFrame(graphAnimFrame)+ graphAnimFrame = 0+ }})</script>