Fix: Delete relations from vector DB in both directions

This commit is contained in:
yangdx 2025-06-23 19:20:10 +08:00
parent ebcabe29ca
commit f60bad92f0

View File

@ -84,10 +84,12 @@ async def adelete_by_relation(
return
# Delete relation from vector database
relation_id = compute_mdhash_id(
source_entity + target_entity, prefix="rel-"
)
await relationships_vdb.delete([relation_id])
rel_ids_to_delete = [
compute_mdhash_id(source_entity + target_entity, prefix="rel-"),
compute_mdhash_id(target_entity + source_entity, prefix="rel-"),
]
await relationships_vdb.delete(rel_ids_to_delete)
# Delete relation from knowledge graph
await chunk_entity_relation_graph.remove_edges(