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: try:
output = self.session.post(self.api_url + "/chat/completions", json=data) 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}") raise ValueError(f"连接到Sakura API超时{self.api_url}")
try: try:
yield output.json() yield output.json()
@ -177,7 +177,7 @@ class TS(basetrans):
json=data, json=data,
stream=True, stream=True,
) )
except requests.Timeout: except requests.RequestException:
raise ValueError(f"连接到Sakura API超时{self.api_url}") raise ValueError(f"连接到Sakura API超时{self.api_url}")
for o in output.iter_lines(): for o in output.iter_lines():