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>
This commit is contained in:
shivam 2026-09-10 23:24:51 +00:00
parent dce2991085
commit 511b133b0b
2 changed files with 5 additions and 2 deletions

View file

@ -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 () => {

View file

@ -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;
}