mirror of
https://github.com/Kakune55/PyGetGPT.git
synced 2025-06-28 15:58:04 +08:00
修复了用户敏感词导致的异常
This commit is contained in:
parent
d3f2d5f6d4
commit
1cccdce99a
@ -21,6 +21,9 @@ def request_TY(userkey,prompt,history = ""):
|
|||||||
# 发送POST请求
|
# 发送POST请求
|
||||||
response = json.loads(requests.post(url, json=data ,headers=header).text)
|
response = json.loads(requests.post(url, json=data ,headers=header).text)
|
||||||
print(response)
|
print(response)
|
||||||
|
if 'code' in response:
|
||||||
|
if response['code'] == 'DataInspectionFailed':
|
||||||
|
return response['message']
|
||||||
reduce_value(userkey, response["usage"]["total_tokens"])
|
reduce_value(userkey, response["usage"]["total_tokens"])
|
||||||
return response['output']['text']
|
return response['output']['text']
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user