add checking api key

This commit is contained in:
HfCloud 2023-02-06 02:11:48 +08:00
parent 3c7cc5ab0c
commit 321cb134b4
1 changed files with 3 additions and 0 deletions

3
bot.py
View File

@ -158,6 +158,9 @@ def app_draw():
if __name__ == "__main__":
#openai.organization = GlobalData.OPENAI_ORGID
if len(GlobalData.OPENAI_APIKEY) == 0:
raise RuntimeError("Please set your OpenAI API Key in config.json")
openai.api_key = GlobalData.OPENAI_APIKEY
app.run(host="0.0.0.0", port=11111)