fix: fall back from empty Docling native chunks (#15601)

## Summary
- keep the native Docling chunking path when it returns usable chunks
- fall back to the standard Docling response parser when a chunked
request gets HTTP 200 but returns no usable chunks
- add a regression test for older Docling servers that accept the
chunking request but return a standard conversion payload

## Why
Older external Docling servers can accept a request containing
`do_chunking: true` and still return the standard conversion response
shape. The current code treats any HTTP 200 from the chunked request as
a native chunk response, finds no chunk entries, and returns zero
sections without trying the standard response parser.

Fixes #15569.

## Validation
- `python -m pytest
test\\unit_test\\deepdoc\\parser\\test_docling_parser_remote.py -q`
- `python -m py_compile deepdoc\\parser\\docling_parser.py
test\\unit_test\\deepdoc\\parser\\test_docling_parser_remote.py`
- `python -m ruff check deepdoc\\parser\\docling_parser.py
test\\unit_test\\deepdoc\\parser\\test_docling_parser_remote.py`
- `git diff --check`
This commit is contained in:
Yufeng He
2026-06-04 13:42:58 +08:00
committed by GitHub
parent 01a5598aa5
commit 5db1b296fb
2 changed files with 80 additions and 1 deletions

View File

@@ -477,7 +477,10 @@ class DoclingParser(RAGFlowPdfParser):
if callback:
callback(0.95, f"[Docling] Native chunks received: {len(sections)}")
return sections, tables
if sections:
return sections, tables
self.logger.warning("[Docling] Native chunking returned no usable chunks; trying standard response parsing.")
# --- FALLBACK: Standard RAGFlow parsing for older docling servers ---
docs = self._extract_remote_document_entries(response_json)