From 627d2a4701c13144a03eba9e4ff37ae107b501c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A1=E9=B8=A695676?= Date: Sun, 30 Mar 2025 22:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=8D=E8=AF=95=E9=97=B4?= =?UTF-8?q?=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/provider/sources/openai_source.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 68d0bd6c0..32860826d 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -200,6 +200,9 @@ class ProviderOpenAIOfficial(Provider): logger.warning( f"API 调用过于频繁,尝试使用其他 Key 重试。当前 Key: {chosen_key[:12]}" ) + # 最后一次不等待 + if retry_cnt < max_retries - 1: + await asyncio.sleep(1) available_api_keys.remove(chosen_key) if len(available_api_keys) > 0: chosen_key = random.choice(available_api_keys)