From 9feb61b48997d7eb1e3592a15f9be961166bc26d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=86=AF=E5=9F=BA=E9=AD=81?= <1412414664@qq.com>
Date: Sun, 7 Jun 2026 18:47:47 +0800
Subject: [PATCH] fix(ui): save routing groups as list
---
.../components/router_settings/index.test.tsx | 29 +++++++++++++++++++
.../src/components/router_settings/index.tsx | 2 +-
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx b/ui/litellm-dashboard/src/components/router_settings/index.test.tsx
index 78a0b4b0dffc..658f7ec83d2c 100644
--- a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx
+++ b/ui/litellm-dashboard/src/components/router_settings/index.test.tsx
@@ -34,6 +34,7 @@ const mockCallbacksResponse = {
routing_strategy: "simple-shuffle",
num_retries: 3,
timeout: 30,
+ routing_groups: [],
},
};
@@ -134,6 +135,34 @@ describe("RouterSettings", () => {
);
});
+ it("should send routing_groups as a list when saving load balancing settings", async () => {
+ const user = userEvent.setup();
+ renderWithProviders();
+
+ await waitFor(() => {
+ expect(screen.getByRole("textbox", { name: /routing_groups/i })).toBeInTheDocument();
+ });
+
+ await user.click(screen.getByRole("button", { name: /save changes/i }));
+
+ expect(setCallbacksCall).toHaveBeenCalledWith(
+ "test-token",
+ expect.objectContaining({
+ router_settings: expect.objectContaining({
+ routing_groups: [],
+ }),
+ }),
+ );
+ expect(setCallbacksCall).not.toHaveBeenCalledWith(
+ "test-token",
+ expect.objectContaining({
+ router_settings: expect.objectContaining({
+ routing_groups: "[]",
+ }),
+ }),
+ );
+ });
+
it("should show a success notification after saving", async () => {
const user = userEvent.setup();
renderWithProviders();
diff --git a/ui/litellm-dashboard/src/components/router_settings/index.tsx b/ui/litellm-dashboard/src/components/router_settings/index.tsx
index 7cd59ab1bf6c..b567f2af1ee6 100644
--- a/ui/litellm-dashboard/src/components/router_settings/index.tsx
+++ b/ui/litellm-dashboard/src/components/router_settings/index.tsx
@@ -91,7 +91,7 @@ const RouterSettings: React.FC = ({ accessToken, userRole,
console.log("router_settings", router_settings);
const numberKeys = new Set(["allowed_fails", "cooldown_time", "num_retries", "timeout", "retry_after"]);
- const jsonKeys = new Set(["model_group_alias", "retry_policy"]);
+ const jsonKeys = new Set(["model_group_alias", "retry_policy", "routing_groups"]);
const parseInputValue = (key: string, raw: string | undefined, fallback: unknown) => {
if (raw === undefined) return fallback;