From 3f1c4063b00bdb42eb70edf26e008ce640125c97 Mon Sep 17 00:00:00 2001 From: wwwwwwwww <526125649@qq.com> Date: Wed, 22 Jul 2026 14:33:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=82image=5Fbatch=5Fserv?= =?UTF-8?q?ice.py=20=E4=B8=AD=E7=9A=84=20claim.task=5Fsnapshot=20=E6=98=AF?= =?UTF-8?q?=20SimpleNamespace=EF=BC=88ChatGenerationTask=20=E7=9A=84?= =?UTF-8?q?=E5=BF=AB=E7=85=A7=EF=BC=89=EF=BC=8C=E4=BC=A0=E7=BB=99=20owner?= =?UTF-8?q?=5Finclude=5Fmedia=5Freferences()=20=E6=97=B6=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=8C=B9=E9=85=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/services/generation/pipeline/owner_service.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/video-gen-api/app/services/generation/pipeline/owner_service.py b/video-gen-api/app/services/generation/pipeline/owner_service.py index 14d805bc..3f4330fd 100644 --- a/video-gen-api/app/services/generation/pipeline/owner_service.py +++ b/video-gen-api/app/services/generation/pipeline/owner_service.py @@ -55,6 +55,11 @@ def owner_type_of(owner: GenerationOwner) -> str: return GenerationOwnerType.CHAT_GENERATION_TASK.value if isinstance(owner, GenerationRecord): return GenerationOwnerType.GENERATION_RECORD.value + # 兼容 SimpleNamespace 快照(如 image_batch 的 task_snapshot) + if hasattr(owner, 'generation_mode'): + return GenerationOwnerType.CHAT_GENERATION_TASK.value + if hasattr(owner, 'include_media_references'): + return GenerationOwnerType.GENERATION_RECORD.value raise TypeError(f"不支持的生成任务对象: {type(owner)!r}") @@ -67,6 +72,11 @@ def owner_include_media_references(owner: GenerationOwner) -> bool: return True if isinstance(owner, GenerationRecord): return bool(owner.include_media_references) + # 兼容 SimpleNamespace 快照(如 image_batch 的 task_snapshot) + if hasattr(owner, 'generation_mode'): + return True + if hasattr(owner, 'include_media_references'): + return bool(owner.include_media_references) raise TypeError(f"不支持的生成任务对象: {type(owner)!r}")