Skip to content

Commit a1f6ade

Browse files
Merge pull request #13582 from BerriAI/remove-network-response-error
Remove ambiguous network response error
2 parents 37e57a0 + be109c2 commit a1f6ade

File tree

68 files changed

+883
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+883
-568
lines changed

ui/litellm-dashboard/src/components/SCIM.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
PlusCircleOutlined
2222
} from "@ant-design/icons";
2323
import { parseErrorMessage } from "./shared/errorUtils";
24+
import NotificationManager from "./molecules/notifications_manager";
2425

2526
interface SCIMConfigProps {
2627
accessToken: string | null;
@@ -51,7 +52,7 @@ const SCIMConfig: React.FC<SCIMConfigProps> = ({ accessToken, userID, proxySetti
5152

5253
const handleCreateSCIMToken = async (values: any) => {
5354
if (!accessToken || !userID) {
54-
message.error("You need to be logged in to create a SCIM token");
55+
NotificationManager.fromBackend("You need to be logged in to create a SCIM token");
5556
return;
5657
}
5758

@@ -70,7 +71,7 @@ const SCIMConfig: React.FC<SCIMConfigProps> = ({ accessToken, userID, proxySetti
7071
message.success("SCIM token created successfully");
7172
} catch (error: any) {
7273
console.error("Error creating SCIM token:", error);
73-
message.error("Failed to create SCIM token: " + parseErrorMessage(error));
74+
NotificationManager.fromBackend("Failed to create SCIM token: " + parseErrorMessage(error));
7475
} finally {
7576
setIsCreatingToken(false);
7677
}

ui/litellm-dashboard/src/components/SSOModals.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const SSOModals: React.FC<SSOModalsProps> = ({
161161
// Enhanced form submission handler
162162
const handleFormSubmit = async (formValues: Record<string, any>) => {
163163
if (!accessToken) {
164-
message.error("No access token available");
164+
NotificationManager.fromBackend("No access token available");
165165
return;
166166
}
167167

@@ -173,14 +173,14 @@ const SSOModals: React.FC<SSOModalsProps> = ({
173173
handleShowInstructions(formValues);
174174
} catch (error) {
175175
console.error("Failed to save SSO settings:", error);
176-
message.error("Failed to save SSO settings");
176+
NotificationManager.fromBackend("Failed to save SSO settings");
177177
}
178178
};
179179

180180
// Handle clearing SSO settings
181181
const handleClearSSO = async () => {
182182
if (!accessToken) {
183-
message.error("No access token available");
183+
NotificationManager.fromBackend("No access token available");
184184
return;
185185
}
186186

@@ -216,7 +216,7 @@ const SSOModals: React.FC<SSOModalsProps> = ({
216216
message.success("SSO settings cleared successfully");
217217
} catch (error) {
218218
console.error("Failed to clear SSO settings:", error);
219-
message.error("Failed to clear SSO settings");
219+
NotificationManager.fromBackend("Failed to clear SSO settings");
220220
}
221221
};
222222

ui/litellm-dashboard/src/components/SSOSettings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const SSOSettings: React.FC<SSOSettingsProps> = ({ accessToken, possibleUIRoles,
5656
}
5757
} catch (error) {
5858
console.error("Error fetching SSO settings:", error);
59-
message.error("Failed to fetch SSO settings");
59+
NotificationManager.fromBackend("Failed to fetch SSO settings");
6060
} finally {
6161
setLoading(false);
6262
}
@@ -81,7 +81,7 @@ const SSOSettings: React.FC<SSOSettingsProps> = ({ accessToken, possibleUIRoles,
8181
setIsEditing(false);
8282
} catch (error) {
8383
console.error("Error updating SSO settings:", error);
84-
message.error("Failed to update settings: " + error);
84+
NotificationManager.fromBackend("Failed to update settings: " + error);
8585
} finally {
8686
setSaving(false);
8787
}

ui/litellm-dashboard/src/components/TeamSSOSettings.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Typography, Spin, message, Switch, Select, Form } from "antd";
44
import { getDefaultTeamSettings, updateDefaultTeamSettings, modelAvailableCall } from "./networking";
55
import BudgetDurationDropdown, { getBudgetDurationLabel } from "./common_components/budget_duration_dropdown";
66
import { getModelDisplayName } from "./key_team_helpers/fetch_available_models_team_key";
7+
import NotificationManager from "./molecules/notifications_manager";
78

89
interface TeamSSOSettingsProps {
910
accessToken: string | null;
@@ -47,7 +48,7 @@ const TeamSSOSettings: React.FC<TeamSSOSettingsProps> = ({ accessToken, userID,
4748
}
4849
} catch (error) {
4950
console.error("Error fetching team SSO settings:", error);
50-
message.error("Failed to fetch team settings");
51+
NotificationManager.fromBackend("Failed to fetch team settings");
5152
} finally {
5253
setLoading(false);
5354
}
@@ -67,7 +68,7 @@ const TeamSSOSettings: React.FC<TeamSSOSettingsProps> = ({ accessToken, userID,
6768
message.success("Default team settings updated successfully");
6869
} catch (error) {
6970
console.error("Error updating team settings:", error);
70-
message.error("Failed to update team settings");
71+
NotificationManager.fromBackend("Failed to update team settings");
7172
} finally {
7273
setSaving(false);
7374
}

ui/litellm-dashboard/src/components/UIAccessControlForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
22
import { Form, Button as Button2, Select, message } from "antd";
33
import { Text, TextInput } from "@tremor/react";
44
import { getSSOSettings, updateSSOSettings } from "./networking";
5+
import NotificationManager from "./molecules/notifications_manager";
56

67
interface UIAccessControlFormProps {
78
accessToken: string | null;
@@ -52,7 +53,7 @@ const UIAccessControlForm: React.FC<UIAccessControlFormProps> = ({ accessToken,
5253

5354
const handleUIAccessSubmit = async (formValues: Record<string, any>) => {
5455
if (!accessToken) {
55-
message.error("No access token available");
56+
NotificationManager.fromBackend("No access token available");
5657
return;
5758
}
5859

@@ -71,7 +72,7 @@ const UIAccessControlForm: React.FC<UIAccessControlFormProps> = ({ accessToken,
7172
onSuccess();
7273
} catch (error) {
7374
console.error("Failed to save UI access settings:", error);
74-
message.error("Failed to save UI access settings");
75+
NotificationManager.fromBackend("Failed to save UI access settings");
7576
} finally {
7677
setLoading(false);
7778
}

ui/litellm-dashboard/src/components/add_fallbacks.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
message,
1515
} from "antd";
1616
import { fetchAvailableModels, ModelGroup } from "./chat_ui/llm_calls/fetch_models";
17+
import NotificationManager from "./molecules/notifications_manager";
1718

1819
interface AddFallbacksProps {
1920
models?: string[];
@@ -91,10 +92,10 @@ const AddFallbacks: React.FC<AddFallbacksProps> = ({
9192
// Update routerSettings state
9293
setRouterSettings(updatedRouterSettings);
9394
} catch (error) {
94-
message.error("Failed to update router settings: " + error, 20);
95+
NotificationManager.fromBackend("Failed to update router settings: " + error);
9596
}
9697

97-
message.success("router settings updated successfully");
98+
NotificationManager.success("router settings updated successfully");
9899

99100
setIsModalVisible(false);
100101
form.resetFields();

ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { all_admin_roles } from "@/utils/roles";
1111
import { handleAddAutoRouterSubmit } from "./handle_add_auto_router_submit";
1212
import { fetchAvailableModels, ModelGroup } from "../chat_ui/llm_calls/fetch_models";
1313
import RouterConfigBuilder from "./router_config_builder";
14+
import NotificationManager from "../molecules/notifications_manager";
1415

1516
interface AddAutoRouterTabProps {
1617
form: FormInstance;
@@ -79,12 +80,12 @@ const AddAutoRouterTab: React.FC<AddAutoRouterTabProps> = ({
7980

8081
// Check basic required fields first
8182
if (!currentFormValues.auto_router_name) {
82-
message.error("Please enter an Auto Router Name");
83+
NotificationManager.fromBackend("Please enter an Auto Router Name");
8384
return;
8485
}
8586

8687
if (!currentFormValues.auto_router_default_model) {
87-
message.error("Please select a Default Model");
88+
NotificationManager.fromBackend("Please select a Default Model");
8889
return;
8990
}
9091

@@ -98,7 +99,7 @@ const AddAutoRouterTab: React.FC<AddAutoRouterTabProps> = ({
9899

99100
// Custom validation for router config
100101
if (!routerConfig || !routerConfig.routes || routerConfig.routes.length === 0) {
101-
message.error("Please configure at least one route for the auto router");
102+
NotificationManager.fromBackend("Please configure at least one route for the auto router");
102103
return;
103104
}
104105

@@ -108,7 +109,7 @@ const AddAutoRouterTab: React.FC<AddAutoRouterTabProps> = ({
108109
);
109110

110111
if (invalidRoutes.length > 0) {
111-
message.error("Please ensure all routes have a target model, description, and at least one utterance");
112+
NotificationManager.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");
112113
return;
113114
}
114115

@@ -139,9 +140,9 @@ const AddAutoRouterTab: React.FC<AddAutoRouterTabProps> = ({
139140
};
140141
return friendlyNames[fieldName] || fieldName;
141142
});
142-
message.error(`Please fill in the following required fields: ${missingFields.join(', ')}`);
143+
NotificationManager.fromBackend(`Please fill in the following required fields: ${missingFields.join(', ')}`);
143144
} else {
144-
message.error("Please fill in all required fields");
145+
NotificationManager.fromBackend("Please fill in all required fields");
145146
}
146147
});
147148
};

ui/litellm-dashboard/src/components/add_model/handle_add_auto_router_submit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { message } from "antd";
22
import { modelCreateCall, Model } from "../networking";
3+
import NotificationManager from "../molecules/notifications_manager";
34

45
export const handleAddAutoRouterSubmit = async (
56
values: any,
@@ -55,6 +56,6 @@ export const handleAddAutoRouterSubmit = async (
5556

5657
} catch (error) {
5758
console.error("Failed to add auto router:", error);
58-
message.error("Failed to add auto router: " + error, 10);
59+
NotificationManager.fromBackend("Failed to add auto router: " + error);
5960
}
6061
};

ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { provider_map, Providers } from "../provider_info_helpers";
33
import { modelCreateCall, Model, testConnectionRequest } from "../networking";
44
import React, { useState } from 'react';
55
import ConnectionErrorDisplay from './model_connection_test';
6+
import NotificationManager from "../molecules/notifications_manager";
67

78
export const prepareModelAddRequest = async (
89
formValues: Record<string, any>,
@@ -100,9 +101,8 @@ export const prepareModelAddRequest = async (
100101
try {
101102
litellmExtraParams = JSON.parse(value);
102103
} catch (error) {
103-
message.error(
104-
"Failed to parse LiteLLM Extra Params: " + error,
105-
10
104+
NotificationManager.fromBackend(
105+
"Failed to parse LiteLLM Extra Params: " + error
106106
);
107107
throw new Error("Failed to parse litellm_extra_params: " + error);
108108
}
@@ -117,9 +117,8 @@ export const prepareModelAddRequest = async (
117117
try {
118118
modelInfoParams = JSON.parse(value);
119119
} catch (error) {
120-
message.error(
121-
"Failed to parse LiteLLM Extra Params: " + error,
122-
10
120+
NotificationManager.fromBackend(
121+
"Failed to parse LiteLLM Extra Params: " + error
123122
);
124123
throw new Error("Failed to parse litellm_extra_params: " + error);
125124
}
@@ -151,7 +150,7 @@ export const prepareModelAddRequest = async (
151150

152151
return deployments;
153152
} catch (error) {
154-
message.error("Failed to create model: " + error, 10);
153+
NotificationManager.fromBackend("Failed to create model: " + error);
155154
}
156155
};
157156

@@ -185,7 +184,7 @@ export const handleAddModelSubmit = async (
185184
callback && callback();
186185
form.resetFields();
187186
} catch (error) {
188-
message.error("Failed to add model: " + error, 10);
187+
NotificationManager.fromBackend("Failed to add model: " + error);
189188
}
190189
};
191190

ui/litellm-dashboard/src/components/add_pass_through.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { list } from "postcss";
2828
import KeyValueInput from "./key_value_input";
2929
import { passThroughItem } from "./pass_through_settings";
3030
import RoutePreview from "./route_preview";
31+
import NotificationManager from "./molecules/notifications_manager";
3132
const { Option } = Select2;
3233

3334
interface AddFallbacksProps {
@@ -87,7 +88,7 @@ const AddPassThroughEndpoint: React.FC<AddFallbacksProps> = ({
8788
setIncludeSubpath(true);
8889
setIsModalVisible(false);
8990
} catch (error) {
90-
message.error("Error creating pass-through endpoint: " + error, 20);
91+
NotificationManager.fromBackend("Error creating pass-through endpoint: " + error);
9192
} finally {
9293
setIsLoading(false);
9394
}

0 commit comments

Comments
 (0)