refac: disable openapi.json

This commit is contained in:
Timothy Jaeryang Baek
2024-11-09 18:01:23 -08:00
parent 7228b39064
commit 96c865404d
7 changed files with 19 additions and 11 deletions

View File

@@ -24,7 +24,7 @@ from open_webui.env import AIOHTTP_CLIENT_TIMEOUT
from open_webui.constants import ERROR_MESSAGES
from open_webui.env import SRC_LOG_LEVELS
from open_webui.env import ENV, SRC_LOG_LEVELS
from fastapi import Depends, FastAPI, File, HTTPException, Request, UploadFile
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import StreamingResponse
@@ -45,7 +45,9 @@ from open_webui.utils.utils import get_admin_user, get_verified_user
log = logging.getLogger(__name__)
log.setLevel(SRC_LOG_LEVELS["OLLAMA"])
app = FastAPI()
app = FastAPI(docs_url="/docs" if ENV == "dev" else None, openapi_url="/openapi.json" if ENV == "dev" else None, redoc_url=None)
app.add_middleware(
CORSMiddleware,
allow_origins=CORS_ALLOW_ORIGIN,