From 1ceb7d8e29aa543522118ada992467d31d4f9a55 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 19 Feb 2026 12:48:27 +0530 Subject: [PATCH] Add default query param in UI --- .../src/components/add_pass_through.tsx | 29 ++++++++++ .../src/components/pass_through_settings.tsx | 1 + .../src/components/query_param_input.tsx | 57 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 ui/litellm-dashboard/src/components/query_param_input.tsx diff --git a/ui/litellm-dashboard/src/components/add_pass_through.tsx b/ui/litellm-dashboard/src/components/add_pass_through.tsx index 07850bca087..af55a7919a9 100644 --- a/ui/litellm-dashboard/src/components/add_pass_through.tsx +++ b/ui/litellm-dashboard/src/components/add_pass_through.tsx @@ -23,6 +23,7 @@ import { ApiOutlined, } from "@ant-design/icons"; import KeyValueInput from "./key_value_input"; +import QueryParamInput from "./query_param_input"; import { passThroughItem } from "./pass_through_settings"; import RoutePreview from "./route_preview"; import NotificationsManager from "./molecules/notifications_manager"; @@ -295,6 +296,34 @@ const AddPassThroughEndpoint: React.FC = ({ + {/* Default Query Parameters Section */} + + Default Query Parameters + + Add query parameters that will be automatically sent with every request to the target API + + + + Default Query Parameters (Optional) + + + + + } + name="default_query_params" + extra={ +
+
Parameters are sent with all GET, POST, PUT, PATCH requests
+
Client parameters override defaults. Examples: version=v1, format=json, key=default
+
+ } + > + +
+
+ {/* Security Section */} ; + default_query_params?: Record; } // Password field component for headers diff --git a/ui/litellm-dashboard/src/components/query_param_input.tsx b/ui/litellm-dashboard/src/components/query_param_input.tsx new file mode 100644 index 00000000000..4a98ab48bca --- /dev/null +++ b/ui/litellm-dashboard/src/components/query_param_input.tsx @@ -0,0 +1,57 @@ +import React, { useState } from "react"; +import { Button, Space } from "antd"; +import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; +import { TextInput } from "@tremor/react"; + +interface QueryParamInputProps { + value?: Record; + onChange?: (value: Record) => void; +} + +const QueryParamInput: React.FC = ({ value = {}, onChange }) => { + const [pairs, setPairs] = useState<[string, string][]>(Object.entries(value)); + + const handleAdd = () => { + setPairs([...pairs, ["", ""]]); + }; + + const handleRemove = (index: number) => { + const newPairs = pairs.filter((_, i) => i !== index); + setPairs(newPairs); + onChange?.(Object.fromEntries(newPairs)); + }; + + const handleChange = (index: number, key: string, val: string) => { + const newPairs = [...pairs]; + newPairs[index] = [key, val]; + setPairs(newPairs); + onChange?.(Object.fromEntries(newPairs)); + }; + + return ( +
+ {pairs.map(([key, val], index) => ( + + handleChange(index, e.target.value, val)} + /> + handleChange(index, key, e.target.value)} + /> +
+ handleRemove(index)} style={{ cursor: "pointer" }} /> +
+
+ ))} + +
+ ); +}; + +export default QueryParamInput; \ No newline at end of file