diff --git a/ui/litellm-dashboard/src/components/model_info_view.test.tsx b/ui/litellm-dashboard/src/components/model_info_view.test.tsx index 3db9418dfb9..4fcae534167 100644 --- a/ui/litellm-dashboard/src/components/model_info_view.test.tsx +++ b/ui/litellm-dashboard/src/components/model_info_view.test.tsx @@ -1707,7 +1707,7 @@ describe("ModelInfoView", () => { expect(payload.litellm_params.cache_control_injection_points).toEqual([{ location: "message", role: "user" }]); }); - it("drops the stored injection points when the operator turns the toggle off", async () => { + it("sends an explicit null when the operator turns the toggle off so the backend clears the stored points", async () => { withCachePoints([{ location: "message", role: "user" }]); const user = userEvent.setup(); await enterEditMode(user); @@ -1715,7 +1715,7 @@ describe("ModelInfoView", () => { await user.click(screen.getByRole("switch")); const payload = await save(user); - expect(payload.litellm_params).not.toHaveProperty("cache_control_injection_points"); + expect(payload.litellm_params.cache_control_injection_points).toBeNull(); }); it("adds a typed index as a string, matching what the deployment already stores", async () => { diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsx index 35afcdb2985..9072247fa65 100644 --- a/ui/litellm-dashboard/src/components/model_info_view.tsx +++ b/ui/litellm-dashboard/src/components/model_info_view.tsx @@ -396,8 +396,11 @@ export default function ModelInfoView({ } // Handle cache control settings + const hadInjectionPoints = Boolean(localModelData?.litellm_params?.cache_control_injection_points); if (values.cache_control && (values.cache_control_injection_points?.length ?? 0) > 0) { updatedLitellmParams.cache_control_injection_points = values.cache_control_injection_points; + } else if (hadInjectionPoints) { + updatedLitellmParams.cache_control_injection_points = null; } else { delete updatedLitellmParams.cache_control_injection_points; }