fix(docreader): make DOCX header extraction optional - #3914
Open
helloxjade wants to merge 1 commit into
Open
helloxjade wants to merge 1 commit into
helloxjade wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DOCX parsing currently returns only body content, so text that appears in a document header cannot be retrieved. Add an opt-in
docx_include_headersparser rule for the builtin and MarkItDown engines, exposed in knowledge-base parser settings and the upload confirmation dialog. The default remains disabled.When enabled, parsing prepends header text and tables, includes active first-page and even-page headers, and extracts inherited header parts only once. The python-docx fallback also honors the option. The option covers text and tables; header images and external AnyDoc processing are outside its supported extraction behavior.
Type of Change
Related Issue
Fixes #3849
Testing
python -m unittest docreader.tests.test_docx_headers docreader.tests.test_docx_tables docreader.tests.test_docx_merge -q— 25 tests passed.go test ./internal/application/service -run 'TestApplyParserRuleOverrides|TestResolveProcessConfig' -count=1— passed.npm test -- src/views/knowledge/settings/KBParserSettings.test.ts src/views/knowledge/components/UploadConfirmDialog.test.ts src/i18n/localeKeyAudit.test.ts— 22 tests passed.npm run type-checkandnpm run build— passed.docx_include_headers: true.git diff --check upstream/main...HEAD— passed (upstream is Tencent/WeKnora).golangci-lint run --new-from-rev=upstream/main ./...could not run becausegolangci-lintis not installed. The full-repository maintainer gate was not run; validation was scoped to the changed components.Checklist
Screenshots / Recordings
Actual
KBParserSettingscomponent, rendered with fixture parser engines: