Skip to content

Commit

Permalink
Merge pull request #774 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
优化openai 测试的报错日志
  • Loading branch information
Ikaros-521 authored Apr 25, 2024
2 parents 3768c7c + 57bbc1a commit 5197599
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ def check_useful(data_json):

return {"code": 200, "msg": "OpenAI API key 可用"}
except Exception as e:
logging.error(traceback.format_exc())
logging.error(f"OpenAI API key 不可用: {e}")
return {"code": -1, "msg": f"OpenAI API key 不可用: {e}"}
else:
Expand Down Expand Up @@ -1225,6 +1226,10 @@ def check_useful(data_json):
except openai.OpenAIError as e:
logging.error(f"OpenAI API key 不可用: {e}")
return {"code": -1, "msg": f"OpenAI API key 不可用: {e}"}
except Exception as e:
logging.error(traceback.format_exc())
logging.error(f"OpenAI API key 不可用: {e}")
return {"code": -1, "msg": f"OpenAI API key 不可用: {e}"}

return check_useful(data_json)

Expand Down

0 comments on commit 5197599

Please sign in to comment.