mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
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).
This commit is contained in:
parent
fba3bbe47a
commit
445c1fa0ec
1 changed files with 8 additions and 3 deletions
|
|
@ -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 || "",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue