zrguo commited on
Commit
84ae8ce
·
unverified ·
2 Parent(s): dc0c15b 1a40491

Merge pull request #971 from Volve-Technologies/abyl/adding_full_doc_id

Browse files
Files changed (1) hide show
  1. lightrag/lightrag.py +4 -4
lightrag/lightrag.py CHANGED
@@ -952,11 +952,11 @@ class LightRAG:
952
  pipeline_status["latest_message"] = log_message
953
  pipeline_status["history_messages"].append(log_message)
954
 
955
- def insert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
956
  loop = always_get_an_event_loop()
957
- loop.run_until_complete(self.ainsert_custom_kg(custom_kg))
958
 
959
- async def ainsert_custom_kg(self, custom_kg: dict[str, Any]) -> None:
960
  update_storage = False
961
  try:
962
  # Insert chunks into vector storage
@@ -982,7 +982,7 @@ class LightRAG:
982
  "source_id": source_id,
983
  "tokens": tokens,
984
  "chunk_order_index": chunk_order_index,
985
- "full_doc_id": source_id,
986
  "status": DocStatus.PROCESSED,
987
  }
988
  all_chunks_data[chunk_id] = chunk_entry
 
952
  pipeline_status["latest_message"] = log_message
953
  pipeline_status["history_messages"].append(log_message)
954
 
955
+ def insert_custom_kg(self, custom_kg: dict[str, Any], full_doc_id: str = None) -> None:
956
  loop = always_get_an_event_loop()
957
+ loop.run_until_complete(self.ainsert_custom_kg(custom_kg, full_doc_id))
958
 
959
+ async def ainsert_custom_kg(self, custom_kg: dict[str, Any], full_doc_id: str = None) -> None:
960
  update_storage = False
961
  try:
962
  # Insert chunks into vector storage
 
982
  "source_id": source_id,
983
  "tokens": tokens,
984
  "chunk_order_index": chunk_order_index,
985
+ "full_doc_id": full_doc_id if full_doc_id is not None else source_id,
986
  "status": DocStatus.PROCESSED,
987
  }
988
  all_chunks_data[chunk_id] = chunk_entry