Ver código fonte

Fix error message propagate from pipelines

Error message returned from pipelines was not being shown on UI. It showed "Connection closed". With this fix it will show the error message on the UI from the pipeline properly.
Diwakar 1 mês atrás
pai
commit
2bdf77a726
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      backend/open_webui/routers/pipelines.py

+ 2 - 2
backend/open_webui/routers/pipelines.py

@@ -90,8 +90,8 @@ async def process_pipeline_inlet_filter(request, payload, user, models):
                     headers=headers,
                     headers=headers,
                     json=request_data,
                     json=request_data,
                 ) as response:
                 ) as response:
-                    response.raise_for_status()
                     payload = await response.json()
                     payload = await response.json()
+                    response.raise_for_status()
             except aiohttp.ClientResponseError as e:
             except aiohttp.ClientResponseError as e:
                 res = (
                 res = (
                     await response.json()
                     await response.json()
@@ -139,8 +139,8 @@ async def process_pipeline_outlet_filter(request, payload, user, models):
                     headers=headers,
                     headers=headers,
                     json=request_data,
                     json=request_data,
                 ) as response:
                 ) as response:
-                    response.raise_for_status()
                     payload = await response.json()
                     payload = await response.json()
+                    response.raise_for_status()
             except aiohttp.ClientResponseError as e:
             except aiohttp.ClientResponseError as e:
                 try:
                 try:
                     res = (
                     res = (