Skip to content

fix: keep image blocks when no Visual model configured#11

Merged
superdd-coder merged 1 commit into
mainfrom
fix/image-block-keep-without-visual
Jul 9, 2026
Merged

fix: keep image blocks when no Visual model configured#11
superdd-coder merged 1 commit into
mainfrom
fix/image-block-keep-without-visual

Conversation

@superdd-coder

Copy link
Copy Markdown
Owner

问题

在 ingest 文件时,如果没有配置 Visual model,process_document_images 会把所有 mixed/visual 类型的 image block 从文档内容中删除,导致图片完全丢失。

修复

  • src/parsers/image_utils.py:
    1. 「删除描述失败的 image block」逻辑加 if vision_provider and vision_model_id: 守卫,只在真正尝试过 Vision LLM 时才移除失败的 block
    2. 没有 Visual model 时,不再删除 mixed/visual image block,保留在内容中(有 OCR 文本的保留 OCR,只是没有 description)
  • tests/e2e_image_pipeline.py: 更新测试断言匹配新行为

效果

  • ✅ 无 Visual model → image block 保留,图片可被检索
  • ✅ 有 Visual model → 行为不变

@superdd-coder
superdd-coder merged commit 51ba21c into main Jul 9, 2026
4 of 6 checks passed
@superdd-coder
superdd-coder deleted the fix/image-block-keep-without-visual branch July 10, 2026 08:18
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.

1 participant