Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(general_settings.tsx): filter out empty dictionaries post fallback delete (#8550)

Krish Dholakiaa42912529bc7
diff --git a/ui/litellm-dashboard/src/components/general_settings.tsx b/ui/litellm-dashboard/src/components/general_settings.tsx
index f64fefc3bbd..d54092d1bf8 100644
--- a/ui/litellm-dashboard/src/components/general_settings.tsx
+++ b/ui/litellm-dashboard/src/components/general_settings.tsx
@@ -287,22 +287,28 @@ const GeneralSettings: React.FC<GeneralSettingsPageProps> = ({
console.log(`received key: ${key}`);
console.log(`routerSettings['fallbacks']: ${routerSettings["fallbacks"]}`);
- routerSettings["fallbacks"].map((dict: { [key: string]: any }) => {
- // Check if the dictionary has the specified key and delete it if present
- if (key in dict) {
- delete dict[key];
- }
- return dict; // Return the updated dictionary
- });
+ const updatedFallbacks = routerSettings["fallbacks"]
+ .map((dict: { [key: string]: any }) => {
+ if (key in dict) {
+ delete dict[key];
+ }
+ return dict;
+ })
+ .filter((dict: { [key: string]: any }) => Object.keys(dict).length > 0);
+
+ const updatedSettings = {
+ ...routerSettings,
+ fallbacks: updatedFallbacks
+ };
+
const payload = {
- router_settings: routerSettings,
+ router_settings: updatedSettings,
};
try {
await setCallbacksCall(accessToken, payload);
- setRouterSettings({ ...routerSettings });
- setSelectedStrategy(routerSettings["routing_strategy"]);
+ setRouterSettings(updatedSettings);
message.success("Router settings updated successfully");
} catch (error) {
message.error("Failed to update router settings: " + error, 20);