fix: correct PUT /api/v1/provider silently dropping model_type, endpoint_url, encrypted_config (#1627)

The _UPDATABLE_FIELDS whitelist used obsolete field names (api_base,
extra_config) that no longer exist in the ModelProvider model. When
updating a provider via PUT, the actual fields model_type,
endpoint_url and encrypted_config were silently ignored.

Updated the whitelist to use the correct field names matching the
ModelProvider model definition.

Closes #1627
This commit is contained in:
carlosjarenom 2026-06-09 16:45:01 +02:00
parent 247b4553d7
commit 4c0feade12

View file

@ -66,7 +66,7 @@ class ProviderService:
if not model:
return {"success": False, "error_code": "PROVIDER_NOT_FOUND"}
# H10: only allow updating safe fields
_UPDATABLE_FIELDS = {"provider_name", "api_key", "api_base", "extra_config", "prefer", "is_vaild"}
_UPDATABLE_FIELDS = {"provider_name", "model_type", "api_key", "endpoint_url", "encrypted_config", "prefer", "is_vaild"}
for key, value in data.items():
if key in _UPDATABLE_FIELDS:
setattr(model, key, value)