From c960b34fac4a2eb1d31dc3b96db5b6b9be0d66b0 Mon Sep 17 00:00:00 2001 From: binary-husky <505030475@qq.com> Date: Sat, 29 Apr 2023 03:22:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=AF=B9Azure?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E7=9A=84=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolbox.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolbox.py b/toolbox.py index c09ea74..5e42164 100644 --- a/toolbox.py +++ b/toolbox.py @@ -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: