diff --git a/apps/worker/worker_app/tasks/viral_video.py b/apps/worker/worker_app/tasks/viral_video.py index 7c70794ff..a5d2fb6da 100644 --- a/apps/worker/worker_app/tasks/viral_video.py +++ b/apps/worker/worker_app/tasks/viral_video.py @@ -281,7 +281,10 @@ def _analyze_single_image( logger.warning( "[爆款视频] 图片 #%d VLM(%s) 结果不可用 name=%r summary_len=%d,尝试 pro 降级", - idx, vision_model, first_result.get("name"), len(first_result.get("summary") or ""), + idx, + vision_model, + first_result.get("name"), + len(first_result.get("summary") or ""), ) # 第二次:pro 降级重试 @@ -293,7 +296,9 @@ def _analyze_single_image( return pro_result logger.warning( "[爆款视频] 图片 #%d pro 降级仍不可用 name=%r summary_len=%d", - idx, pro_result.get("name"), len(pro_result.get("summary") or ""), + idx, + pro_result.get("name"), + len(pro_result.get("summary") or ""), ) return pro_result @@ -332,11 +337,17 @@ def _step_image_analysis(job: ViralVideoJob) -> dict: max_workers = min(4, max(1, len(job.images))) logger.info( "[爆款视频] 开始并行图片分析 n=%d model=%s pro_fallback=%s timeout=%d workers=%d", - len(job.images), vision_model, pro_model, vision_timeout, max_workers, + len(job.images), + vision_model, + pro_model, + vision_timeout, + max_workers, ) with ThreadPoolExecutor(max_workers=max_workers) as pool: future_to_idx = { - pool.submit(_analyze_single_image, idx, url, vision_model, vision_timeout, pro_fallback_model=pro_model): idx + pool.submit( + _analyze_single_image, idx, url, vision_model, vision_timeout, pro_fallback_model=pro_model + ): idx for idx, url in enumerate(job.images) } for fut in as_completed(future_to_idx):