From 637b850ec55593b67566f3514f4d37edc84979d1 Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 20 Oct 2025 23:03:01 +0800 Subject: [PATCH] Add truncation indicator and update property labels in graph view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add truncate tooltip to source_id field • Add visual truncation indicator (†) • Bump API version to 0242 --- lightrag/api/__init__.py | 2 +- .../src/components/graph/PropertiesView.tsx | 22 ++++++++++++++----- lightrag_webui/src/locales/ar.json | 6 ++--- lightrag_webui/src/locales/en.json | 4 ++-- lightrag_webui/src/locales/fr.json | 4 ++-- lightrag_webui/src/locales/zh.json | 4 ++-- lightrag_webui/src/locales/zh_TW.json | 4 ++-- 7 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lightrag/api/__init__.py b/lightrag/api/__init__.py index 822818a6..e1baefb9 100644 --- a/lightrag/api/__init__.py +++ b/lightrag/api/__init__.py @@ -1 +1 @@ -__api_version__ = "0241" +__api_version__ = "0242" diff --git a/lightrag_webui/src/components/graph/PropertiesView.tsx b/lightrag_webui/src/components/graph/PropertiesView.tsx index 3ebdfd29..b46eb5b4 100644 --- a/lightrag_webui/src/components/graph/PropertiesView.tsx +++ b/lightrag_webui/src/components/graph/PropertiesView.tsx @@ -183,7 +183,8 @@ const PropertyRow = ({ entityType, sourceId, targetId, - isEditable = false + isEditable = false, + truncate }: { name: string value: any @@ -197,6 +198,7 @@ const PropertyRow = ({ sourceId?: string targetId?: string isEditable?: boolean + truncate?: string }) => { const { t } = useTranslation() @@ -216,7 +218,12 @@ const PropertyRow = ({ // Format the value to convert to newlines const formattedValue = formatValueWithSeparators(value) - const formattedTooltip = tooltip || formatValueWithSeparators(value) + let formattedTooltip = tooltip || formatValueWithSeparators(value) + + // If this is source_id field and truncate info exists, append it to the tooltip + if (name === 'source_id' && truncate) { + formattedTooltip += `\n(${truncate} truncated)` + } // Use EditablePropertyRow for editable fields (description, entity_id and keywords) if (isEditable && (name === 'description' || name === 'entity_id' || name === 'keywords')) { @@ -241,7 +248,10 @@ const PropertyRow = ({ // For non-editable fields, use the regular Text component return (
- {getPropertyNameTranslation(name)}: + + {getPropertyNameTranslation(name)} + {name === 'source_id' && truncate && } + : { {Object.keys(node.properties) .sort() .map((name) => { - if (name === 'created_at') return null; // Hide created_at property + if (name === 'created_at' || name === 'truncate') return null; // Hide created_at and truncate properties return ( { entityId={node.properties['entity_id']} entityType="node" isEditable={name === 'description' || name === 'entity_id'} + truncate={node.properties['truncate']} /> ) })} @@ -373,7 +384,7 @@ const EdgePropertiesView = ({ edge }: { edge: EdgeType }) => { {Object.keys(edge.properties) .sort() .map((name) => { - if (name === 'created_at') return null; // Hide created_at property + if (name === 'created_at' || name === 'truncate') return null; // Hide created_at and truncate properties return ( { sourceId={edge.sourceNode?.properties['entity_id'] || edge.source} targetId={edge.targetNode?.properties['entity_id'] || edge.target} isEditable={name === 'description' || name === 'keywords'} + truncate={edge.properties['truncate']} /> ) })} diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json index fb5e84bb..6f2703ca 100644 --- a/lightrag_webui/src/locales/ar.json +++ b/lightrag_webui/src/locales/ar.json @@ -318,10 +318,10 @@ "description": "الوصف", "entity_id": "الاسم", "entity_type": "النوع", - "source_id": "معرف المصدر", + "source_id": "C-ID", "Neighbour": "الجار", - "file_path": "المصدر", - "keywords": "الكلمات الرئيسية", + "file_path": "File", + "keywords": "Keyword", "weight": "الوزن" } }, diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index 3f4d04a9..418ac296 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -318,9 +318,9 @@ "description": "Description", "entity_id": "Name", "entity_type": "Type", - "source_id": "SrcID", + "source_id": "C-ID", "Neighbour": "Neigh", - "file_path": "Source", + "file_path": "File", "keywords": "Keys", "weight": "Weight" } diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json index 9104d34c..463f05eb 100644 --- a/lightrag_webui/src/locales/fr.json +++ b/lightrag_webui/src/locales/fr.json @@ -318,9 +318,9 @@ "description": "Description", "entity_id": "Nom", "entity_type": "Type", - "source_id": "ID source", + "source_id": "C-ID", "Neighbour": "Voisin", - "file_path": "Source", + "file_path": "File", "keywords": "Keys", "weight": "Poids" } diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index e6f87e18..40d8cdb0 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -318,9 +318,9 @@ "description": "描述", "entity_id": "名称", "entity_type": "类型", - "source_id": "信源ID", + "source_id": "C-ID", "Neighbour": "邻接", - "file_path": "信源", + "file_path": "文件", "keywords": "Keys", "weight": "权重" } diff --git a/lightrag_webui/src/locales/zh_TW.json b/lightrag_webui/src/locales/zh_TW.json index 003ce313..5ea179c2 100644 --- a/lightrag_webui/src/locales/zh_TW.json +++ b/lightrag_webui/src/locales/zh_TW.json @@ -318,9 +318,9 @@ "description": "描述", "entity_id": "名稱", "entity_type": "類型", - "source_id": "來源ID", + "source_id": "C-ID", "Neighbour": "鄰接", - "file_path": "來源", + "file_path": "檔案", "keywords": "Keys", "weight": "權重" }