Skip to content

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]

feat(ui): migrate agents and router-settings to path routes (#30323)

ryan-crabbe-berri8b9a90e0fcb1
diff --git a/ui/litellm-dashboard/e2e_tests/fixtures/migratedPages.ts b/ui/litellm-dashboard/e2e_tests/fixtures/migratedPages.ts
index d0dde5a8155..d20c7f2ca46 100644
--- a/ui/litellm-dashboard/e2e_tests/fixtures/migratedPages.ts
+++ b/ui/litellm-dashboard/e2e_tests/fixtures/migratedPages.ts
@@ -37,6 +37,8 @@ export const MIGRATED_E2E_PAGES: Record<string, string> = {
"logging-and-alerts": "logging-and-alerts",
"model-hub-table": "model-hub-table",
new_usage: "usage",
+ agents: "agents",
+ "router-settings": "router-settings",
};
export const MIGRATED_E2E_SEGMENTS: string[] = [...new Set(Object.values(MIGRATED_E2E_PAGES))];
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx
new file mode 100644
index 00000000000..d60daae13a7
--- /dev/null
+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx
@@ -0,0 +1,11 @@
+"use client";
+
+import AgentsPanel from "@/components/agents";
+import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
+import { useTeams } from "@/app/(dashboard)/hooks/teams/useTeams";
+
+export default function Agents() {
+ const { accessToken, userRole } = useAuthorized();
+ const { data: teams } = useTeams();
+ return <AgentsPanel accessToken={accessToken} userRole={userRole} teams={teams ?? null} />;
+}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/page.tsx
index 45ec0f62357..a4574c876d7 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/page.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/page.tsx
@@ -1,11 +1,9 @@
"use client";
import ModelsAndEndpointsView from "@/app/(dashboard)/models-and-endpoints/ModelsAndEndpointsView";
-import AgentsPanel from "@/components/agents";
import { teamListCall as v2TeamListCall } from "@/app/(dashboard)/hooks/teams/useTeams";
import { useUISettings } from "@/app/(dashboard)/hooks/uiSettings/useUISettings";
import LoadingScreen from "@/components/common_components/LoadingScreen";
-import GeneralSettings from "@/components/general_settings";
import { Team } from "@/components/key_team_helpers/key_list";
import { Organization, proxyBaseUrl, getInProductNudgesCall } from "@/components/networking";
import OldTeams from "@/components/OldTeams";
@@ -355,10 +353,6 @@ function CreateKeyPageContent() {
userRole={userRole}
premiumUser={premiumUser}
/>
- ) : page == "agents" ? (
- <AgentsPanel accessToken={accessToken} userRole={userRole} teams={teams} />
- ) : page == "router-settings" ? (
- <GeneralSettings userID={userID} userRole={userRole} accessToken={accessToken} modelData={modelData} />
) : page == "pass-through-settings" ? (
<PassThroughSettings
userID={userID}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/router-settings/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/router-settings/page.tsx
new file mode 100644
index 00000000000..46029b529ec
--- /dev/null
+++ b/ui/litellm-dashboard/src/app/(dashboard)/router-settings/page.tsx
@@ -0,0 +1,9 @@
+"use client";
+
+import GeneralSettings from "@/components/general_settings";
+import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
+
+export default function RouterSettingsPage() {
+ const { accessToken, userRole, userId } = useAuthorized();
+ return <GeneralSettings userID={userId} userRole={userRole} accessToken={accessToken} />;
+}
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.tsx
index 8147189ddcc..a8eed645036 100644
--- a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/AddFallbacks.tsx
@@ -18,13 +18,12 @@ export type FallbackEntry = { [modelName: string]: string[] };
export type Fallbacks = FallbackEntry[];
interface AddFallbacksProps {
- models?: string[];
accessToken: string;
value?: Fallbacks; // Current fallbacks value from form
onChange?: (fallbacks: Fallbacks) => Promise<void>; // Callback to update form value
}
-export default function AddFallbacks({ models, accessToken, value = [], onChange }: AddFallbacksProps) {
+export default function AddFallbacks({ accessToken, value = [], onChange }: AddFallbacksProps) {
const [isModalVisible, setIsModalVisible] = useState(false);
const [modelInfo, setModelInfo] = useState<ModelGroup[]>([]);
const [modalKey, setModalKey] = useState(0); // Key to force remount of form when modal opens
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx
index 513abb78590..91a5b305999 100644
--- a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.test.tsx
@@ -79,10 +79,6 @@ describe("Fallbacks", () => {
const mockAccessToken = "test-token";
const mockUserRole = "Admin";
const mockUserID = "user-123";
- const mockModelData = {
- data: [{ model_name: "gpt-4" }, { model_name: "gpt-3.5-turbo" }, { model_name: "claude-3-opus" }],
- };
-
const mockRouterSettings = {
fallbacks: [{ "gpt-4": ["gpt-3.5-turbo", "claude-3-opus"] }, { "claude-3-opus": ["gpt-4"] }],
};
@@ -91,7 +87,6 @@ describe("Fallbacks", () => {
accessToken: mockAccessToken,
userRole: mockUserRole,
userID: mockUserID,
- modelData: mockModelData,
};
const getFirstRowDeleteButton = () => {
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx
index 55abe698f7e..a074473147a 100644
--- a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/Fallbacks.tsx
@@ -65,7 +65,6 @@ interface FallbacksProps {
accessToken: string | null;
userRole: string | null;
userID: string | null;
- modelData: any;
}
async function testFallbackModelResponse(selectedModel: string, accessToken: string) {
@@ -115,7 +114,7 @@ async function testFallbackModelResponse(selectedModel: string, accessToken: str
}
}
-const Fallbacks: React.FC<FallbacksProps> = ({ accessToken, userRole, userID, modelData }) => {
+const Fallbacks: React.FC<FallbacksProps> = ({ accessToken, userRole, userID }) => {
const [routerSettings, setRouterSettings] = useState<{ [key: string]: any }>({});
const [isDeleting, setIsDeleting] = useState(false);
const [fallbackToDelete, setFallbackToDelete] = useState<FallbackEntry | null>(null);
@@ -243,7 +242,6 @@ const Fallbacks: React.FC<FallbacksProps> = ({ accessToken, userRole, userID, mo
<>
{canModify && (
<AddFallbacks
- models={modelData?.data ? modelData.data.map((data: any) => data.model_name) : []}
accessToken={accessToken || ""}
value={routerSettings.fallbacks || []}
onChange={handleFallbacksChange}
diff --git a/ui/litellm-dashboard/src/components/general_settings.tsx b/ui/litellm-dashboard/src/components/general_settings.tsx
index f145d5933f3..8ed3787f8fa 100644
--- a/ui/litellm-dashboard/src/components/general_settings.tsx
+++ b/ui/litellm-dashboard/src/components/general_settings.tsx
@@ -25,7 +25,6 @@ interface GeneralSettingsPageProps {
accessToken: string | null;
userRole: string | null;
userID: string | null;
- modelData: any;
}
interface generalSettingsItem {
@@ -36,7 +35,7 @@ interface generalSettingsItem {
stored_in_db: boolean | null;
}
-const GeneralSettings: React.FC<GeneralSettingsPageProps> = ({ accessToken, userRole, userID, modelData }) => {
+const GeneralSettings: React.FC<GeneralSettingsPageProps> = ({ accessToken, userRole, userID }) => {
const [generalSettings, setGeneralSettings] = useState<generalSettingsItem[]>([]);
useEffect(() => {
@@ -113,13 +112,13 @@ const GeneralSettings: React.FC<GeneralSettingsPageProps> = ({ accessToken, user
</TabList>
<TabPanels className="px-8 py-6">
<TabPanel>
- <RouterSettings accessToken={accessToken} userRole={userRole} userID={userID} modelData={modelData} />
+ <RouterSettings accessToken={accessToken} userRole={userRole} userID={userID} />
</TabPanel>
<TabPanel>
<RoutingGroups />
</TabPanel>
<TabPanel>
- <Fallbacks accessToken={accessToken} userRole={userRole} userID={userID} modelData={modelData} />
+ <Fallbacks accessToken={accessToken} userRole={userRole} userID={userID} />
</TabPanel>
<TabPanel>
<Card>
diff --git a/ui/litellm-dashboard/src/components/router_settings/index.tsx b/ui/litellm-dashboard/src/components/router_settings/index.tsx
index 7cd59ab1bf6..d81765a1621 100644
--- a/ui/litellm-dashboard/src/components/router_settings/index.tsx
+++ b/ui/litellm-dashboard/src/components/router_settings/index.tsx
@@ -8,7 +8,6 @@ interface RouterSettingsProps {
accessToken: string | null;
userRole: string | null;
userID: string | null;
- modelData: any;
}
interface routingStrategyArgs {
@@ -16,7 +15,7 @@ interface routingStrategyArgs {
lowest_latency_buffer?: number;
}
-const RouterSettings: React.FC<RouterSettingsProps> = ({ accessToken, userRole, userID, modelData }) => {
+const RouterSettings: React.FC<RouterSettingsProps> = ({ accessToken, userRole, userID }) => {
const [formValue, setFormValue] = useState<RouterSettingsFormValue>({
routerSettings: {},
selectedStrategy: null,
diff --git a/ui/litellm-dashboard/src/utils/migratedPages.test.ts b/ui/litellm-dashboard/src/utils/migratedPages.test.ts
index 7e74fa1eec4..5d59a0947d4 100644
--- a/ui/litellm-dashboard/src/utils/migratedPages.test.ts
+++ b/ui/litellm-dashboard/src/utils/migratedPages.test.ts
@@ -111,6 +111,14 @@ describe("migratedHref / legacyPageHref", () => {
expect(MIGRATED_PAGES.new_usage).toBe("usage");
expect(MIGRATED_PAGES.usage).toBeUndefined();
});
+
+ it("maps the agents and router-settings ids to their routes", async () => {
+ vi.doMock("@/components/networking", () => ({ serverRootPath: "/" }));
+ const { MIGRATED_PAGES } = await import("./migratedPages");
+
+ expect(MIGRATED_PAGES.agents).toBe("agents");
+ expect(MIGRATED_PAGES["router-settings"]).toBe("router-settings");
+ });
});
describe("dev server (NODE_ENV=development)", () => {
diff --git a/ui/litellm-dashboard/src/utils/migratedPages.ts b/ui/litellm-dashboard/src/utils/migratedPages.ts
index 46cdd0d7476..d86188f5a4b 100644
--- a/ui/litellm-dashboard/src/utils/migratedPages.ts
+++ b/ui/litellm-dashboard/src/utils/migratedPages.ts
@@ -40,6 +40,8 @@ export const MIGRATED_PAGES: Record<string, string> = {
"model-hub-table": "model-hub-table",
// The modern usage dashboard; the old ?page=usage report stays on the legacy switch.
new_usage: "usage",
+ agents: "agents",
+ "router-settings": "router-settings",
};
function uiBase(): string {