From 648a024af28a40940247ffcf3149da6eb87ec811 Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 8 Apr 2025 13:38:06 +0800 Subject: [PATCH] Add node types --- .../src/components/graph/Legend.tsx | 4 +++- lightrag_webui/src/hooks/useLightragGraph.tsx | 21 ++++++++++++------- lightrag_webui/src/locales/ar.json | 3 ++- lightrag_webui/src/locales/fr.json | 1 + lightrag_webui/src/locales/zh.json | 1 + 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lightrag_webui/src/components/graph/Legend.tsx b/lightrag_webui/src/components/graph/Legend.tsx index daca9c76..6e02a4fe 100644 --- a/lightrag_webui/src/components/graph/Legend.tsx +++ b/lightrag_webui/src/components/graph/Legend.tsx @@ -16,7 +16,9 @@ const PREDEFINED_TYPES = [ 'weapon', 'animal', 'unknown', - 'technology' + 'object', + 'group', + 'technology', ] interface LegendProps { diff --git a/lightrag_webui/src/hooks/useLightragGraph.tsx b/lightrag_webui/src/hooks/useLightragGraph.tsx index 3a1bbfb3..cb497d62 100644 --- a/lightrag_webui/src/hooks/useLightragGraph.tsx +++ b/lightrag_webui/src/hooks/useLightragGraph.tsx @@ -74,7 +74,12 @@ const TYPE_SYNONYMS: Record = { 'object': 'object', '物品': 'object', 'stuff': 'object', - '物体': 'object' + '物体': 'object', + + 'group': 'group', + '群组': 'group', + 'community': 'group', + '社区': 'group' }; // 节点类型到颜色的映射 @@ -91,21 +96,21 @@ const NODE_TYPE_COLORS: Record = { 'equipment': '#2F4F4F', // DarkSlateGray 'weapon': '#4421af', // DeepPurple 'object': '#00cc00', // Green + 'group': '#0f558a', // NavyBlue }; // Extended colors pool - Used for unknown node types const EXTENDED_COLORS = [ - '#cd071e', // ChinaRed - '#0000ff', // Blue - '#9b3a31', // DarkBrown - '#0f558a', // NavyBlue '#5a2c6d', // DeepViolet - '#003366', // DarkBlue + '#0000ff', // Blue + '#cd071e', // ChinaRed '#00CED1', // DarkTurquoise - '#DEB887', // BurlyWood - '#bd7ebe', // LightViolet + '#9b3a31', // DarkBrown '#b2e061', // YellowGreen + '#bd7ebe', // LightViolet '#6ef7b3', // LightGreen + '#003366', // DarkBlue + '#DEB887', // BurlyWood ]; // Select color based on node type diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json index ccaf3fca..36f31e92 100644 --- a/lightrag_webui/src/locales/ar.json +++ b/lightrag_webui/src/locales/ar.json @@ -155,7 +155,8 @@ "weapon": "سلاح", "animal": "حيوان", "unknown": "غير معروف", - "object": "مادة", + "object": "مصنوع", + "group": "مجموعة", "technology": "العلوم" }, "sideBar": { diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json index b1d32949..dbba9480 100644 --- a/lightrag_webui/src/locales/fr.json +++ b/lightrag_webui/src/locales/fr.json @@ -156,6 +156,7 @@ "animal": "Animal", "unknown": "Inconnu", "object": "Objet", + "group": "Groupe", "technology": "Technologie" }, "sideBar": { diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index 9fd227b0..1e550b83 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -156,6 +156,7 @@ "animal": "动物", "unknown": "未知", "object": "物品", + "group": "群组", "technology": "技术" }, "sideBar": {