enh: option to disable api auth

This commit is contained in:
Timothy Jaeryang Baek
2024-11-19 12:17:23 -08:00
parent 979e6e5a79
commit 7a585fbaf3
8 changed files with 34 additions and 30 deletions

View File

@@ -74,7 +74,6 @@ from open_webui.config import (
ENABLE_ADMIN_EXPORT,
ENABLE_OLLAMA_API,
ENABLE_OPENAI_API,
ENABLE_API_KEY_AUTH,
ENABLE_TAGS_GENERATION,
ENV,
FRONTEND_BUILD_DIR,
@@ -941,6 +940,7 @@ async def commit_session_after_request(request: Request, call_next):
@app.middleware("http")
async def check_url(request: Request, call_next):
start_time = int(time.time())
request.state.enable_api_key = webui_app.state.config.ENABLE_API_KEY
response = await call_next(request)
process_time = int(time.time()) - start_time
response.headers["X-Process-Time"] = str(process_time)
@@ -2428,7 +2428,7 @@ async def get_app_config(request: Request):
"auth": WEBUI_AUTH,
"auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER),
"enable_ldap": webui_app.state.config.ENABLE_LDAP,
"enable_api_key_auth": ENABLE_API_KEY_AUTH,
"enable_api_key": webui_app.state.config.ENABLE_API_KEY,
"enable_signup": webui_app.state.config.ENABLE_SIGNUP,
"enable_login_form": webui_app.state.config.ENABLE_LOGIN_FORM,
**(