增加了对Azure密钥的识别

This commit is contained in:
binary-husky 2023-04-29 03:22:31 +08:00
parent 9ad00c78ba
commit c960b34fac

View File

@ -465,8 +465,9 @@ def on_report_generated(files, chatbot):
return report_files, chatbot
def is_openai_api_key(key):
API_MATCH = re.match(r"sk-[a-zA-Z0-9]{48}$", key)
return bool(API_MATCH)
API_MATCH_ORIGINAL = re.match(r"sk-[a-zA-Z0-9]{48}$", key)
API_MATCH_AZURE = re.match(r"[a-zA-Z0-9]{32}$", key)
return bool(API_MATCH_ORIGINAL) or bool(API_MATCH_AZURE)
def is_api2d_key(key):
if key.startswith('fk') and len(key) == 41: