Mio commited on
Commit
725655a
·
unverified ·
1 Parent(s): 549d27b

修复API赋值bug,防止已设置的API被空文件覆盖 (#119)

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +1 -1
ChuanhuChatbot.py CHANGED
@@ -37,7 +37,7 @@ if dockerflag:
37
  if not (isinstance(username, type(None)) or isinstance(password, type(None))):
38
  authflag = True
39
  else:
40
- if os.path.exists("api_key.txt"):
41
  with open("api_key.txt", "r") as f:
42
  my_api_key = f.read().strip()
43
  if os.path.exists("auth.json"):
 
37
  if not (isinstance(username, type(None)) or isinstance(password, type(None))):
38
  authflag = True
39
  else:
40
+ if not my_api_key and os.path.exists("api_key.txt") and os.path.getsize("api_key.txt"):
41
  with open("api_key.txt", "r") as f:
42
  my_api_key = f.read().strip()
43
  if os.path.exists("auth.json"):