From 141fd9451367e7c08f2b922fb6a580e303c16be2 Mon Sep 17 00:00:00 2001 From: Timebomb2018 <18868801967@163.com> Date: Fri, 24 Apr 2026 19:40:57 +0800 Subject: [PATCH] fix(multimodal_service): refactor image processing to use intermediate list before extending result --- api/app/services/multimodal_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/app/services/multimodal_service.py b/api/app/services/multimodal_service.py index 960bf6bb..08a33a48 100644 --- a/api/app/services/multimodal_service.py +++ b/api/app/services/multimodal_service.py @@ -388,6 +388,7 @@ class MultimodalService: from app.models.workspace_model import Workspace as WorkspaceModel ws = self.db.query(WorkspaceModel).filter(WorkspaceModel.id == workspace_id).first() tenant_id = ws.tenant_id if ws else None + img_result = [] for img_info in img_infos: page = img_info["page"] index = img_info["index"] @@ -407,9 +408,10 @@ class MultimodalService: file_type="image/png", ) _, img_content = await self._process_image(img_file, strategy_class(img_file)) - result.append(img_content) + img_result.append(img_content) except Exception as img_err: logger.warning(f"文档图片处理失败: {img_err}") + result.extend(img_result) elif file.type == FileType.AUDIO and "audio" in self.capability: is_support, content = await self._process_audio(file, strategy) result.append(content)