From dea14c1d8ab525e72427242070d806cafc21b658 Mon Sep 17 00:00:00 2001 From: HYY1116 Date: Tue, 11 Mar 2025 18:21:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A8=A1=E5=9E=8B=E9=99=8D=E7=BA=A7?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E5=8F=AA=E5=AF=B9=E7=A1=85=E5=9F=BA=E6=B5=81?= =?UTF-8?q?=E5=8A=A8=E7=9A=84V3=E5=92=8CR1=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/models/utils_model.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/models/utils_model.py b/src/plugins/models/utils_model.py index c6ed6b619..e9d11f339 100644 --- a/src/plugins/models/utils_model.py +++ b/src/plugins/models/utils_model.py @@ -184,9 +184,9 @@ class LLM_request: elif response.status in policy["abort_codes"]: logger.error(f"错误码: {response.status} - {error_code_mapping.get(response.status)}") if response.status == 403: - # 尝试降级Pro模型 - if self.model_name.startswith( - "Pro/") and self.base_url == "https://api.siliconflow.cn/v1/": + #只针对硅基流动的V3和R1进行降级处理 + if self.model_name.startswith( + "Pro/deepseek-ai") and self.base_url == "https://api.siliconflow.cn/v1/": old_model_name = self.model_name self.model_name = self.model_name[4:] # 移除"Pro/"前缀 logger.warning(f"检测到403错误,模型从 {old_model_name} 降级为 {self.model_name}") @@ -195,7 +195,12 @@ class LLM_request: if hasattr(global_config, 'llm_normal') and global_config.llm_normal.get( 'name') == old_model_name: global_config.llm_normal['name'] = self.model_name - logger.warning("已将全局配置中的 llm_normal 模型降级") + logger.warning(f"将全局配置中的 llm_normal 模型临时降级至{self.model_name}") + + if hasattr(global_config, 'llm_reasoning') and global_config.llm_reasoning.get( + 'name') == old_model_name: + global_config.llm_reasoning['name'] = self.model_name + logger.warning(f"将全局配置中的 llm_reasoning 模型临时降级至{self.model_name}") # 更新payload中的模型名 if payload and 'model' in payload: