WMK666666 opened a new pull request, #29594:
URL: https://github.com/apache/camel/pull/29594
`outputFormat` documents six values — `md`, `json`, `html`,
`html_split_page`, `text`, `doctags` — but the
three maps that translate it into something the engine understands each knew
a different subset, and
`doctags` was in none of the ones that matter.
### What went wrong
1. **`DoclingContentExtractor.mapOutputFormat` had no `doctags` case.**
docling-serve only fills the fields
of the formats that were requested, so a DocTags conversion returns
`doctags_content` and no
`md_content` at all. The missing case sent it to the markdown branch,
which found no markdown and
returned `""`: the exchange succeeded with an empty body. The same
extractor is used by
`DoclingConsumer` when an async task completes, so async conversions were
empty too.
2. **`mapToDoclingFormat`, which builds the CLI command, had neither
`doctags` nor `txt`.** For
`outputFormat=doctags` it ran `docling convert --to md`, so the requested
format was replaced by
markdown; for `outputFormat=txt` likewise.
3. **`getOutputFileExtension` had no `doctags` (and no `txt`) case**, so the
expected output name was
computed with the `md` extension.
`txt` and `text` are both accepted by the extractor and by
`getOutputFileExtension`, so the spellings the
component understands are `markdown`/`md`, `html`, `json`, `text`/`txt` and
`doctags`. Every map now knows
all of them.
`html_split_page` is deliberately left as it is: it is an HTML variant
rather than a format of its own, and
no map ever selected it.
### Tests
- `DoclingContentExtractorTest` builds responses the way docling-serve does
— only the requested format's
field filled in — and asserts `doctags` returns the DocTags content, that
`DOCTAGS` is accepted, that a
response without DocTags gives an empty body rather than the markdown, and
that the formats that already
worked still return their own content.
- `DoclingOutputFormatTest` asserts the `--to` argument built for each
documented value.
Both were checked by reverting each half of the change: removing the
extractor case fails the three
DocTags assertions, removing the CLI cases fails `doctags`, `DOCTAGS` and
`txt`, and the "already worked"
guards stay green in both runs.
`mvn -pl components/camel-ai/camel-docling test`: 94 tests, 2 failures, both
`DoclingCustomArgsValidationTest` on Windows (`/etc/cron.d` is not an
absolute path there), which fail the
same way without this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]