-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Fix: the pict type picture was not processed in the docx #19305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
crazywoola
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not modify the PR template, and link an existing issue in the desciption.
The comments have been modified to English, and there are no entries in the issue that exist. This modification is relatively simple. It is to add support for pict type images when processing docx. |
|
Please fix the lint errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances parse_paragraph to correctly extract VML-based pict images and prevents duplicate processing when both drawing and pict tags are present.
- Introduce a
has_drawingflag to skip pict extraction if a drawing has already been processed - Add handling for
<w:pict>shapes by looking upbinDataand VMLimagedatarelationships - Ensure pict images are appended only when they exist in
image_map
Comments suppressed due to low confidence (2)
api/core/rag/extractor/word_extractor.py:261
- No tests appear to cover VML-based pict extraction. Add a unit test with a
.docxcontaining a<w:pict>shape to ensure this code path is exercised.
shape_elements = run.element.findall(
api/core/rag/extractor/word_extractor.py:266
- Verify that the
{http://schemas.openxmlformats.org/wordprocessingml/2006/main}binDatanamespace is correct for VML pict elements—in some docsbinDatamay reside in a different namespace or part.
shape_image = shape.find(
…19305) Co-authored-by: zqgame <[email protected]>
Summary
Fix: the pict type picture was not processed in the docx