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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix test connection
Ishaan Jaff880cdc5d84ab
diff --git a/ui/litellm-dashboard/src/components/add_model/ConnectionErrorDisplay.tsx b/ui/litellm-dashboard/src/components/add_model/ConnectionErrorDisplay.tsxindex a46a1b5cfad..00c9da97513 100644--- a/ui/litellm-dashboard/src/components/add_model/ConnectionErrorDisplay.tsx+++ b/ui/litellm-dashboard/src/components/add_model/ConnectionErrorDisplay.tsx@@ -38,15 +38,25 @@ const ConnectionErrorDisplay: React.FC<ConnectionErrorDisplayProps> = ({setRawResponse(null);setIsSuccess(false);+ // Add a small delay to ensure form values are fully populated+ await new Promise(resolve => setTimeout(resolve, 100));+try {+ console.log("Testing connection with form values:", formValues);const result = await prepareModelAddRequest(formValues, accessToken, null);- if (!result) throw new Error("Failed to prepare model data");++ if (!result) {+ console.log("No result from prepareModelAddRequest");+ setError("Failed to prepare model data. Please check your form inputs.");+ setIsSuccess(false);+ setIsLoading(false);+ return;+ }- console.log("result from prepareModelAddRequest:", result);+ console.log("Result from prepareModelAddRequest:", result);const { litellmParamsObj, modelInfoObj, modelName: returnedModelName } = result;-const response = await testConnectionRequest(accessToken, litellmParamsObj, modelInfoObj?.mode);if (response.status === "success") {message.success("Connection test successful!");@@ -70,8 +80,14 @@ const ConnectionErrorDisplay: React.FC<ConnectionErrorDisplayProps> = ({};React.useEffect(() => {- testModelConnection();- }, []);+ // Run the test once when component mounts+ // Add a small timeout to ensure form values are ready+ const timer = setTimeout(() => {+ testModelConnection();+ }, 200);++ return () => clearTimeout(timer);+ }, []); // Empty dependency array means this runs once on mountconst getCleanErrorMessage = (errorMsg: string) => {if (!errorMsg) return "Unknown error";