Commit dfcc3142 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: only edit body with whitelisted paths

parent 6c58bb59
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment