Fixed formatting
Browse files- lightrag/lightrag.py +5 -5
lightrag/lightrag.py
CHANGED
|
@@ -860,17 +860,17 @@ class LightRAG:
|
|
| 860 |
all_chunks_data: dict[str, dict[str, str]] = {}
|
| 861 |
chunk_to_source_map: dict[str, str] = {}
|
| 862 |
for chunk_data in custom_kg.get("chunks", {}):
|
| 863 |
-
chunk_content = chunk_data["content"]
|
| 864 |
source_id = chunk_data["source_id"]
|
| 865 |
-
chunk_id = compute_mdhash_id(chunk_content
|
| 866 |
|
| 867 |
chunk_entry = {
|
| 868 |
-
"content": chunk_content
|
| 869 |
"source_id": source_id,
|
| 870 |
-
"tokens": len(encode_string_by_tiktoken(chunk_content
|
| 871 |
"chunk_order_id": 0,
|
| 872 |
"full_doc_id": source_id,
|
| 873 |
-
"status": DocStatus.PROCESSED
|
| 874 |
}
|
| 875 |
all_chunks_data[chunk_id] = chunk_entry
|
| 876 |
chunk_to_source_map[source_id] = chunk_id
|
|
|
|
| 860 |
all_chunks_data: dict[str, dict[str, str]] = {}
|
| 861 |
chunk_to_source_map: dict[str, str] = {}
|
| 862 |
for chunk_data in custom_kg.get("chunks", {}):
|
| 863 |
+
chunk_content = chunk_data["content"].strip()
|
| 864 |
source_id = chunk_data["source_id"]
|
| 865 |
+
chunk_id = compute_mdhash_id(chunk_content, prefix="chunk-")
|
| 866 |
|
| 867 |
chunk_entry = {
|
| 868 |
+
"content": chunk_content,
|
| 869 |
"source_id": source_id,
|
| 870 |
+
"tokens": len(encode_string_by_tiktoken(chunk_content)),
|
| 871 |
"chunk_order_id": 0,
|
| 872 |
"full_doc_id": source_id,
|
| 873 |
+
"status": DocStatus.PROCESSED,
|
| 874 |
}
|
| 875 |
all_chunks_data[chunk_id] = chunk_entry
|
| 876 |
chunk_to_source_map[source_id] = chunk_id
|