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

Fix file path handling in graph operations
This commit is contained in:
Daniel.y 2025-07-17 18:41:39 +08:00 committed by GitHub
commit dae6190a85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -871,7 +871,7 @@ async def _rebuild_single_relationship(
"keywords": combined_keywords,
"weight": weight,
"source_id": GRAPH_FIELD_SEP.join(chunk_ids),
"file_path": GRAPH_FIELD_SEP.join(file_paths)
"file_path": GRAPH_FIELD_SEP.join([fp for fp in file_paths if fp])
if file_paths
else current_relationship.get("file_path", "unknown_source"),
}
@ -947,7 +947,14 @@ async def _merge_nodes_then_upsert(
set([dp["source_id"] for dp in nodes_data] + already_source_ids)
)
file_path = GRAPH_FIELD_SEP.join(
set([dp["file_path"] for dp in nodes_data] + already_file_paths)
set(
[
dp.get("file_path", "unknown_source")
for dp in nodes_data
if dp.get("file_path")
]
+ [fp for fp in already_file_paths if fp]
)
)
force_llm_summary_on_merge = global_config["force_llm_summary_on_merge"]
@ -1082,7 +1089,7 @@ async def _merge_edges_then_upsert(
file_path = GRAPH_FIELD_SEP.join(
set(
[dp["file_path"] for dp in edges_data if dp.get("file_path")]
+ already_file_paths
+ [fp for fp in already_file_paths if fp]
)
)