Daniel.y commited on
Commit
40be71d
·
unverified ·
2 Parent(s): 08a47ce fe0b8e3

Merge pull request #1796 from danielaskdd/fix-filepath-join

Browse files
Files changed (1) hide show
  1. lightrag/operate.py +10 -3
lightrag/operate.py CHANGED
@@ -871,7 +871,7 @@ async def _rebuild_single_relationship(
871
  "keywords": combined_keywords,
872
  "weight": weight,
873
  "source_id": GRAPH_FIELD_SEP.join(chunk_ids),
874
- "file_path": GRAPH_FIELD_SEP.join(file_paths)
875
  if file_paths
876
  else current_relationship.get("file_path", "unknown_source"),
877
  }
@@ -947,7 +947,14 @@ async def _merge_nodes_then_upsert(
947
  set([dp["source_id"] for dp in nodes_data] + already_source_ids)
948
  )
949
  file_path = GRAPH_FIELD_SEP.join(
950
- set([dp["file_path"] for dp in nodes_data] + already_file_paths)
 
 
 
 
 
 
 
951
  )
952
 
953
  force_llm_summary_on_merge = global_config["force_llm_summary_on_merge"]
@@ -1082,7 +1089,7 @@ async def _merge_edges_then_upsert(
1082
  file_path = GRAPH_FIELD_SEP.join(
1083
  set(
1084
  [dp["file_path"] for dp in edges_data if dp.get("file_path")]
1085
- + already_file_paths
1086
  )
1087
  )
1088
 
 
871
  "keywords": combined_keywords,
872
  "weight": weight,
873
  "source_id": GRAPH_FIELD_SEP.join(chunk_ids),
874
+ "file_path": GRAPH_FIELD_SEP.join([fp for fp in file_paths if fp])
875
  if file_paths
876
  else current_relationship.get("file_path", "unknown_source"),
877
  }
 
947
  set([dp["source_id"] for dp in nodes_data] + already_source_ids)
948
  )
949
  file_path = GRAPH_FIELD_SEP.join(
950
+ set(
951
+ [
952
+ dp.get("file_path", "unknown_source")
953
+ for dp in nodes_data
954
+ if dp.get("file_path")
955
+ ]
956
+ + [fp for fp in already_file_paths if fp]
957
+ )
958
  )
959
 
960
  force_llm_summary_on_merge = global_config["force_llm_summary_on_merge"]
 
1089
  file_path = GRAPH_FIELD_SEP.join(
1090
  set(
1091
  [dp["file_path"] for dp in edges_data if dp.get("file_path")]
1092
+ + [fp for fp in already_file_paths if fp]
1093
  )
1094
  )
1095