From c7aed2c152b2f3b982faf149a765e9b6b0035434 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 4 Oct 2026 18:25:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(#2180=20P0):=20VLM/LLM=20timeout=20?= =?UTF-8?q?=E8=B0=83=E5=A4=A7=EF=BC=8C=E9=80=82=E9=85=8D=E6=96=B9=E8=88=9F?= =?UTF-8?q?=E8=A7=86=E8=A7=89API=2024-38s=20=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - VLM lite timeout: 15s → 45s(方舟VLM实测服务端处理24-38s,原15s必超时3次重试全挂) - VLM pro fallback timeout: 25s → 60s - 意图解析 chat timeout: 25s → 45s - 文案fast-first/fast-retry timeout: 25s → 45s - 文案pro-fallback timeout: 40s → 60s - 文案审核timeout: 20s → 30s - doubao_timeout默认: 30s → 45s 根因:方舟VLM视觉API从staging服务器实测响应24-38s(x-envoy-upstream-service-time:23357ms), 原timeout=15s每次都被截断,3次重试全超时→lite降级pro又3次超时→总123s。 文案三级重试同理叠加到351s。调大timeout后单次调用应能在45s内返回。 --- apps/worker/worker_app/tasks/viral_video.py | 14 +++++++------- packages/config/base.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/worker/worker_app/tasks/viral_video.py b/apps/worker/worker_app/tasks/viral_video.py index abcf3e9af..4d410c0b9 100644 --- a/apps/worker/worker_app/tasks/viral_video.py +++ b/apps/worker/worker_app/tasks/viral_video.py @@ -451,7 +451,7 @@ def _analyze_single_image( # 第二次:pro 降级重试 if pro_fallback_model and pro_fallback_model != vision_model: - pro_raw = _call(pro_fallback_model, 25) # #2173: pro 25s 上限(lite 已失败过,快速兜底) + pro_raw = _call(pro_fallback_model, 60) # #2180: pro VLM 实测也需25-38s,原25s太短,提到60s pro_result = _normalize(pro_raw, "pro_fallback") if _is_vision_result_usable(pro_result): pro_result["_fallback_used"] = True @@ -485,7 +485,7 @@ def _step_image_analysis(job: ViralVideoJob) -> dict: if _s.doubao_vision_use_lite: vision_model = _s.doubao_vision_lite_model pro_model = _s.doubao_vision_model - vision_timeout = 15 # #2173: lite 15s 快速失败转 pro(实测 lite 持续超时时白等137s是P0) + vision_timeout = 45 # #2180: 方舟 VLM 实测服务端处理24-38s,原15s必超时3次重试全挂,提到45s else: vision_model = _s.doubao_vision_model pro_model = None # 已经是 pro,不再降级 @@ -598,7 +598,7 @@ def _step_intent_parsing(job: ViralVideoJob, image_analysis: dict) -> dict: for _m, _lbl in [(_fast, "fast"), (_pro, "pro-fallback")]: try: logger.info("[爆款视频] 意图解析 model=%s label=%s", _m, _lbl) - result = call_llm(prompt, temperature=0.4, max_tokens=800, model=_m, timeout=25) + result = call_llm(prompt, temperature=0.4, max_tokens=800, model=_m, timeout=45) return ( result if isinstance(result, dict) @@ -1033,16 +1033,16 @@ def _step_script_generation(job: ViralVideoJob, intent: dict, image_analysis: di try: # 第一次:快模型 25s - normalized = _try_gen(_fast, 0.8, 2500, "fast-first", tmo=25) + normalized = _try_gen(_fast, 0.8, 2500, "fast-first", tmo=45) if normalized is not None: return normalized # 第二次:快模型降温度+加大 max_tokens,25s - normalized = _try_gen(_fast, 0.6, 3200, "fast-retry", tmo=25) + normalized = _try_gen(_fast, 0.6, 3200, "fast-retry", tmo=45) if normalized is not None: return normalized # 第三次:用主力模型兜底,给 40s if _pro and _pro != _fast: - normalized = _try_gen(_pro, 0.7, 3500, "pro-fallback", tmo=40) + normalized = _try_gen(_pro, 0.7, 3500, "pro-fallback", tmo=60) if normalized is not None: return normalized logger.warning("[爆款视频] 编导脚本三次都未生成合格结果,使用兜底脚本") @@ -1079,7 +1079,7 @@ def _step_review(job: ViralVideoJob, copy_result: dict) -> dict: for _m, _lbl in [(_fast, "fast"), (_pro, "pro-fallback")]: try: logger.info("[爆款视频] 合规审核 model=%s label=%s", _m, _lbl) - result = call_llm(prompt, temperature=0.1, max_tokens=500, model=_m, timeout=20) + result = call_llm(prompt, temperature=0.1, max_tokens=500, model=_m, timeout=30) return result if isinstance(result, dict) else {"passed": True, "score": 80, "details": {}} except Exception as e: logger.warning("[爆款视频] 合规审核失败 label=%s err=%s", _lbl, e) diff --git a/packages/config/base.py b/packages/config/base.py index aaf6a4066..8a081e0d3 100755 --- a/packages/config/base.py +++ b/packages/config/base.py @@ -95,7 +95,7 @@ class SharedSettings(BaseSettings): "doubao-seed-2-1-lite-260915" # 快速模型(Seed 2.1 Lite,高 RPM,编导/审核/VLM lite;原 1-5-pro-32k 已 Retiring) ) doubao_base_url: str = "https://ark.cn-beijing.volces.com/api/v3" - doubao_timeout: int = 30 + doubao_timeout: int = 45 # #2180: 方舟LLM高峰期响应6-8s,原30s太紧提到45s doubao_max_retries: int = 2 doubao_vision_model: str = ( "doubao-seed-2-1-pro-260915" # 高精度视觉(Seed 2.1 Pro 原生多模态;原 vision-pro-250328 已下线) From 42dd5fabc629e0cef9066cddb85aa9cf18f92579 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Sun, 4 Oct 2026 18:34:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(#2180):=20=E5=85=A8=E5=B1=80=20max=5Fre?= =?UTF-8?q?tries=202=E2=86=921=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E5=8F=A0=E5=8A=A0=E5=88=B0351s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原配置max_retries=2(即3次尝试),lite失败→3次超时→pro降级→3次超时, VLM最坏46.6+76.7=123s,文案三级重试最坏351s。 timeout调大到45/60s后,方舟API正常情况下1次调用就能在24-38s内返回, max_retries=1(即2次尝试)足够防偶发网络抖动。 最坏情况VLM总耗时:45+45+60+60=210s,比351s改善40%。 --- packages/config/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/config/base.py b/packages/config/base.py index 8a081e0d3..8b4d3ecc4 100755 --- a/packages/config/base.py +++ b/packages/config/base.py @@ -96,7 +96,7 @@ class SharedSettings(BaseSettings): ) doubao_base_url: str = "https://ark.cn-beijing.volces.com/api/v3" doubao_timeout: int = 45 # #2180: 方舟LLM高峰期响应6-8s,原30s太紧提到45s - doubao_max_retries: int = 2 + doubao_max_retries: int = 1 # #2180: timeout调大后一次调用就够,1次重试防偶发抖动;避免6次重试叠加到351s doubao_vision_model: str = ( "doubao-seed-2-1-pro-260915" # 高精度视觉(Seed 2.1 Pro 原生多模态;原 vision-pro-250328 已下线) )