refactor: let excel use lazy image loader (#13558)

### What problem does this PR solve?

let excel use lazy image loader

### Type of change

- [x] Refactoring

---------

Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
This commit is contained in:
Stephen Hu
2026-03-23 21:24:40 +08:00
committed by GitHub
parent f991cd362e
commit d32967eda8
7 changed files with 25 additions and 23 deletions

View File

@@ -1212,18 +1212,17 @@ def docx_question_level(p, bull=-1):
def concat_img(img1, img2):
from rag.utils.lazy_image import ensure_pil_image, LazyDocxImage
from rag.utils.lazy_image import ensure_pil_image, LazyImage
# Fast path: preserve laziness when both sides are LazyDocxImage or None.
if (img1 is None or isinstance(img1, LazyDocxImage)) and \
(img2 is None or isinstance(img2, LazyDocxImage)):
if (img1 is None or isinstance(img1, LazyImage)) and \
(img2 is None or isinstance(img2, LazyImage)):
if img1 and not img2:
return img1
if not img1 and img2:
return img2
if not img1 and not img2:
return None
return LazyDocxImage.merge(img1, img2)
return LazyImage.merge(img1, img2)
img1 = ensure_pil_image(img1) or img1
img2 = ensure_pil_image(img2) or img2