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
dfcc3142
Commit
dfcc3142
authored
Mar 08, 2024
by
Timothy J. Baek
Browse files
fix: only edit body with whitelisted paths
parent
6c58bb59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
backend/main.py
backend/main.py
+5
-1
No files found.
backend/main.py
View file @
dfcc3142
...
...
@@ -62,8 +62,12 @@ async def on_startup():
class
RAGMiddleware
(
BaseHTTPMiddleware
):
async
def
dispatch
(
self
,
request
:
Request
,
call_next
):
"chat/completions"
in
request
.
url
.
path
print
(
request
.
url
.
path
)
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
and
(
"/api/chat"
in
request
.
url
.
path
or
"/chat/completions"
in
request
.
url
.
path
):
# Read the original request body
body
=
await
request
.
body
()
# Decode body to string
...
...
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