From 445c1fa0ec55aa13d7f5f80c0d6e4c564d660900 Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Sat, 4 Apr 2026 11:01:40 -0700 Subject: [PATCH] fix(ui): preserve clear-vector-stores intent on model edit Follow-up to the previous commit. The initial fix correctly prevented injecting vector_store_ids: [] when the user never set any, but broke the inverse case: a user who had ["vs_abc"] set and cleared the selector would have their change silently ignored, because the handler deleted the key from the PATCH payload and the backend's merge kept the old value. Distinguish "never touched" from "explicitly cleared" by initializing the form field to undefined (not []) when the model has no stores, and adding a middle branch in the submit handler that sends [] when the form value is [] (user cleared) versus deleting the key when it's undefined (user never touched). --- .../src/components/model_info_view.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsx index e14fc0c5f6c..205998476c2 100644 --- a/ui/litellm-dashboard/src/components/model_info_view.tsx +++ b/ui/litellm-dashboard/src/components/model_info_view.tsx @@ -267,6 +267,9 @@ export default function ModelInfoView({ } if (values.vector_store_ids?.length > 0) { updatedLitellmParams.vector_store_ids = values.vector_store_ids; + } else if (values.vector_store_ids !== undefined) { + // User explicitly cleared previously-set vector stores — send [] to clear on backend + updatedLitellmParams.vector_store_ids = []; } else { delete updatedLitellmParams.vector_store_ids; } @@ -631,9 +634,11 @@ export default function ModelInfoView({ guardrails: Array.isArray(localModelData.litellm_params?.guardrails) ? localModelData.litellm_params.guardrails : [], - vector_store_ids: Array.isArray(localModelData.litellm_params?.vector_store_ids) - ? localModelData.litellm_params.vector_store_ids - : [], + vector_store_ids: + Array.isArray(localModelData.litellm_params?.vector_store_ids) && + localModelData.litellm_params.vector_store_ids.length > 0 + ? localModelData.litellm_params.vector_store_ids + : undefined, tags: Array.isArray(localModelData.litellm_params?.tags) ? localModelData.litellm_params.tags : [], health_check_model: isWildcardModel ? localModelData.model_info?.health_check_model : null, litellm_credential_name: localModelData.litellm_params?.litellm_credential_name || "",