From 0839880f4ad70e152e020dbf17f62460f43e130c Mon Sep 17 00:00:00 2001 From: Aditya Kumar Kasaudhan <74228301+Aditya8840@users.noreply.github.com> Date: Tue, 18 Feb 2025 04:24:53 +0530 Subject: [PATCH] feat(ui): alert when adding model without STORE_MODEL_IN_DB (#8591) This commit show user-friendly error using message.error when a model is added via the UI and STORE_MODEL_IN_DB is not True. Fixes: #8516. --- ui/litellm-dashboard/src/components/networking.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index e00bb56c42..d7623e0e33 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -111,9 +111,12 @@ export const modelCreateCall = async ( }); if (!response.ok) { - const errorData = await response.text(); - console.error("Error response from the server:", errorData); - throw new Error("Network response was not ok"); + const errorData = await response.json(); + const errorMsg = + errorData.error?.message?.error || + "Network response was not ok"; + message.error(errorMsg); + throw new Error(errorMsg); } const data = await response.json();