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(ui): label the virtual key source and unstick a cancelled model load
mubashir1osmanif4fb4e0bea79
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsxindex 8e242e6ec35..32f1013f386 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.test.tsx@@ -475,4 +475,71 @@ describe("ChatUI", () => {expect(await screen.findByText("clip.wav")).toBeInTheDocument();});++ it("should name the virtual key source options instead of showing raw values", async () => {+ const user = userEvent.setup();++ render(+ <ChatUI+ accessToken="1234567890"+ token="1234567890"+ userRole="user"+ userID="1234567890"+ disabledPersonalKeyCreation={false}+ />,+ );++ await waitFor(() => {+ expect(screen.getByText("Test Key")).toBeInTheDocument();+ });++ const keySourceTrigger = screen.getByLabelText("Virtual Key Source");+ expect(keySourceTrigger).toHaveTextContent("Current UI Session");+ expect(keySourceTrigger).not.toHaveTextContent("session");++ await user.click(keySourceTrigger);+ await user.click(await screen.findByRole("option", { name: "Virtual Key" }));++ await waitFor(() => {+ expect(screen.getByLabelText("Virtual Key Source")).toHaveTextContent("Virtual Key");+ });+ expect(screen.getByLabelText("Virtual Key Source")).not.toHaveTextContent("custom");+ });++ it("should re-enable the model selector when the virtual key is cleared mid-load", async () => {+ const user = userEvent.setup();+ (fetchModelsModule.fetchAvailableModels as ReturnType<typeof vi.fn>).mockImplementation(+ () => new Promise(() => {}),+ );++ render(+ <ChatUI+ accessToken="1234567890"+ token="1234567890"+ userRole="user"+ userID="1234567890"+ disabledPersonalKeyCreation={false}+ />,+ );++ await waitFor(() => {+ expect(screen.getByText("Test Key")).toBeInTheDocument();+ });++ await user.click(screen.getByLabelText("Virtual Key Source"));+ await user.click(await screen.findByRole("option", { name: "Virtual Key" }));++ const keyField = await screen.findByPlaceholderText("Enter custom Virtual Key");+ await user.type(keyField, "sk-test");++ await waitFor(() => {+ expect(screen.getByPlaceholderText("Loading models...")).toBeInTheDocument();+ });++ await user.clear(keyField);++ await waitFor(() => {+ expect(screen.getByPlaceholderText("Select a Model")).not.toBeDisabled();+ });+ });});diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsxindex f3d79dd3a2f..9ef44589240 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/ChatUI.tsx@@ -407,6 +407,7 @@ const ChatUI: React.FC<ChatUIProps> = ({if (!userApiKey) {setModelInfo([]);setModelLoadError(false);+ setIsLoadingModels(false);return;}@@ -1240,7 +1241,7 @@ const ChatUI: React.FC<ChatUIProps> = ({}}><SelectTrigger className="w-full" size="sm" aria-label="Virtual Key Source">- <SelectValue />+ <SelectValue>{apiKeySource === "custom" ? "Virtual Key" : "Current UI Session"}</SelectValue></SelectTrigger><SelectContent><SelectItem value="session">Current UI Session</SelectItem>