添加全能创作功能

This commit is contained in:
Azmat@qq.com
2026-09-03 13:11:46 +08:00
parent 22ed2833ad
commit 6a628b0ca7
53 changed files with 9115 additions and 108 deletions
+9
View File
@@ -959,6 +959,9 @@ def finalize_free_video(*, task: AITask) -> AITask:
)
release_credit(reservation=locked.credit_reservation, reason=raw_message[:200])
_notify_failure(locked, raw=f"[{code}] {raw_message}", hint=public_error.fallback_message)
from apps.ai.creation import sync_generating_for_task
sync_generating_for_task(locked)
return locked
# succeeded —— 认领 POSTPROCESSING(并发 finalize 只有一路进入慢活)
@@ -1025,6 +1028,9 @@ def finalize_free_video(*, task: AITask) -> AITask:
update_fields=["status", "actual_cost", "base_cost", "request_payload", "response_payload", "completed_at", "updated_at"]
)
charge_reserved_credit(reservation=reservation, actual_amount=actual)
from apps.ai.creation import sync_generating_for_task
sync_generating_for_task(locked)
return locked
except Exception as exc: # noqa: BLE001 — 后处理失败:标失败退费(release 幂等,已扣则不动)
logger.exception("free video finalize failed for task %s", locked.id)
@@ -1045,6 +1051,9 @@ def finalize_free_video(*, task: AITask) -> AITask:
locked.save(update_fields=["status", "error_code", "error_message", "completed_at", "updated_at"])
release_credit(reservation=locked.credit_reservation, reason=str(exc)[:200])
_notify_failure(locked, raw=str(exc), hint=public_error.fallback_message)
from apps.ai.creation import sync_generating_for_task
sync_generating_for_task(locked)
return locked