Fix file path handling in graph operations
- Filter out empty file paths - Handle missing file_path fields
This commit is contained in:
parent
b321afefaa
commit
be2d938c84
1 changed files with 10 additions and 3 deletions
|
|
@ -871,7 +871,7 @@ async def _rebuild_single_relationship(
|
||||||
"keywords": combined_keywords,
|
"keywords": combined_keywords,
|
||||||
"weight": weight,
|
"weight": weight,
|
||||||
"source_id": GRAPH_FIELD_SEP.join(chunk_ids),
|
"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
|
if file_paths
|
||||||
else current_relationship.get("file_path", "unknown_source"),
|
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)
|
set([dp["source_id"] for dp in nodes_data] + already_source_ids)
|
||||||
)
|
)
|
||||||
file_path = GRAPH_FIELD_SEP.join(
|
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"]
|
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(
|
file_path = GRAPH_FIELD_SEP.join(
|
||||||
set(
|
set(
|
||||||
[dp["file_path"] for dp in edges_data if dp.get("file_path")]
|
[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]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue