From 321cb134b4a6e1d016b92701d896b71d897960dc Mon Sep 17 00:00:00 2001 From: HfCloud Date: Mon, 6 Feb 2023 02:11:48 +0800 Subject: [PATCH] add checking api key --- bot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot.py b/bot.py index 7c74bb1..2ec641c 100644 --- a/bot.py +++ b/bot.py @@ -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) \ No newline at end of file