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}")