fix: duplicate nodes for same entity(label) problem in Neo4j

- Add entity_id field as key in Neo4j nodes
- Use  entity_id for nodes retrival and upsert
This commit is contained in:
yangdx
2025-03-09 00:24:55 +08:00
parent 73452e63fa
commit 18c0770409
2 changed files with 74 additions and 34 deletions

View File

@@ -220,6 +220,7 @@ async def _merge_nodes_then_upsert(
entity_name, description, global_config
)
node_data = dict(
entity_id=entity_name,
entity_type=entity_type,
description=description,
source_id=source_id,
@@ -301,6 +302,7 @@ async def _merge_edges_then_upsert(
await knowledge_graph_inst.upsert_node(
need_insert_id,
node_data={
"entity_id": need_insert_id,
"source_id": source_id,
"description": description,
"entity_type": "UNKNOWN",