mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 20:01:04 +00:00
[v4.10.7] - ✨ 被禁言避免触发分析功能浪费 token,重构并优化模型请求的重试与降级补偿机制
This commit is contained in:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user