This commit is contained in:
恍兮惚兮 2024-07-31 23:50:07 +08:00
parent 967041386c
commit 50e8e31f88

View File

@ -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():