chore: update image_id handling and content replacement in zip_parse_qa_handle - #6525
Merged
Conversation
Contributor
Author
|
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information |
There was a problem hiding this comment.
Pull request overview
This PR updates the ZIP QA parsing flow to adjust how embedded oss/file/* and oss/image/* references are handled when collecting images from parsed paragraphs, and to ensure paragraph content is rewritten to point at the generated OSS file path.
Changes:
- Updates the
oss/file/*/oss/image/*handling insideget_image_list()to use the generatednew_image_idand rewrite paragraph content accordingly. - Ensures content replacement occurs for UUID-looking IDs as well (not only the non-UUID branch).
Comments suppressed due to low confidence (1)
apps/common/handle/impl/qa/zip_parse_qa_handle.py:101
- The
is_valid_uuid(image_id)branch is now behaviorally identical to theelsebranch (both appendnew_image_idand replace the content). This makes the UUID extraction/check dead code and adds unnecessary complexity in this hot path.
Consider collapsing the conditional and doing the append/content replacement unconditionally here to keep the logic easier to follow.
if image_path.startswith('oss/file/') or image_path.startswith('oss/image/'):
image_id = image_path.replace('oss/file/', '').replace('oss/image/', '')
if is_valid_uuid(image_id):
image_file_list.append({"source_file": image_path, "image_id": new_image_id})
content = content.replace(source_path, f"./oss/file/{new_image_id}")
p['content'] = content
else:
image_file_list.append({'source_file': image_path, 'image_id': new_image_id})
content = content.replace(source_path, f'./oss/file/{new_image_id}')
p['content'] = content
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
chore: update image_id handling and content replacement in zip_parse_qa_handle