From 3951a44666dd0f836f8a8b3d5092550192fd337c Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 27 Jul 2025 21:56:20 +0800 Subject: [PATCH] Revert file_path build method, built from related chunks --- lightrag/operate.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 108a8690..769a9f1e 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -681,13 +681,7 @@ async def _rebuild_single_entity( "description": final_description, "entity_type": entity_type, "source_id": GRAPH_FIELD_SEP.join(chunk_ids), - "file_path": build_file_path( - current_entity.get("file_path", "").split(GRAPH_FIELD_SEP) - if current_entity.get("file_path") - else [], - [{"file_path": fp} for fp in file_paths], - entity_name, - ) + "file_path": GRAPH_FIELD_SEP.join(file_paths) if file_paths else current_entity.get("file_path", "unknown_source"), } @@ -900,13 +894,7 @@ async def _rebuild_single_relationship( "keywords": combined_keywords, "weight": weight, "source_id": GRAPH_FIELD_SEP.join(chunk_ids), - "file_path": build_file_path( - current_relationship.get("file_path", "").split(GRAPH_FIELD_SEP) - if current_relationship.get("file_path") - else [], - [{"file_path": fp} for fp in file_paths if fp], - f"{src}-{tgt}", - ) + "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"), }