Skip to content

chore: update image_id handling and content replacement in zip_parse_qa_handle - #6525

Merged
liuruibin merged 1 commit into
v2from
pr@v2@fix_update_image_id
Jul 28, 2026
Merged

chore: update image_id handling and content replacement in zip_parse_qa_handle#6525
liuruibin merged 1 commit into
v2from
pr@v2@fix_update_image_id

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

chore: update image_id handling and content replacement in zip_parse_qa_handle

Copilot AI review requested due to automatic review settings July 28, 2026 02:22
@shaohuzhang1

Copy link
Copy Markdown
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

Copilot AI left a comment

Copy link
Copy Markdown

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 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 inside get_image_list() to use the generated new_image_id and 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 the else branch (both append new_image_id and 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.

@liuruibin
liuruibin merged commit e1ee3ef into v2 Jul 28, 2026
5 of 7 checks passed
@liuruibin
liuruibin deleted the pr@v2@fix_update_image_id branch July 28, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants