[v4.10.7] - 被禁言避免触发分析功能浪费 token,重构并优化模型请求的重试与降级补偿机制

This commit is contained in:
SXP-Simon
2026-07-10 15:34:13 +08:00
parent 24db140382
commit 3979a30787
6 changed files with 32 additions and 9 deletions
@@ -376,11 +376,13 @@ async def call_provider_with_retry(
fallback_provider_id = await get_provider_id_with_fallback(
context, config_manager, None, umo
)
if fallback_provider_id and fallback_provider_id != specific_provider_id:
if (
fallback_provider_id
and fallback_provider_id != specific_provider_id
):
for _ in range(retries):
attempt_queue.append((fallback_provider_id, True))
is_last_attempt = i == len(attempt_queue) - 1
if not is_last_attempt:
# Exponential backoff with jitter: backoff * (2 ^ (attempt_num - 1)) + random jitter
@@ -1008,7 +1008,9 @@ class OneBotAdapter(PlatformAdapter):
if not e:
return False
err_str = str(e)
if "1200" in err_str and ("禁言" in err_str or "操作失败" in err_str or "下游群鉴权" in err_str):
if "1200" in err_str and (
"禁言" in err_str or "操作失败" in err_str or "下游群鉴权" in err_str
):
return True
err_msg = getattr(e, "message", "") or ""
err_word = getattr(e, "wording", "") or ""