修复冻结积分BUG | 拆镜状态异常BUG

This commit is contained in:
2026-07-24 14:00:37 +08:00
parent 357657d7cd
commit 4685b475af
22 changed files with 2159 additions and 733 deletions
+10 -8
View File
@@ -18,6 +18,7 @@ from app.enums.credit_record import (
CreditRecordBillingScene,
CreditRecordChargeKind,
CreditRecordOwnerType,
CreditRecordSourceStepCode,
)
from app.enums.llm_billing import LlmBillingConfigKey
from app.enums.shot_replicate import (
@@ -274,7 +275,7 @@ def _analysis_dispatch_billing_context(
source_module=MODULE,
source_project_id=task_set_id,
source_step_id=owner_id,
source_step_code=ShotReplicateStepCodeEnum.VIDEO_ANALYSIS.value,
source_step_code=CreditRecordSourceStepCode.VIDEO_ANALYSIS.value,
related_id=owner_id,
hold_config_key=LlmBillingConfigKey.HOLD_SHOT_VIDEO_ANALYSIS.value,
description_prefix=(
@@ -569,7 +570,7 @@ async def create_shot_task_set(
from app.tasks.shot_replicate_tasks import analyze_original_video
analyze_original_video.apply_async(
args=[task_set_id],
args=[task_set_id, analysis_attempt_no],
queue=CeleryQueue.GEN_SHOT_ANALYSIS.value,
countdown=0,
task_id=celery_task_id,
@@ -590,6 +591,7 @@ async def create_shot_task_set(
db,
current_user=_user_context(current_user),
task_set_id=task_set_id,
expected_attempt_no=analysis_attempt_no,
error_message=f"拆镜分析任务投递失败: {exc}",
)
await db.commit()
@@ -672,7 +674,7 @@ async def get_shot_task_set(
"/task-sets/{task_set_id}/reanalyze",
response_model=ShotReanalyzeOut,
summary="重新投递原视频 AI 分析任务",
description="用于处理原视频分析失败或待处理的异常数据;重置分析状态后重新投递 analyze_original_video",
description="用于重新处理原视频分析失败的数据;处理中、待处理或已完成状态均拒绝重复投递",
)
async def reanalyze_task_set(
task_set_id: str = Path(..., description="拆镜总任务集ID,即 shot_replicate_task_sets.id"),
@@ -686,7 +688,6 @@ async def reanalyze_task_set(
db,
current_user=current_user,
task_set_id=task_set_id,
force=req.force,
reason=req.reason,
)
analysis_attempt_no = int(out.analysis_attempt_no)
@@ -729,7 +730,7 @@ async def reanalyze_task_set(
from app.tasks.shot_replicate_tasks import analyze_original_video
analyze_original_video.apply_async(
args=[task_set_id],
args=[task_set_id, analysis_attempt_no],
queue=CeleryQueue.GEN_SHOT_ANALYSIS.value,
countdown=0,
task_id=celery_task_id,
@@ -758,6 +759,7 @@ async def reanalyze_task_set(
db,
current_user=_user_context(current_user),
task_set_id=task_set_id,
expected_attempt_no=analysis_attempt_no,
error_message=f"原视频再次分析任务投递失败: {exc}",
)
await db.commit()
@@ -923,7 +925,7 @@ async def get_segment(
"/segments/{segment_id}/reanalyze",
response_model=ShotReanalyzeOut,
summary="重新投递切片视频 AI 分析任务",
description="用于处理自定义切片视频分析失败或待处理的异常数据;重置分析状态后重新投递 analyze_custom_segment_video",
description="用于重新处理自定义切片视频分析失败的数据;处理中、待处理或已完成状态均拒绝重复投递",
)
async def reanalyze_segment(
segment_id: str = Path(..., description="拆镜片段ID,即 shot_replicate_segments.id"),
@@ -937,7 +939,6 @@ async def reanalyze_segment(
db,
current_user=current_user,
segment_id=segment_id,
force=req.force,
reason=req.reason,
)
task_set_id = str(out.task_set_id)
@@ -981,7 +982,7 @@ async def reanalyze_segment(
from app.tasks.shot_replicate_tasks import analyze_custom_segment_video
analyze_custom_segment_video.apply_async(
args=[segment_id],
args=[segment_id, analysis_attempt_no],
queue=CeleryQueue.GEN_SHOT_ANALYSIS.value,
countdown=0,
task_id=celery_task_id,
@@ -1012,6 +1013,7 @@ async def reanalyze_segment(
db,
current_user=_user_context(current_user),
segment_id=segment_id,
expected_attempt_no=analysis_attempt_no,
error_message=f"切片视频再次分析任务投递失败: {exc}",
)
await db.commit()