From 80668aae229d07f6404a789925ae8d2897359325 Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 21 Oct 2025 15:39:31 +0800 Subject: [PATCH] Improve file path truncation labels and UI consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Standardize FIFO/KEEP truncation labels • Update UI truncation text format --- lightrag/operate.py | 14 ++++++-------- .../src/components/graph/PropertiesView.tsx | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 60fa66a3..c3816cec 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -1650,11 +1650,12 @@ async def _merge_nodes_then_upsert( if limit_method == SOURCE_IDS_LIMIT_METHOD_FIFO: # FIFO: keep tail (newest), discard head file_paths_list = file_paths_list[-max_file_paths:] + file_paths_list.append(f"...{file_path_placeholder}...(FIFO)") else: # KEEP: keep head (earliest), discard tail file_paths_list = file_paths_list[:max_file_paths] + file_paths_list.append(f"...{file_path_placeholder}...(KEEP Old)") - file_paths_list.append(f"...{file_path_placeholder}({limit_method})...") logger.info( f"Limited `{entity_name}`: file_path {original_count_str} -> {max_file_paths} ({limit_method})" ) @@ -1676,7 +1677,7 @@ async def _merge_nodes_then_upsert( if limit_method == SOURCE_IDS_LIMIT_METHOD_FIFO: truncation_info = truncation_info_log else: - truncation_info = "Keep Old Chunks" + truncation_info = "KEEP Old" deduplicated_num = already_fragment + len(nodes_data) - num_fragment dd_message = "" @@ -1971,15 +1972,12 @@ async def _merge_edges_then_upsert( if limit_method == SOURCE_IDS_LIMIT_METHOD_FIFO: # FIFO: keep tail (newest), discard head file_paths_list = file_paths_list[-max_file_paths:] + file_paths_list.append(f"...{file_path_placeholder}...(FIFO)") else: # KEEP: keep head (earliest), discard tail file_paths_list = file_paths_list[:max_file_paths] + file_paths_list.append(f"...{file_path_placeholder}...(KEEP Old)") - # Add + sign if has_placeholder is True, indicating actual file count is higher - - file_paths_list.append( - f"...{file_path_placeholder}({limit_method}:{max_file_paths}/{original_count_str})..." - ) logger.info( f"Limited `{src_id}`~`{tgt_id}`: file_path {original_count_str} -> {max_file_paths} ({limit_method})" ) @@ -2001,7 +1999,7 @@ async def _merge_edges_then_upsert( if limit_method == SOURCE_IDS_LIMIT_METHOD_FIFO: truncation_info = truncation_info_log else: - truncation_info = "Keep Old Chunks" + truncation_info = "KEEP Old" deduplicated_num = already_fragment + len(edges_data) - num_fragment dd_message = "" diff --git a/lightrag_webui/src/components/graph/PropertiesView.tsx b/lightrag_webui/src/components/graph/PropertiesView.tsx index 39b9a448..97411f29 100644 --- a/lightrag_webui/src/components/graph/PropertiesView.tsx +++ b/lightrag_webui/src/components/graph/PropertiesView.tsx @@ -222,7 +222,7 @@ const PropertyRow = ({ // If this is source_id field and truncate info exists, append it to the tooltip if (name === 'source_id' && truncate) { - formattedTooltip += `\n(Truncation-${truncate})` + formattedTooltip += `\n(Truncated: ${truncate})` } // Use EditablePropertyRow for editable fields (description, entity_id and keywords)