Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: remove VLM backend support and update related components to use hybrid backend
myhloli55397334cc85
diff --git a/mineru/backend/vlm/__init__.py b/mineru/backend/vlm/__init__.pydeleted file mode 100644index 1e17167c..00000000--- a/mineru/backend/vlm/__init__.py+++ /dev/null@@ -1 +0,0 @@-# Copyright (c) Opendatalab. All rights reserved.diff --git a/mineru/backend/vlm/model_output_to_middle_json.py b/mineru/backend/vlm/model_output_to_middle_json.pydeleted file mode 100644index 79a18343..00000000--- a/mineru/backend/vlm/model_output_to_middle_json.py+++ /dev/null@@ -1,98 +0,0 @@-# Copyright (c) Opendatalab. All rights reserved.-from __future__ import annotations--import os-from typing import Any--from mineru_vl_utils.structs import ExtractResult--from ...types import PageInfo-from ...utils.config_reader import get_table_enable-from ...utils.hash_utils import bytes_md5-from ...utils.image_payload import ImagePayloadCache-from ...utils.pdf_document import PDFPage-from ...utils.title_level_postprocess import apply_title_leveling_to_pdf_info-from ..utils.para_block_utils import (- build_para_blocks_from_preproc,- cleanup_internal_para_block_metadata,- merge_para_text_blocks,-)-from ..utils.runtime_utils import cross_page_table_merge-from ..utils.visual_span_utils import cut_visual_spans_in_blocks-from .vlm_magic_model import MagicModel---def blocks_to_page_info(- page_blocks: ExtractResult,- image_dict: dict[str, Any],- pdf_page: PDFPage,- page_index: int,- image_cache: ImagePayloadCache | None = None,-) -> PageInfo:- """将blocks转换为页面信息"""-- scale = image_dict["scale"]- page_pil_img = image_dict["img_pil"]- page_img_md5 = bytes_md5(page_pil_img.tobytes())- width, height = map(int, pdf_page.size)-- magic_model = MagicModel(page_blocks, width, height)- image_blocks = magic_model.get_image_blocks()- table_blocks = magic_model.get_table_blocks()- chart_blocks = magic_model.get_chart_blocks()- title_blocks = magic_model.get_title_blocks()- discarded_blocks = magic_model.get_discarded_blocks()- code_blocks = magic_model.get_code_blocks()- ref_text_blocks = magic_model.get_ref_text_blocks()- phonetic_blocks = magic_model.get_phonetic_blocks()- list_blocks = magic_model.get_list_blocks()-- text_blocks = magic_model.get_text_blocks()- interline_equation_blocks = magic_model.get_interline_equation_blocks()-- blocks = [- *image_blocks,- *table_blocks,- *chart_blocks,- *code_blocks,- *ref_text_blocks,- *phonetic_blocks,- *title_blocks,- *text_blocks,- *interline_equation_blocks,- *list_blocks,- ]-- # 对page_blocks根据index的值进行排序- blocks.sort(key=lambda x: x.index)-- cut_visual_spans_in_blocks(- [*blocks, *discarded_blocks],- page_pil_img,- page_img_md5,- page_index,- scale=scale,- image_cache=image_cache,- )-- page_info = PageInfo(- preproc_blocks=blocks,- discarded_blocks=discarded_blocks,- page_size=(width, height),- page_idx=page_index,- _backend="vlm",- )- return page_info---def finalize_middle_json(pages: list[PageInfo]) -> None:- """从 VLM preproc_blocks 执行完整 finalize,客户端和服务端完整路径共用。"""- build_para_blocks_from_preproc(pages)- merge_para_text_blocks(pages)-- table_enable = get_table_enable(os.getenv("MINERU_VLM_TABLE_ENABLE", "True").lower() == "true")- if table_enable:- cross_page_table_merge(pages)-- apply_title_leveling_to_pdf_info(pages)- cleanup_internal_para_block_metadata(pages)diff --git a/mineru/backend/vlm/vlm_magic_model.py b/mineru/backend/vlm/vlm_magic_model.pydeleted file mode 100644index 0ec4ed63..00000000--- a/mineru/backend/vlm/vlm_magic_model.py+++ /dev/null@@ -1,351 +0,0 @@-# Copyright (c) Opendatalab. All rights reserved.-from __future__ import annotations--import re--from loguru import logger-from mineru_vl_utils.structs import ExtractResult--from ...types import Block, BlockType, ContentType, Line, Span-from ...utils.guess_suffix_or_lang import guess_language_by_text-from ..utils.content_block_draft import VlmContentBlockDraft-from ..utils.boxbase import calculate_overlap_area_in_bbox1_area_ratio-from ..utils.visual_magic_model_utils import (- GENERIC_CHILD_TYPES,- IMAGE_BLOCK_BODY,- VISUAL_MAIN_TYPES,- clean_content,- code_content_clean,- fallback_inline_caption_fragments,- fallback_leading_table_continuation_captions,- isolated_formula_clean,- regroup_visual_blocks,-)---def _copy_raw_text_block_metadata(draft: VlmContentBlockDraft, block: Block) -> None:- if draft.raw_type != BlockType.TEXT:- return- block.merge_prev = draft.merge_prev---class MagicModel:- def __init__(self, page_blocks: ExtractResult, width: int, height: int) -> None:- blocks: list[Block] = []- # 解析每个块- for index, content_block in enumerate(page_blocks):- try:- draft = VlmContentBlockDraft.from_content_block(content_block, width, height)- block_bbox = draft.bbox- block_type = draft.raw_type- raw_block_type = draft.raw_type- block_content = draft.content- block_angle = draft.angle- block_sub_type = draft.sub_type if raw_block_type in ["image", "chart"] else None- except Exception as e:- # 如果解析失败,可能是因为格式不正确,跳过这个块- logger.warning(f"Invalid block format: {content_block}, error: {e}")- continue-- span_type = "unknown"- code_block_sub_type = None- guess_lang = None-- if block_type in [- "text",- "title",- "ref_text",- "phonetic",- "header",- "footer",- "page_number",- "aside_text",- "page_footnote",- "list",- ]:- span_type = ContentType.TEXT- elif block_type in ["image_caption", "table_caption", "code_caption"]:- block_type = BlockType.CAPTION- span_type = ContentType.TEXT- elif block_type in ["image_footnote", "table_footnote"]:- block_type = BlockType.FOOTNOTE- span_type = ContentType.TEXT- elif block_type == "image":- block_type = BlockType.IMAGE_BODY- span_type = ContentType.IMAGE- elif block_type == "image_block":- block_type = IMAGE_BLOCK_BODY- span_type = ContentType.IMAGE- elif block_type == "table":- block_type = BlockType.TABLE_BODY- span_type = ContentType.TABLE- elif block_type == "chart":- block_type = BlockType.CHART_BODY- span_type = ContentType.CHART- elif block_type in ["code", "algorithm"]:- block_content = code_content_clean(block_content)- code_block_sub_type = block_type- block_type = BlockType.CODE_BODY- span_type = ContentType.TEXT- guess_lang = guess_language_by_text(block_content)- elif block_type == "equation":- block_type = BlockType.INTERLINE_EQUATION- span_type = ContentType.INTERLINE_EQUATION-- if span_type == ContentType.TEXT and block_content is None:- # 文本类块缺失 content 时按空文本处理,避免下游 render 遇到 None。- block_content = ""-- # code 和 algorithm 类型的块,如果内容中包含行内公式,则需要将块类型切换为 algorithm- switch_code_to_algorithm = False-- if span_type in [ContentType.IMAGE, ContentType.TABLE, ContentType.CHART]:- span = Span(type=span_type, bbox=block_bbox)- if span_type == ContentType.TABLE:- span.content = block_content or ""- elif raw_block_type in ["image", "chart"] and block_content is not None:- span.content = block_content- elif span_type == ContentType.INTERLINE_EQUATION:- span = Span(- type=span_type,- bbox=block_bbox,- content=isolated_formula_clean(block_content),- )- else:- if block_content:- block_content = clean_content(block_content)-- if block_type == "title" and block_content:- block_content = re.sub(r"\n\s*", " ", block_content).strip()-- if (- block_content- and block_content.count("\\(") == block_content.count("\\)")- and block_content.count("\\(") > 0- ):- switch_code_to_algorithm = True-- # 生成包含文本和公式的span列表- spans = []- last_end = 0-- # 查找所有公式- for match in re.finditer(r"\\\((.+?)\\\)", block_content):- start, end = match.span()-- # 添加公式前的文本- if start > last_end:- text_before = block_content[last_end:start]- if text_before.strip():- spans.append(- Span(- type=ContentType.TEXT,- bbox=block_bbox,- content=text_before,- )- )-- # 添加公式(去除\(和\))- formula = match.group(1)- spans.append(- Span(- type=ContentType.INLINE_EQUATION,- bbox=block_bbox,- content=formula.strip(),- )- )-- last_end = end-- # 添加最后一个公式后的文本- if last_end < len(block_content):- text_after = block_content[last_end:]- if text_after.strip():- spans.append(- Span(- type=ContentType.TEXT,- bbox=block_bbox,- content=text_after,- )- )-- span = spans- else:- span = Span(- type=span_type,- bbox=block_bbox,- content=block_content or "",- )-- # 处理span类型并添加到all_spans- if isinstance(span, Span):- spans = [span]- elif isinstance(span, list):- spans = span- else:- raise ValueError(f"Invalid span type: {span_type}, expected dict or list, got {type(span)}")-- # 构造 line 对象- if block_type == BlockType.CODE_BODY:- if switch_code_to_algorithm and code_block_sub_type == "code":- code_block_sub_type = "algorithm"- line = Line(spans=spans, bbox=block_bbox, _code_type=code_block_sub_type, _code_guess_lang=guess_lang)- else:- line = Line(spans=spans, bbox=block_bbox)-- block = Block(- index=index,- type=block_type,- bbox=block_bbox,- lines=[line],- angle=block_angle,- sub_type=block_sub_type or "",- )- if raw_block_type == "table" and draft.cell_merge:- block._cell_merge = draft.cell_merge- _copy_raw_text_block_metadata(draft, block)-- blocks.append(block)-- fallback_inline_caption_fragments(blocks, VISUAL_MAIN_TYPES)- fallback_leading_table_continuation_captions(blocks, VISUAL_MAIN_TYPES)-- self.image_blocks: list[Block] = []- self.table_blocks: list[Block] = []- self.chart_blocks: list[Block] = []- self.interline_equation_blocks: list[Block] = []- self.text_blocks: list[Block] = []- self.title_blocks: list[Block] = []- self.code_blocks: list[Block] = []- self.discarded_blocks: list[Block] = []- self.ref_text_blocks: list[Block] = []- self.phonetic_blocks: list[Block] = []- self.list_blocks: list[Block] = []-- for block in blocks:- if block.type in VISUAL_MAIN_TYPES or block.type in GENERIC_CHILD_TYPES:- continue- elif block.type == BlockType.INTERLINE_EQUATION:- self.interline_equation_blocks.append(block)- elif block.type == BlockType.TEXT:- self.text_blocks.append(block)- elif block.type == BlockType.TITLE:- self.title_blocks.append(block)- elif block.type == BlockType.REF_TEXT:- self.ref_text_blocks.append(block)- elif block.type == BlockType.PHONETIC:- self.phonetic_blocks.append(block)- elif block.type in [- BlockType.HEADER,- BlockType.FOOTER,- BlockType.PAGE_NUMBER,- BlockType.ASIDE_TEXT,- BlockType.PAGE_FOOTNOTE,- ]:- self.discarded_blocks.append(block)- elif block.type == BlockType.LIST:- self.list_blocks.append(block)-- self.list_blocks, self.text_blocks, self.ref_text_blocks = fix_list_blocks(- self.list_blocks,- self.text_blocks,- self.ref_text_blocks,- )-- visual_groups, unmatched_child_blocks = regroup_visual_blocks(blocks)- self.image_blocks = visual_groups[BlockType.IMAGE]- self.table_blocks = visual_groups[BlockType.TABLE]- self.chart_blocks = visual_groups[BlockType.CHART]- self.code_blocks = visual_groups[BlockType.CODE]-- for code_block in self.code_blocks:- for block in code_block.blocks:- if block.type == BlockType.CODE_BODY:- if block.lines:- line = block.lines[0]- code_block.sub_type = line._code_type or ""- line._code_type = None- if code_block.sub_type == "code":- code_block.guess_lang = line._code_guess_lang or ""- line._code_guess_lang = None- else:- code_block.sub_type = "code"- code_block.guess_lang = "txt"-- for block in unmatched_child_blocks:- block.type = BlockType.TEXT- self.text_blocks.append(block)-- def get_list_blocks(self) -> list[Block]:- return self.list_blocks-- def get_image_blocks(self) -> list[Block]:- return self.image_blocks-- def get_table_blocks(self) -> list[Block]:- return self.table_blocks-- def get_chart_blocks(self) -> list[Block]:- return self.chart_blocks-- def get_code_blocks(self) -> list[Block]:- return self.code_blocks-- def get_ref_text_blocks(self) -> list[Block]:- return self.ref_text_blocks-- def get_phonetic_blocks(self) -> list[Block]:- return self.phonetic_blocks-- def get_title_blocks(self) -> list[Block]:- return self.title_blocks-- def get_text_blocks(self) -> list[Block]:- return self.text_blocks-- def get_interline_equation_blocks(self) -> list[Block]:- return self.interline_equation_blocks-- def get_discarded_blocks(self) -> list[Block]:- return self.discarded_blocks---def fix_list_blocks(- list_blocks: list[Block], text_blocks: list[Block], ref_text_blocks: list[Block]-) -> tuple[list[Block], list[Block], list[Block]]:- for list_block in list_blocks:- list_block.lines = []-- temp_text_blocks = text_blocks + ref_text_blocks- need_remove_blocks = []- for block in temp_text_blocks:- for list_block in list_blocks:- if calculate_overlap_area_in_bbox1_area_ratio(block.bbox, list_block.bbox) >= 0.8:- list_block.blocks.append(block)- need_remove_blocks.append(block)- break-- for block in need_remove_blocks:- if block in text_blocks:- text_blocks.remove(block)- elif block in ref_text_blocks:- ref_text_blocks.remove(block)-- # 移除blocks为空的list_block- list_blocks = [lb for lb in list_blocks if lb.blocks]-- for list_block in list_blocks:- # 统计list_block["blocks"]中所有block的type,用众数作为list_block的sub_type- type_count = {}- for sub_block in list_block.blocks:- sub_block_type = sub_block.type- if sub_block_type not in type_count:- type_count[sub_block_type] = 0- type_count[sub_block_type] += 1-- if type_count:- list_block.sub_type = max(type_count, key=type_count.get) # type: ignore- else:- list_block.sub_type = "unknown"-- return list_blocks, text_blocks, ref_text_blocksdiff --git a/mineru/cli_old/client_side_output.py b/mineru/cli_old/client_side_output.pyindex d5d3b819..36182f3c 100644--- a/mineru/cli_old/client_side_output.py+++ b/mineru/cli_old/client_side_output.py@@ -12,7 +12,7 @@ from mineru.utils.backend_options import DEFAULT_HYBRID_EFFORT, normalize_backenfrom mineru.utils.title_level_postprocess import finalize_client_side_pagesfrom mineru.version import __version__-PDF_BACKENDS = {"pipeline", "vlm", "hybrid"}+PDF_BACKENDS = {"pipeline", "hybrid"}def _write_json(path: Path, payload: Any) -> None:@@ -27,8 +27,6 @@ def _normalize_client_side_backend(backend: str) -> str:"""将旧 CLI 传入的后端选项归一化为客户端重渲染使用的后端族。"""if backend == "office":return "office"- if backend == "vlm":- return "vlm"try:backend = normalize_backend(backend)except ValueError:diff --git a/mineru/cli_old/common.py b/mineru/cli_old/common.pyindex 9b5b3d34..93a1b046 100644--- a/mineru/cli_old/common.py+++ b/mineru/cli_old/common.py@@ -889,7 +889,7 @@ if __name__ == "__main__":[read_fn(Path(pdf_path))],["ch"],end_page_id=10,- backend="vlm-huggingface",+ backend="hybrid-engine",# backend = 'pipeline')except Exception as e:diff --git a/mineru/cli_old/output_paths.py b/mineru/cli_old/output_paths.pyindex 5f18c421..5047f499 100644--- a/mineru/cli_old/output_paths.py+++ b/mineru/cli_old/output_paths.py@@ -5,7 +5,6 @@ from mineru.utils.backend_options import normalize_backendOFFICE_PARSE_DIR_NAME = "office"-VLM_PARSE_DIR_NAME = "vlm"def build_parse_dir(diff --git a/mineru/parser/base.py b/mineru/parser/base.pyindex 74cefaf6..a66a2faf 100644--- a/mineru/parser/base.py+++ b/mineru/parser/base.py@@ -16,6 +16,7 @@ from ..utils.pdf_document import PDFDocument_PDF_RETAINED_PAGE_INDICES_KEY = "_pdf_retained_page_indices"_PDF_BROKEN_PAGE_INDICES_KEY = "_pdf_broken_page_indices"+_SUPPORTED_MIDDLE_JSON_BACKENDS = {"pipeline", "hybrid", "office"}def _parse_optional_int_list(value: Any) -> list[int] | None:@@ -67,6 +68,8 @@ class ParseResult:root_backend = d.get("_backend")if not isinstance(root_backend, str):root_backend = None+ elif root_backend not in _SUPPORTED_MIDDLE_JSON_BACKENDS:+ raise ValueError(f"Unsupported middle json backend '{root_backend}'.")pages: list[PageInfo] = []for raw_page in raw_pages:if not isinstance(raw_page, dict):@@ -75,6 +78,8 @@ class ParseResult:backend = raw_page.get("_backend")if not isinstance(backend, str):backend = root_backend+ elif backend not in _SUPPORTED_MIDDLE_JSON_BACKENDS:+ raise ValueError(f"Unsupported middle json backend '{backend}'.")if backend is not None:page._backend = backendpages.append(page)diff --git a/mineru/render/union_make.py b/mineru/render/union_make.pyindex b7d6b467..cb64c5b6 100644--- a/mineru/render/union_make.py+++ b/mineru/render/union_make.py@@ -8,7 +8,7 @@ from .markdown import blocks_to_markdownfrom .office.output import blocks_to_markdown as office_blocks_to_markdownfrom .structured_content import block_to_structured_content, merge_adjacent_ref_text_blocks_for_content-Backend = Literal["pipeline", "vlm", "hybrid", "office"]+Backend = Literal["pipeline", "hybrid", "office"]def _backend_from_pages(pages: list[PageInfo]) -> Backend | None:diff --git a/mineru/types.py b/mineru/types.pyindex 7bbe9742..2bee5824 100644--- a/mineru/types.py+++ b/mineru/types.py@@ -560,7 +560,7 @@ class PageInfo(_DocElement):discarded_blocks: list[Block] = field(default_factory=list)# Temporary — will be removed once the render layer converges.- _backend: Literal["pipeline", "vlm", "hybrid", "office"] | None = None+ _backend: Literal["pipeline", "hybrid", "office"] | None = None@dataclassdiff --git a/mineru/utils/backend_options.py b/mineru/utils/backend_options.pyindex 88003ba1..dbcdcfda 100644--- a/mineru/utils/backend_options.py+++ b/mineru/utils/backend_options.py@@ -78,11 +78,6 @@ def resolve_backend_and_effort(backend: str | None, effort: str | None = None) -return resolved_backend, resolved_effort-def is_vlm_backend(backend: str) -> bool:- """判断规范化后的 backend 是否属于 VLM 后端族;新解析入口不再产生该族。"""- return normalize_backend(backend).startswith("vlm-")--def is_hybrid_backend(backend: str) -> bool:"""判断规范化后的 backend 是否属于 Hybrid 后端族。"""return normalize_backend(backend).startswith("hybrid-")diff --git a/mineru/utils/title_level_postprocess.py b/mineru/utils/title_level_postprocess.pyindex ca7c94b2..f1816370 100644--- a/mineru/utils/title_level_postprocess.py+++ b/mineru/utils/title_level_postprocess.py@@ -2,7 +2,6 @@from __future__ import annotationsimport time-import osfrom copy import deepcopyfrom typing import Any@@ -13,8 +12,6 @@ from .backend_options import DEFAULT_HYBRID_EFFORT, validate_effortfrom .config_reader import get_llm_aided_configfrom .llm_aided import llm_aided_title-SUPPORTED_PDF_BACKENDS = {"pipeline", "vlm", "hybrid"}-def _resolve_title_aided_config() -> dict[str, Any] | None:"""从本地配置解析标题分级开关。"""@@ -47,23 +44,6 @@ def finalize_client_side_pages(pages: list[PageInfo], backend: str, effort: strfrom mineru.backend.pipeline.model_output_to_middle_json import finalize_middle_json_from_preprocfinalize_middle_json_from_preproc(pages)- elif backend == "vlm":- from mineru.backend.utils.para_block_utils import (- build_para_blocks_from_preproc,- cleanup_internal_para_block_metadata,- merge_para_text_blocks,- )- from mineru.backend.utils.runtime_utils import cross_page_table_merge- from mineru.utils.config_reader import get_table_enable-- # 旧 VLM middle_json 只作为读取兼容:复用纯后处理链,不再依赖独立 VLM backend。- build_para_blocks_from_preproc(pages)- merge_para_text_blocks(pages)- table_enable = get_table_enable(os.getenv("MINERU_VLM_TABLE_ENABLE", "True").lower() == "true")- if table_enable:- cross_page_table_merge(pages)- apply_title_leveling_to_pdf_info(pages)- cleanup_internal_para_block_metadata(pages)elif backend == "hybrid":from mineru.backend.hybrid.model_output_to_middle_json import finalize_middle_json_from_preprocdiff --git a/tests/unittest/test_doclib_cache_semantics.py b/tests/unittest/test_doclib_cache_semantics.pyindex 98cd127d..aa6f13ab 100644--- a/tests/unittest/test_doclib_cache_semantics.py+++ b/tests/unittest/test_doclib_cache_semantics.py@@ -232,7 +232,7 @@ def _image_page(image_path: str) -> PageInfo:lines=[Line(bbox=(1, 1, 20, 20), spans=[image_span])],)image_block = Block(index=0, type=BlockType.IMAGE, bbox=(1, 1, 20, 20), blocks=[body])- return PageInfo(page_idx=0, page_size=(100, 100), para_blocks=[image_block], _backend="vlm")+ return PageInfo(page_idx=0, page_size=(100, 100), para_blocks=[image_block], _backend="hybrid")def _image_result(image_path: str, image_bytes: bytes = b"image-bytes") -> ParseResult:diff --git a/tests/unittest/test_kit_commands.py b/tests/unittest/test_kit_commands.pyindex 1403063d..d98ae4c5 100644--- a/tests/unittest/test_kit_commands.py+++ b/tests/unittest/test_kit_commands.py@@ -75,7 +75,7 @@ class BlockLocalPipelineFinder(importlib.abc.MetaPathFinder):def find_spec(self, fullname, path=None, target=None):if fullname in {"mineru.cli_old.common", "mineru.cli_old.vlm_preload"}:raise ModuleNotFoundError(f"blocked local dependency import: {fullname}")- if fullname == "mineru.backend.vlm.vlm_analyze" or fullname.startswith("mineru.backend.office."):+ if fullname.startswith("mineru.backend.office."):raise ModuleNotFoundError(f"blocked local dependency import: {fullname}")return Nonediff --git a/tests/unittest/test_parse_result_contract.py b/tests/unittest/test_parse_result_contract.pyindex 01d55669..cab5511e 100644--- a/tests/unittest/test_parse_result_contract.py+++ b/tests/unittest/test_parse_result_contract.py@@ -166,6 +166,11 @@ def test_parse_result_from_dict_keeps_page_backend_over_root_backend() -> None:assert restored.pages[0]._backend == "pipeline"+def test_parse_result_from_dict_rejects_legacy_vlm_backend() -> None:+ with pytest.raises(ValueError, match="Unsupported middle json backend 'vlm'"):+ ParseResult.from_dict({"_backend": "vlm", "pages": [{"page_idx": 0}]})++def test_parse_result_preserves_true_merge_prev_in_staged_middle_json() -> None:block = Block(index=0, type="text", bbox=(0.0, 0.0, 10.0, 10.0), merge_prev=True)result = ParseResult(pages=[PageInfo(page_idx=0, preproc_blocks=[block])])diff --git a/tests/unittest/test_title_level_postprocess.py b/tests/unittest/test_title_level_postprocess.pyindex 1e1fadab..5c4528b1 100644--- a/tests/unittest/test_title_level_postprocess.py+++ b/tests/unittest/test_title_level_postprocess.py@@ -53,7 +53,8 @@ def test_finalize_client_side_pages_uses_explicit_backend(monkeypatch) -> None:assert calls == [pages]-def test_finalize_client_side_pages_uses_round_tripped_merge_prev_then_cleans_it() -> None:+def test_finalize_client_side_hybrid_pages_uses_round_tripped_merge_prev_then_cleans_it() -> None:+ """校验客户端 Hybrid finalize 会消费并清理 round-trip 后的 merge_prev 元数据。"""previous_block = Block(index=0,type="text",@@ -82,7 +83,7 @@ def test_finalize_client_side_pages_uses_round_tripped_merge_prev_then_cleans_it).to_dict()round_tripped_pages = ParseResult.from_dict(staged_payload).pages- title_level_postprocess.finalize_client_side_pages(round_tripped_pages, "vlm")+ title_level_postprocess.finalize_client_side_pages(round_tripped_pages, "hybrid", effort="high")para_blocks = round_tripped_pages[0].para_blocksmerged_text = [span.content for line in para_blocks[0].lines for span in line.spans]