fix linting
Browse files- lightrag/lightrag.py +9 -3
lightrag/lightrag.py
CHANGED
@@ -952,11 +952,15 @@ class LightRAG:
|
|
952 |
pipeline_status["latest_message"] = log_message
|
953 |
pipeline_status["history_messages"].append(log_message)
|
954 |
|
955 |
-
def insert_custom_kg(
|
|
|
|
|
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(
|
|
|
|
|
960 |
update_storage = False
|
961 |
try:
|
962 |
# Insert chunks into vector storage
|
@@ -982,7 +986,9 @@ class LightRAG:
|
|
982 |
"source_id": source_id,
|
983 |
"tokens": tokens,
|
984 |
"chunk_order_index": chunk_order_index,
|
985 |
-
"full_doc_id": full_doc_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(
|
956 |
+
self, custom_kg: dict[str, Any], full_doc_id: str = None
|
957 |
+
) -> None:
|
958 |
loop = always_get_an_event_loop()
|
959 |
loop.run_until_complete(self.ainsert_custom_kg(custom_kg, full_doc_id))
|
960 |
|
961 |
+
async def ainsert_custom_kg(
|
962 |
+
self, custom_kg: dict[str, Any], full_doc_id: str = None
|
963 |
+
) -> None:
|
964 |
update_storage = False
|
965 |
try:
|
966 |
# Insert chunks into vector storage
|
|
|
986 |
"source_id": source_id,
|
987 |
"tokens": tokens,
|
988 |
"chunk_order_index": chunk_order_index,
|
989 |
+
"full_doc_id": full_doc_id
|
990 |
+
if full_doc_id is not None
|
991 |
+
else source_id,
|
992 |
"status": DocStatus.PROCESSED,
|
993 |
}
|
994 |
all_chunks_data[chunk_id] = chunk_entry
|