Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: update block cleanup to avoid KeyError by using default value

myhloli363439349ea9
diff --git a/mineru/backend/pipeline/pipeline_magic_model.py b/mineru/backend/pipeline/pipeline_magic_model.py
index 022d07f7..b1a71552 100644
--- a/mineru/backend/pipeline/pipeline_magic_model.py
+++ b/mineru/backend/pipeline/pipeline_magic_model.py
@@ -210,13 +210,13 @@ class MagicModel:
}
if span_type == ContentType.TABLE:
span["html"] = block.get("html", "")
- block.pop("html")
+ block.pop("html", None)
if span_type == ContentType.INTERLINE_EQUATION:
span["content"] = block.get("latex", "")
- block.pop("latex")
+ block.pop("latex", None)
if span_type == ContentType.SEAL:
span["content"] = block.get("text")
- block.pop("text")
+ block.pop("text", None)
self.all_image_spans.append(span)
# 构造line对象