From 511b133b0bc0ba0d0ccf3a60de9c3c136b573152 Mon Sep 17 00:00:00 2001 From: shivam Date: Thu, 10 Sep 2026 23:24:51 +0000 Subject: [PATCH] fix(ui): send explicit null when disabling cache control injection points Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- ui/litellm-dashboard/src/components/model_info_view.test.tsx | 4 ++-- ui/litellm-dashboard/src/components/model_info_view.tsx | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) 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; }