yangdx commited on
Commit
41b78ee
·
1 Parent(s): b466da7

Fix file_path missing in acreate_entity and acreate_relation

Browse files
lightrag/kg/postgres_impl.py CHANGED
@@ -578,8 +578,7 @@ class PGVectorStorage(BaseVectorStorage):
578
  "content": item["content"],
579
  "content_vector": json.dumps(item["__vector__"].tolist()),
580
  "chunk_ids": chunk_ids,
581
- "file_path": item["file_path"],
582
- # TODO: add document_id
583
  }
584
  return upsert_sql, data
585
 
@@ -599,8 +598,7 @@ class PGVectorStorage(BaseVectorStorage):
599
  "content": item["content"],
600
  "content_vector": json.dumps(item["__vector__"].tolist()),
601
  "chunk_ids": chunk_ids,
602
- "file_path": item["file_path"],
603
- # TODO: add document_id
604
  }
605
  return upsert_sql, data
606
 
 
578
  "content": item["content"],
579
  "content_vector": json.dumps(item["__vector__"].tolist()),
580
  "chunk_ids": chunk_ids,
581
+ "file_path": item.get("file_path", None),
 
582
  }
583
  return upsert_sql, data
584
 
 
598
  "content": item["content"],
599
  "content_vector": json.dumps(item["__vector__"].tolist()),
600
  "chunk_ids": chunk_ids,
601
+ "file_path": item.get("file_path", None),
 
602
  }
603
  return upsert_sql, data
604
 
lightrag/utils_graph.py CHANGED
@@ -502,6 +502,7 @@ async def acreate_entity(
502
  "source_id": source_id,
503
  "description": description,
504
  "entity_type": entity_type,
 
505
  }
506
  }
507
 
@@ -607,6 +608,7 @@ async def acreate_relation(
607
  "description": description,
608
  "keywords": keywords,
609
  "weight": weight,
 
610
  }
611
  }
612
 
 
502
  "source_id": source_id,
503
  "description": description,
504
  "entity_type": entity_type,
505
+ "file_path": entity_data.get("file_path", "manual_creation"),
506
  }
507
  }
508
 
 
608
  "description": description,
609
  "keywords": keywords,
610
  "weight": weight,
611
+ "file_path": relation_data.get("file_path", "manual_creation"),
612
  }
613
  }
614