Skip to content
Snippets Groups Projects
Unverified Commit 36caf28e authored by wb200's avatar wb200 Committed by GitHub
Browse files

Update llama_parse_json_element.py to fix error exception caused by certain PDF (#12402)

* Update llama_parse_json_element.py

Please refer to https://github.com/run-llama/llama_index/issues/12314

 for a detailed explanation of the bug fix.

* cr

---------

Co-authored-by: default avatarHaotian Zhang <socool.king@gmail.com>
parent 4f658281
No related branches found
No related tags found
No related merge requests found
......@@ -260,7 +260,12 @@ class LlamaParseJsonNodeParser(BaseElementNodeParser):
and element.type == "text"
and merged_elements[-1].type == "text"
):
merged_elements[-1].element += "\n" + element.element
if isinstance(element.element, list):
merged_elements[-1].element += "\n" + " ".join(
str(e) for e in element.element
)
else:
merged_elements[-1].element += "\n" + element.element
else:
merged_elements.append(element)
elements = merged_elements
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment