This commit is contained in:
sjy
2026-07-22 14:34:47 +08:00
@@ -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}")