mirror of
https://github.com/open-webui/open-webui
synced 2024-11-28 06:53:14 +00:00
fix: raise error
This commit is contained in:
parent
c4bd60114e
commit
96d7c3e99f
@ -330,11 +330,11 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||
body = await request.body()
|
||||
body_str = body.decode("utf-8")
|
||||
data = json.loads(body_str) if body_str else {}
|
||||
|
||||
user = get_current_user(
|
||||
request,
|
||||
get_http_authorization_cred(request.headers.get("Authorization")),
|
||||
)
|
||||
|
||||
# Flag to skip RAG completions if file_handler is present in tools/functions
|
||||
skip_files = False
|
||||
|
||||
@ -346,8 +346,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||
)
|
||||
model = app.state.MODELS[model_id]
|
||||
|
||||
print(":", data)
|
||||
|
||||
# Check if the model has any filters
|
||||
for filter_id in model["info"]["meta"].get("filterIds", []):
|
||||
filter = Functions.get_function_by_id(filter_id)
|
||||
@ -377,12 +375,11 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
raise HTTPException(
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=e,
|
||||
content={"detail": str(e)},
|
||||
)
|
||||
|
||||
print("Filtered:", data)
|
||||
# Set the task model
|
||||
task_model_id = data["model"]
|
||||
# Check if the user has a custom task model and use that model
|
||||
|
Loading…
Reference in New Issue
Block a user