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
c6c0bc19
"...composable_kernel.git" did not exist on "cee9295124049be2b81cb4df3e8ecbd12662cd3a"
Commit
c6c0bc19
authored
Jun 12, 2024
by
Timothy J. Baek
Browse files
fix: filter pipeline
parent
c794d59f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
backend/main.py
backend/main.py
+11
-6
No files found.
backend/main.py
View file @
c6c0bc19
...
@@ -472,13 +472,10 @@ def filter_pipeline(payload, user):
...
@@ -472,13 +472,10 @@ def filter_pipeline(payload, user):
if
r
is
not
None
:
if
r
is
not
None
:
try
:
try
:
res
=
r
.
json
()
res
=
r
.
json
()
if
"detail"
in
res
:
return
JSONResponse
(
status_code
=
r
.
status_code
,
content
=
res
,
)
except
:
except
:
pass
pass
if
"detail"
in
res
:
raise
Exception
(
r
.
status_code
,
res
[
"detail"
])
else
:
else
:
pass
pass
...
@@ -489,6 +486,7 @@ def filter_pipeline(payload, user):
...
@@ -489,6 +486,7 @@ def filter_pipeline(payload, user):
if
"title"
in
payload
:
if
"title"
in
payload
:
del
payload
[
"title"
]
del
payload
[
"title"
]
return
payload
return
payload
...
@@ -510,7 +508,14 @@ class PipelineMiddleware(BaseHTTPMiddleware):
...
@@ -510,7 +508,14 @@ class PipelineMiddleware(BaseHTTPMiddleware):
user
=
get_current_user
(
user
=
get_current_user
(
get_http_authorization_cred
(
request
.
headers
.
get
(
"Authorization"
))
get_http_authorization_cred
(
request
.
headers
.
get
(
"Authorization"
))
)
)
data
=
filter_pipeline
(
data
,
user
)
try
:
data
=
filter_pipeline
(
data
,
user
)
except
Exception
as
e
:
return
JSONResponse
(
status_code
=
e
.
args
[
0
],
content
=
{
"detail"
:
e
.
args
[
1
]},
)
modified_body_bytes
=
json
.
dumps
(
data
).
encode
(
"utf-8"
)
modified_body_bytes
=
json
.
dumps
(
data
).
encode
(
"utf-8"
)
# Replace the request body with the modified one
# Replace the request body with the modified one
...
...
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