add API error message in response.
This commit is contained in:
parent
c66d325d8f
commit
23b08d4cf5
@ -105,7 +105,7 @@ def chat_post():
|
|||||||
msg_resp = openai_resp['choices'][0]['message']['content']
|
msg_resp = openai_resp['choices'][0]['message']['content']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("OpenAI API request failed: %s", repr(e))
|
logger.error("OpenAI API request failed: %s", repr(e))
|
||||||
msg_resp = "请求错误,请尝试重发。如果持续错误,请联系管理员检查。"
|
msg_resp = "请求错误,请尝试重发。如果持续错误,请联系管理员检查。" + "\n"+"错误信息: " + repr(e)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if msg_resp:
|
if msg_resp:
|
||||||
|
Reference in New Issue
Block a user