Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix parsing JSON file error (#3829)

Jin Hai821fdf02b4fc
diff --git a/deepdoc/parser/json_parser.py b/deepdoc/parser/json_parser.py
index 2c05614bfd..1dd620d44d 100644
--- a/deepdoc/parser/json_parser.py
+++ b/deepdoc/parser/json_parser.py
@@ -92,9 +92,9 @@ class RAGFlowJsonParser:
"""Splits JSON into a list of JSON chunks"""
if convert_lists:
- chunks = self._json_split(self._list_to_dict_preprocessing(json_data))
+ chunks = self._json_split(self._list_to_dict_preprocessing(json_data), None, None)
else:
- chunks = self._json_split(json_data)
+ chunks = self._json_split(json_data, None, None)
# Remove the last chunk if it's empty
if not chunks[-1]:
diff --git a/rag/app/naive.py b/rag/app/naive.py
index 6983582cfc..f9f1ca8792 100644
--- a/rag/app/naive.py
+++ b/rag/app/naive.py
@@ -258,7 +258,8 @@ def chunk(filename, binary=None, from_page=0, to_page=100000,
elif re.search(r"\.json$", filename, re.IGNORECASE):
callback(0.1, "Start to parse.")
- sections = JsonParser(int(parser_config.get("chunk_token_num", 128)))(binary)
+ chunk_token_num = int(parser_config.get("chunk_token_num", 128))
+ sections = JsonParser(chunk_token_num)(binary)
sections = [(_, "") for _ in sections if _]
callback(0.8, "Finish parsing.")