Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
const [routerType, setRouterType] = useState<RouterType>("complexity");

// Semantic router config (existing)
const [routerConfig, setRouterConfig] = useState<any>(null);

Check warning on line 48 in ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type

// Complexity router config (new)
const [complexityTiers, setComplexityTiers] = useState<ComplexityTiers>({
Expand All @@ -58,7 +58,7 @@
useEffect(() => {
const fetchModelAccessGroups = async () => {
const response = await modelAvailableCall(accessToken, "", "", false, null, true, true);
setModelAccessGroups(response["data"].map((model: any) => model["id"]));

Check warning on line 61 in ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
};
fetchModelAccessGroups();
}, [accessToken]);
Expand Down Expand Up @@ -166,7 +166,7 @@

// Check if all routes have required fields
const invalidRoutes = routerConfig.routes.filter(
(route: any) => !route.name || !route.description || route.utterances.length === 0,

Check warning on line 169 in ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
);

if (invalidRoutes.length > 0) {
Expand All @@ -192,7 +192,7 @@
console.error("Validation failed:", error);
const fieldErrors = error.errorFields || [];
if (fieldErrors.length > 0) {
const missingFields = fieldErrors.map((field: any) => {

Check warning on line 195 in ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
const fieldName = field.name[0];
const friendlyNames: { [key: string]: string } = {
auto_router_name: "Auto Router Name",
Expand Down Expand Up @@ -436,11 +436,19 @@
]}
width={700}
>
{/* Only render the ConnectionErrorDisplay when modal is visible and we have a test ID */}
{isResultModalVisible && (
<ConnectionErrorDisplay
key={connectionTestId}
formValues={form.getFieldsValue()}
formValues={{
...form.getFieldsValue(),
custom_llm_provider: "auto_router",
model_mappings: [{
public_name: form.getFieldValue("auto_router_name") || "auto_router",
litellm_model: routerType === "complexity"
? "auto_router/complexity_router"
: `auto_router/${form.getFieldValue("auto_router_name") || "auto_router"}`,
}],
}}
Comment on lines +442 to +454

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 For the complexity router, the litellm_model is hardcoded to "auto_router/complexity_router" instead of using the user's actual router name. When the user fills in auto_router_name (e.g. "my_router"), the test will always probe "auto_router/complexity_router" — a model name that will never match any deployed model — causing the test to consistently return a connection error rather than a meaningful result.

Suggested change
formValues={{
...form.getFieldsValue(),
custom_llm_provider: "auto_router",
model_mappings: [{
public_name: form.getFieldValue("auto_router_name") || "auto_router",
litellm_model: routerType === "complexity"
? "auto_router/complexity_router"
: `auto_router/${form.getFieldValue("auto_router_name") || "auto_router"}`,
}],
}}
formValues={{
...form.getFieldsValue(),
custom_llm_provider: "auto_router",
model_mappings: [{
public_name: form.getFieldValue("auto_router_name") || "auto_router",
litellm_model: `auto_router/${form.getFieldValue("auto_router_name") || "auto_router"}`,
}],
}}

accessToken={accessToken}
testMode="chat"
modelName={form.getFieldValue("auto_router_name")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const { Text } = Typography;

interface ModelConnectionTestProps {
formValues: Record<string, any>;

Check warning on line 10 in ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
accessToken: string;
testMode: string;
modelName?: string;
Expand All @@ -24,8 +24,8 @@
onTestComplete,
}) => {
const [error, setError] = React.useState<Error | string | null>(null);
const [rawRequest, setRawRequest] = React.useState<any>(null);

Check warning on line 27 in ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
const [rawResponse, setRawResponse] = React.useState<any>(null);

Check warning on line 28 in ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
const [isLoading, setIsLoading] = React.useState<boolean>(true);
const [isSuccess, setIsSuccess] = React.useState<boolean>(false);
const [showDetails, setShowDetails] = React.useState<boolean>(false);
Expand All @@ -45,7 +45,7 @@
console.log("Testing connection with form values:", formValues);
const result = await prepareModelAddRequest(formValues, accessToken, null);

if (!result) {
if (!result || result.length === 0) {
console.log("No result from prepareModelAddRequest");
setError("Failed to prepare model data. Please check your form inputs.");
setIsSuccess(false);
Expand Down Expand Up @@ -87,7 +87,7 @@
}, 200);

return () => clearTimeout(timer);
}, []); // Empty dependency array means this runs once on mount

Check warning on line 90 in ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

React Hook React.useEffect has a missing dependency: 'testModelConnection'. Either include it or remove the dependency array

const getCleanErrorMessage = (errorMsg: string) => {
if (!errorMsg) return "Unknown error";
Expand All @@ -108,7 +108,7 @@

const formatCurlCommand = (
apiBase: string,
requestBody: Record<string, any>,

Check warning on line 111 in ui/litellm-dashboard/src/components/add_model/model_connection_test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
requestHeaders: Record<string, string>,
) => {
const formattedBody = JSON.stringify(requestBody, null, 2)
Expand Down
Loading