Merge branch 'main' into validate-content-before-enqueue

This commit is contained in:
yangdx
2025-03-03 01:34:55 +08:00

View File

@@ -1013,7 +1013,7 @@ class LightRAG:
# Insert entities into knowledge graph
all_entities_data: list[dict[str, str]] = []
for entity_data in custom_kg.get("entities", []):
entity_name = f'"{entity_data["entity_name"].upper()}"'
entity_name = entity_data["entity_name"]
entity_type = entity_data.get("entity_type", "UNKNOWN")
description = entity_data.get("description", "No description provided")
# source_id = entity_data["source_id"]
@@ -1043,8 +1043,8 @@ class LightRAG:
# Insert relationships into knowledge graph
all_relationships_data: list[dict[str, str]] = []
for relationship_data in custom_kg.get("relationships", []):
src_id = f'"{relationship_data["src_id"].upper()}"'
tgt_id = f'"{relationship_data["tgt_id"].upper()}"'
src_id = relationship_data["src_id"]
tgt_id = relationship_data["tgt_id"]
description = relationship_data["description"]
keywords = relationship_data["keywords"]
weight = relationship_data.get("weight", 1.0)
@@ -1346,8 +1346,6 @@ class LightRAG:
return loop.run_until_complete(self.adelete_by_entity(entity_name))
async def adelete_by_entity(self, entity_name: str) -> None:
entity_name = f'"{entity_name.upper()}"'
try:
await self.entities_vdb.delete_entity(entity_name)
await self.relationships_vdb.delete_entity_relation(entity_name)
@@ -1642,7 +1640,6 @@ class LightRAG:
- graph_data: Complete node data from the graph database
- vector_data: (optional) Data from the vector database
"""
entity_name = f'"{entity_name.upper()}"'
# Get information from the graph
node_data = await self.chunk_entity_relation_graph.get_node(entity_name)
@@ -1680,8 +1677,6 @@ class LightRAG:
- graph_data: Complete edge data from the graph database
- vector_data: (optional) Data from the vector database
"""
src_entity = f'"{src_entity.upper()}"'
tgt_entity = f'"{tgt_entity.upper()}"'
# Get information from the graph
edge_data = await self.chunk_entity_relation_graph.get_edge(