Update lightrag.py

This commit is contained in:
zrguo
2025-03-13 16:52:48 +08:00
parent e6c602b0ea
commit e2b9be2dc6

View File

@@ -1114,6 +1114,7 @@ class LightRAG:
# Prepare node data # Prepare node data
node_data: dict[str, str] = { node_data: dict[str, str] = {
"entity_id": entity_name,
"entity_type": entity_type, "entity_type": entity_type,
"description": description, "description": description,
"source_id": source_id, "source_id": source_id,
@@ -1151,6 +1152,7 @@ class LightRAG:
await self.chunk_entity_relation_graph.upsert_node( await self.chunk_entity_relation_graph.upsert_node(
need_insert_id, need_insert_id,
node_data={ node_data={
"entity_id": need_insert_id,
"source_id": source_id, "source_id": source_id,
"description": "UNKNOWN", "description": "UNKNOWN",
"entity_type": "UNKNOWN", "entity_type": "UNKNOWN",
@@ -2160,6 +2162,7 @@ class LightRAG:
# Prepare node data with defaults if missing # Prepare node data with defaults if missing
node_data = { node_data = {
"entity_id": entity_name,
"entity_type": entity_data.get("entity_type", "UNKNOWN"), "entity_type": entity_data.get("entity_type", "UNKNOWN"),
"description": entity_data.get("description", ""), "description": entity_data.get("description", ""),
"source_id": entity_data.get("source_id", "manual"), "source_id": entity_data.get("source_id", "manual"),