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
fix: ensure consistent height for results area in narrow screen media queries
myhloli3263f3c91f65
diff --git a/mineru/kit/gradio/app.py b/mineru/kit/gradio/app.pyindex 9a401a77..c772dec2 100644--- a/mineru/kit/gradio/app.py+++ b/mineru/kit/gradio/app.py@@ -197,6 +197,20 @@ _KIT_MENU_CSS = """@media (max-width: 900px) {.mineru-kit-workspace { flex-direction: column !important; }.mineru-kit-control, .mineru-kit-preview, .mineru-kit-results { min-width: 0 !important; width: 100% !important; }+ /* 窄屏改用固定高度、整栏按内容收口:不依赖上面的 flex 拉伸链(移动端引擎+ 可能不把拉伸所得高度视为定值,height:100% 断链时 iframe 会塌到默认+ ~150px),也避免拉伸模式下 885px min-height 与 775px 正文之间在卡片+ 底部留下死区。与 PDF/源文档预览的窄屏策略一致。 */+ .mineru-kit-results { min-height: 0; flex: 0 0 auto !important; }+ .mineru-kit-results > .mineru-markdown-tabs,+ .mineru-kit-results [role="tabpanel"],+ .mineru-kit-results [role="tabpanel"] > .column { flex: 0 0 auto; }+ .mineru-kit-results .mineru-markdown-output,+ .mineru-kit-results .mineru-structured-json {+ flex: 0 0 auto !important;+ height: var(--mineru-preview-content-height, 775px) !important;+ min-height: var(--mineru-preview-content-height, 775px) !important;+ }}"""diff --git a/mineru/utils/logger.py b/mineru/utils/logger.pyindex c6bb0eb3..38373648 100644--- a/mineru/utils/logger.py+++ b/mineru/utils/logger.py@@ -3,6 +3,7 @@from __future__ import annotations+import osimport sysimport threading@@ -28,6 +29,9 @@ def configure_global_log_level(level: LogLevel | str | None = None) -> LogLevel:``level`` 为 ``None`` 时使用 ``config.log.level``;显式传入后作为进程级局部覆盖,后续默认调用不会把它改回全局配置。函数只移除 Loguru 初始sink 和 MinerU 自己创建的 sink,不会影响宿主程序显式添加的自定义 sink。+ 级别同时写入 ``LOGURU_LEVEL`` 环境变量(覆盖外部预设),使之后 spawn 的+ 子进程(如 DocVortex 渲染 worker)在初始化 Loguru 出厂 sink 时继承同一+ 级别,与当前进程保持一致。"""from loguru import logger@@ -41,6 +45,7 @@ def configure_global_log_level(level: LogLevel | str | None = None) -> LogLevel:else:normalized = GlobalLogConfig(level=level).level_explicit_level = normalized+ os.environ["LOGURU_LEVEL"] = normalized.upper()active_ids = _active_managed_sink_ids()has_initial_sink = 0 in logger._core.handlersif _configured_level == normalized and (active_ids or not has_initial_sink):diff --git a/tests/unittest/test_global_log_level.py b/tests/unittest/test_global_log_level.pyindex aece0323..739cdcfa 100644--- a/tests/unittest/test_global_log_level.py+++ b/tests/unittest/test_global_log_level.py@@ -173,3 +173,31 @@ def test_render_entry_configures_global_log_level(monkeypatch: pytest.MonkeyPatcrender_api_module.render(object(), render_api_module.RenderFormat.MARKDOWN)assert calls == ["configure"]++[email protected](("level", "expected_debug"), [("info", False), ("debug", True)])+def test_configured_level_propagates_to_spawned_children(level: str, expected_debug: bool) -> None:+ """验证配置级别经 LOGURU_LEVEL 传播到之后 spawn 的子进程出厂 sink。"""+ script = (+ "import json, subprocess, sys; "+ "from mineru.utils.logger import configure_global_log_level; "+ f"configure_global_log_level({level!r}); "+ "import os; "+ "child = subprocess.run("+ "[sys.executable, '-c', "+ "\"from loguru import logger; logger.debug('CHILD_DEBUG'); logger.info('CHILD_INFO')\"], "+ "capture_output=True, text=True, check=True); "+ "print(json.dumps({'env': os.environ.get('LOGURU_LEVEL'), 'child_stderr': child.stderr}))"+ )+ completed = subprocess.run(+ [sys.executable, "-c", script],+ capture_output=True,+ text=True,+ check=True,+ timeout=30,+ )+ output = json.loads(completed.stdout)++ assert output["env"] == level.upper()+ assert ("CHILD_DEBUG" in output["child_stderr"]) is expected_debug+ assert "CHILD_INFO" in output["child_stderr"]diff --git a/tests/unittest/test_kit_gradio.py b/tests/unittest/test_kit_gradio.pyindex e4332f92..2b80915b 100644--- a/tests/unittest/test_kit_gradio.py+++ b/tests/unittest/test_kit_gradio.py@@ -1125,6 +1125,11 @@ def test_build_gradio_app_exposes_html_tab_and_download_menu(tmp_path: Path) ->range_group = next(block for block in app.blocks.values() if "mineru-kit-page-range" in (block.elem_classes or []))assert range_group.visible is Trueassert '[data-range-visible="true"]' in app._mineru_kit_css+ # 窄屏媒体查询必须给结果区固定高度并按内容收口:既避免移动端 flex 链断裂时+ # iframe 塌陷,也避免拉伸高度与固定高度不一致在卡片底部留下死区。+ assert ".mineru-kit-results .mineru-markdown-output,\n .mineru-kit-results .mineru-structured-json" in app._mineru_kit_css+ assert ".mineru-kit-results { min-height: 0; flex: 0 0 auto !important; }" in app._mineru_kit_css+ assert "flex: 0 0 auto !important;" in app._mineru_kit_cssassert sum(1 for dependency in app.config["dependencies"] if dependency.get("queue") is True) >= 7