Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
8181ae39
Commit
8181ae39
authored
May 17, 2024
by
Timothy J. Baek
Browse files
fix
parent
cdbabdfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
backend/main.py
backend/main.py
+9
-9
No files found.
backend/main.py
View file @
8181ae39
...
@@ -118,15 +118,15 @@ origins = ["*"]
...
@@ -118,15 +118,15 @@ origins = ["*"]
# Custom middleware to add security headers
# Custom middleware to add security headers
class
SecurityHeadersMiddleware
(
BaseHTTPMiddleware
):
#
class SecurityHeadersMiddleware(BaseHTTPMiddleware):
async
def
dispatch
(
self
,
request
:
Request
,
call_next
):
#
async def dispatch(self, request: Request, call_next):
response
:
Response
=
await
call_next
(
request
)
#
response: Response = await call_next(request)
response
.
headers
[
"Cross-Origin-Opener-Policy"
]
=
"same-origin"
#
response.headers["Cross-Origin-Opener-Policy"] = "same-origin"
response
.
headers
[
"Cross-Origin-Embedder-Policy"
]
=
"require-corp"
#
response.headers["Cross-Origin-Embedder-Policy"] = "require-corp"
return
response
#
return response
app
.
add_middleware
(
SecurityHeadersMiddleware
)
#
app.add_middleware(SecurityHeadersMiddleware)
class
RAGMiddleware
(
BaseHTTPMiddleware
):
class
RAGMiddleware
(
BaseHTTPMiddleware
):
...
@@ -289,8 +289,8 @@ class ModelFilterConfigForm(BaseModel):
...
@@ -289,8 +289,8 @@ class ModelFilterConfigForm(BaseModel):
async
def
update_model_filter_config
(
async
def
update_model_filter_config
(
form_data
:
ModelFilterConfigForm
,
user
=
Depends
(
get_admin_user
)
form_data
:
ModelFilterConfigForm
,
user
=
Depends
(
get_admin_user
)
):
):
app
.
state
.
config
.
ENABLE_MODEL_FILTER
,
form_data
.
enabled
app
.
state
.
config
.
ENABLE_MODEL_FILTER
=
form_data
.
enabled
app
.
state
.
config
.
MODEL_FILTER_LIST
,
form_data
.
models
app
.
state
.
config
.
MODEL_FILTER_LIST
=
form_data
.
models
ollama_app
.
state
.
ENABLE_MODEL_FILTER
=
app
.
state
.
config
.
ENABLE_MODEL_FILTER
ollama_app
.
state
.
ENABLE_MODEL_FILTER
=
app
.
state
.
config
.
ENABLE_MODEL_FILTER
ollama_app
.
state
.
MODEL_FILTER_LIST
=
app
.
state
.
config
.
MODEL_FILTER_LIST
ollama_app
.
state
.
MODEL_FILTER_LIST
=
app
.
state
.
config
.
MODEL_FILTER_LIST
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment