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): key prompt table rows by environment and dedupe key prompt options
mateo-berri6f94554713ea
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/PromptTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/PromptTable.tsxindex 47d4f64f254..a64d7dbfe0c 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/PromptTable.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/prompts/_components/PromptTable.tsx@@ -74,7 +74,9 @@ const PromptTable: React.FC<PromptTableProps> = ({<DataTabledata={promptsList}columns={columns}- getRowId={(prompt, index) => prompt.prompt_id || String(index)}+ getRowId={(prompt, index) =>+ prompt.prompt_id ? `${prompt.prompt_id}::${prompt.environment || "development"}` : String(index)+ }sortingMode="client"sorting={sorting}onSortingChange={setSorting}diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsxindex e1e6dcfa442..d0da4ddfb2b 100644--- a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx+++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx@@ -349,7 +349,7 @@ const CreateKey: React.FC<CreateKeyProps> = ({ team, teams, data, addKey, autoOpconst fetchPrompts = async () => {try {const response = await getPromptsList(accessToken);- setPromptsList(response.prompts.map((prompt) => prompt.prompt_id));+ setPromptsList(Array.from(new Set(response.prompts.map((prompt) => prompt.prompt_id))));} catch (error) {console.error("Failed to fetch prompts:", error);}diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.test.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.test.tsxindex bf8f43b8b5f..08edce6eda1 100644--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.test.tsx+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.test.tsx@@ -425,6 +425,22 @@ describe("KeyEditView", () => {expect(screen.getByText("Policies")).toBeInTheDocument();});+ it("lists a prompt existing in several environments once in the dropdown", async () => {+ vi.mocked(getPromptsList).mockResolvedValueOnce({+ prompts: [+ { prompt_id: "envgreet", litellm_params: {}, prompt_info: { prompt_type: "db" }, environment: "development" },+ { prompt_id: "envgreet", litellm_params: {}, prompt_info: { prompt_type: "db" }, environment: "production" },+ ],+ });++ renderAs("Admin");++ const prompts = await screen.findByLabelText(/Prompts/);+ await userEvent.type(prompts, "envgreet");++ expect(await screen.findAllByRole("option", { name: "envgreet" })).toHaveLength(1);+ });+it("should omit both fields and fire neither admin-only request for an internal user", async () => {renderAs("Internal User");diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsxindex df1af2ca8e9..d4a8a804f29 100644--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx@@ -165,7 +165,7 @@ export function KeyEditView({if (!accessToken) return;try {const response = await getPromptsList(accessToken);- setPromptsList(response.prompts.map((prompt) => prompt.prompt_id));+ setPromptsList(Array.from(new Set(response.prompts.map((prompt) => prompt.prompt_id))));} catch (error) {console.error("Failed to fetch prompts:", error);}