mirror of
https://github.com/open-webui/open-webui
synced 2024-11-24 21:13:59 +00:00
refac
This commit is contained in:
parent
f1a7c76693
commit
73178cf519
@ -118,6 +118,14 @@ app.state.MODELS = {}
|
||||
|
||||
origins = ["*"]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
# Custom middleware to add security headers
|
||||
# class SecurityHeadersMiddleware(BaseHTTPMiddleware):
|
||||
@ -221,15 +229,6 @@ class RAGMiddleware(BaseHTTPMiddleware):
|
||||
app.add_middleware(RAGMiddleware)
|
||||
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
async def check_url(request: Request, call_next):
|
||||
if len(app.state.MODELS) == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user