Browse Source

Fix code scanning alert no. 148: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Timothy Jaeryang Baek 4 months ago
parent
commit
6962f8f3b3
1 changed files with 3 additions and 2 deletions
  1. 3 2
      backend/open_webui/routers/tasks.py

+ 3 - 2
backend/open_webui/routers/tasks.py

@@ -249,9 +249,10 @@ async def generate_chat_tags(
     try:
         return await generate_chat_completion(request, form_data=payload, user=user)
     except Exception as e:
+        log.error(f"Error generating chat completion: {e}")
         return JSONResponse(
-            status_code=status.HTTP_400_BAD_REQUEST,
-            content={"detail": str(e)},
+            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
+            content={"detail": "An internal error has occurred."},
         )