qingxu99 commited on
Commit
c960b34
1 Parent(s): 9ad00c7

增加了对Azure密钥的识别

Browse files
Files changed (1) hide show
  1. toolbox.py +3 -2
toolbox.py CHANGED
@@ -465,8 +465,9 @@ def on_report_generated(files, chatbot):
465
  return report_files, chatbot
466
 
467
  def is_openai_api_key(key):
468
- API_MATCH = re.match(r"sk-[a-zA-Z0-9]{48}$", key)
469
- return bool(API_MATCH)
 
470
 
471
  def is_api2d_key(key):
472
  if key.startswith('fk') and len(key) == 41:
 
465
  return report_files, chatbot
466
 
467
  def is_openai_api_key(key):
468
+ API_MATCH_ORIGINAL = re.match(r"sk-[a-zA-Z0-9]{48}$", key)
469
+ API_MATCH_AZURE = re.match(r"[a-zA-Z0-9]{32}$", key)
470
+ return bool(API_MATCH_ORIGINAL) or bool(API_MATCH_AZURE)
471
 
472
  def is_api2d_key(key):
473
  if key.startswith('fk') and len(key) == 41: