mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
exc
This commit is contained in:
parent
967041386c
commit
50e8e31f88
@ -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():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user