From 50e8e31f88c569369b31c9e280d0caf933b49664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 31 Jul 2024 23:50:07 +0800 Subject: [PATCH] exc --- LunaTranslator/LunaTranslator/translator/sakura.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LunaTranslator/LunaTranslator/translator/sakura.py b/LunaTranslator/LunaTranslator/translator/sakura.py index e195d7b5..c3c41809 100644 --- a/LunaTranslator/LunaTranslator/translator/sakura.py +++ b/LunaTranslator/LunaTranslator/translator/sakura.py @@ -141,7 +141,7 @@ class TS(basetrans): try: output = self.session.post(self.api_url + "/chat/completions", json=data) - except requests.Timeout as e: + except requests.RequestException as e: raise ValueError(f"连接到Sakura API超时:{self.api_url}") try: yield output.json() @@ -177,7 +177,7 @@ class TS(basetrans): json=data, stream=True, ) - except requests.Timeout: + except requests.RequestException: raise ValueError(f"连接到Sakura API超时:{self.api_url}") for o in output.iter_lines():