From 73715168607dd182cb488ec7c274e9fd89326c2c Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 6 Apr 2025 17:07:20 +0800 Subject: [PATCH] Add node cololr by type feature to node expansion --- lightrag_webui/src/hooks/useLightragGraph.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightrag_webui/src/hooks/useLightragGraph.tsx b/lightrag_webui/src/hooks/useLightragGraph.tsx index d5b66300..930b5222 100644 --- a/lightrag_webui/src/hooks/useLightragGraph.tsx +++ b/lightrag_webui/src/hooks/useLightragGraph.tsx @@ -330,7 +330,7 @@ const useLightrangeGraph = () => { } }, [queryLabel, rawGraph, sigmaGraph]) - // Data fetching logic + // Graph data fetching logic useEffect(() => { // Skip if fetch is already in progress if (fetchInProgressRef.current) { @@ -514,7 +514,8 @@ const useLightrangeGraph = () => { for (const node of extendedGraph.nodes) { // Generate random color values seedrandom(node.id, { global: true }); - const color = randomColor(); + const nodeEntityType = node.properties?.entity_type as string | undefined; + const color = getNodeColorByType(nodeEntityType); // Create a properly typed RawNodeType processedNodes.push({