视频复刻积分规则优化

This commit is contained in:
Azmat@qq.com
2026-09-04 17:51:16 +08:00
parent 15718a60bf
commit ee3ddb49b4
8 changed files with 132 additions and 21 deletions
+20 -2
View File
@@ -914,7 +914,7 @@ def start_replace_generation(task):
def run_replace_digest(task) -> None:
"""Worker:参考视频 → 提炼页同款分镜稿 → 一次交给 Seedance。不传原片。
商品和角色共用。这一步失败 = 整条复刻失败。此时还没预留视频积分,不扣费
商品和角色共用。这一步失败 = 整条复刻失败、不扣费。成功后由 start_pending_free_video 按「Gemini 挂牌 + Seedance 挂牌」一并预留
"""
from apps.ai.video_digest import VideoDigestError, digest_asset_video
@@ -1576,6 +1576,7 @@ def _create_reviewing_task(*, team, user, params: dict, digest_pending: bool = F
references = params.get("references") or []
billing_duration = int(extra.get("billing_duration") or duration)
billing_ratio = str(extra.get("billing_aspect_ratio") or aspect_ratio)
# 商品复刻:原片不进 Seedance 引用 → 按无视频引用秒价;角色复刻 references 含视频 → 含引用秒价
tokens, quote = quote_video_estimate(
model_config,
aspect_ratio=billing_ratio,
@@ -1585,6 +1586,20 @@ def _create_reviewing_task(*, team, user, params: dict, digest_pending: bool = F
team=team,
)
reserve_amount = video_reserve_amount(quote.points, rule=quote.meta.get("rule"))
# 商品复刻另加 Gemini 提炼挂牌(points_per_call;未挂牌回落 30)
digest_points = Decimal("0")
digest_model_name = ""
if digest_pending:
from apps.ai.video_digest import resolve_digest_model_config
from apps.billing.pricing import quote_video_digest
digest_model = resolve_digest_model_config()
if digest_model is None:
raise ValueError("视频提炼模型未配置,请联系管理员")
digest_quote = quote_video_digest(team=team, model_config=digest_model)
digest_points = Decimal(digest_quote.points)
digest_model_name = str(digest_model.name or "")
reserve_amount = reserve_amount + digest_points
account = CreditAccount.objects.filter(team=team).first()
available = (account.balance - account.reserved_balance) if account else Decimal("0")
if available < reserve_amount:
@@ -1615,6 +1630,9 @@ def _create_reviewing_task(*, team, user, params: dict, digest_pending: bool = F
"model_routing_v1": True,
"review_pending": True,
"digest_pending": digest_pending,
# 复刻内拆镜挂牌;start_pending_free_video / settle 会加回预留与实扣
"digest_points": str(digest_points),
"digest_model": digest_model_name,
}
for key, value in extra.items():
if key in request_payload or value in (None, ""):
@@ -1630,7 +1648,7 @@ def _create_reviewing_task(*, team, user, params: dict, digest_pending: bool = F
model_config=model_config,
idempotency_key=f"free_video:{team.id}:{uuid.uuid4()}",
request_payload=request_payload,
estimated_cost=quote.points,
estimated_cost=quote.points + digest_points,
base_cost=Decimal("0"),
)
if digest_pending: