This commit is contained in:
Timothy J. Baek 2024-05-27 11:08:01 -07:00
parent f1a7c76693
commit 73178cf519

View File

@ -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: