From 1e2a1423b1c42fba050d5ae27574f862a373673e Mon Sep 17 00:00:00 2001 From: lanqian528 <5499636+lanqian528@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:11:07 +0800 Subject: [PATCH] v1.5.1 --- chat2api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chat2api.py b/chat2api.py index 1a7a447..2e5f3c9 100644 --- a/chat2api.py +++ b/chat2api.py @@ -16,7 +16,7 @@ from chatgpt.authorization import refresh_all_tokens, verify_token, get_req_toke import chatgpt.globals as globals from chatgpt.reverseProxy import chatgpt_reverse_proxy from utils.Logger import logger -from utils.config import api_prefix, scheduled_refresh, authorization_list +from utils.config import api_prefix, scheduled_refresh, authorization_list, enable_gateway from utils.retry import async_retry warnings.filterwarnings("ignore") @@ -130,6 +130,8 @@ async def error_tokens(): @app.get("/") async def chatgpt(request: Request): + if not enable_gateway: + raise HTTPException(status_code=404, detail="Gateway is disabled") req_token = get_req_token(authorization_list[0]) access_token = await verify_token(req_token) response = templates.TemplateResponse("chatgpt.html", {"request": request, "access_token": access_token})