From a9432652573f63077ceb1abbe8d901f765bac6ac Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 26 Jul 2025 10:21:32 +0800 Subject: [PATCH] fix: preserve file path order in build_file_path function --- lightrag/operate.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 94d6b07c..78e11c22 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -3136,10 +3136,8 @@ def build_file_path(already_file_paths, data_list, target): # set: deduplication file_paths_set = {fp for fp in already_file_paths if fp} - # string: deduplication sorted - file_paths = GRAPH_FIELD_SEP.join( - list(dict.fromkeys(fp for fp in already_file_paths if fp)) - ) + # string: filter empty value and keep file order in already_file_paths + file_paths = GRAPH_FIELD_SEP.join(fp for fp in already_file_paths if fp) # ignored file_paths file_paths_ignore = "" # add file_paths