mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-06-29 00:08:04 +08:00
修复客户端网络问题导致异常崩溃
This commit is contained in:
parent
1cccdce99a
commit
4c9a602244
@ -28,7 +28,11 @@ data["userkey"] = config["userkey"]
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
data["prompt"] = str(input(">> You:\n"))
|
data["prompt"] = str(input(">> You:\n"))
|
||||||
req = json.loads(requests.post(url=config['url'],json=data).text)
|
try:
|
||||||
|
req = json.loads(requests.post(url=config['url'],json=data).text)
|
||||||
|
except:
|
||||||
|
print("Internet Err : Can not connect Server")
|
||||||
|
break
|
||||||
if req["code"] == 200:
|
if req["code"] == 200:
|
||||||
print(f"\n>> AI:\n{req['output']}\n\n<剩余tokens:{req['surplus']} >")
|
print(f"\n>> AI:\n{req['output']}\n\n<剩余tokens:{req['surplus']} >")
|
||||||
elif req["code"] == 403:
|
elif req["code"] == 403:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user