From 8ba4fb60c6ced7d549ff3d9cf25c0b2b56131aa1 Mon Sep 17 00:00:00 2001 From: foxplaying <166147707+foxplaying@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:23:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E5=85=B7=E4=BD=93=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/llm_models/model_client/gemini_client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/llm_models/model_client/gemini_client.py b/src/llm_models/model_client/gemini_client.py index 8f0b552d..cc450749 100644 --- a/src/llm_models/model_client/gemini_client.py +++ b/src/llm_models/model_client/gemini_client.py @@ -527,15 +527,20 @@ class GeminiClient(BaseClient): resp, usage_record = async_response_parser(req_task.result()) except (ClientError, ServerError) as e: - # 重封装ClientError和ServerError为RespNotOkException + # 重封装 ClientError 和 ServerError 为 RespNotOkException raise RespNotOkException(e.code, e.message) from None except ( UnknownFunctionCallArgumentError, UnsupportedFunctionError, FunctionInvocationError, ) as e: - raise ValueError(f"工具类型错误:请检查工具选项和参数:{str(e)}") from None + # 工具调用相关错误 + raise RespParseException(None, f"工具调用参数错误: {str(e)}") from None + except EmptyResponseException as e: + # 保持原始异常,便于区分“空响应”和网络异常 + raise e except Exception as e: + # 其他未预料的错误,才归为网络连接类 raise NetworkConnectionError() from e if usage_record: