fix(account): clean up stale credentials fields after spreading currentCredentials

When customErrorCodes is disabled or modelMapping is empty, explicitly
delete the fields inherited from currentCredentials spread to avoid
preserving stale values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Gemini Wen
2026-03-06 23:38:58 +08:00
parent 3c83cd8be2
commit 9f7ad47598

View File

@@ -2275,6 +2275,8 @@ const handleSubmit = async () => {
const modelMapping = buildModelMappingObject(modelRestrictionMode.value, allowedModels.value, modelMappings.value) const modelMapping = buildModelMappingObject(modelRestrictionMode.value, allowedModels.value, modelMappings.value)
if (modelMapping) { if (modelMapping) {
newCredentials.model_mapping = modelMapping newCredentials.model_mapping = modelMapping
} else {
delete newCredentials.model_mapping
} }
} else if (currentCredentials.model_mapping) { } else if (currentCredentials.model_mapping) {
newCredentials.model_mapping = currentCredentials.model_mapping newCredentials.model_mapping = currentCredentials.model_mapping
@@ -2284,6 +2286,9 @@ const handleSubmit = async () => {
if (customErrorCodesEnabled.value) { if (customErrorCodesEnabled.value) {
newCredentials.custom_error_codes_enabled = true newCredentials.custom_error_codes_enabled = true
newCredentials.custom_error_codes = [...selectedErrorCodes.value] newCredentials.custom_error_codes = [...selectedErrorCodes.value]
} else {
delete newCredentials.custom_error_codes_enabled
delete newCredentials.custom_error_codes
} }
// Add intercept warmup requests setting // Add intercept warmup requests setting