mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(proxy): let the config file win over the stored row in ui settings
This commit is contained in:
parent
1cc38f05f4
commit
a5cce1b859
2 changed files with 9 additions and 6 deletions
|
|
@ -1763,8 +1763,8 @@ async def get_ui_settings():
|
|||
|
||||
effective_ui_settings: Final[Mapping[str, object]] = MappingProxyType(
|
||||
{
|
||||
**{key: proxy_config.settings[key] for key in ALLOWED_UI_SETTINGS_FIELDS if key in proxy_config.settings},
|
||||
**ui_settings,
|
||||
**{key: proxy_config.settings[key] for key in ALLOWED_UI_SETTINGS_FIELDS if key in proxy_config.settings},
|
||||
}
|
||||
)
|
||||
config: Final[Mapping[str, object]] = MappingProxyType(
|
||||
|
|
@ -1787,9 +1787,9 @@ async def get_ui_settings():
|
|||
source: Final[Mapping[str, FieldSource]] = MappingProxyType(
|
||||
{
|
||||
key: (
|
||||
"db"
|
||||
if key in ui_settings
|
||||
else _ui_setting_source(key, values[key], proxy_config.settings, settings_class)
|
||||
_ui_setting_source(key, values[key], proxy_config.settings, settings_class)
|
||||
if key in proxy_config.settings or key not in ui_settings
|
||||
else "db"
|
||||
)
|
||||
for key in values
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1352,6 +1352,7 @@ class TestProxySettingEndpoints:
|
|||
mock_db_record = MagicMock()
|
||||
mock_db_record.ui_settings = {
|
||||
"disable_model_add_for_internal_users": True,
|
||||
"require_auth_for_public_ai_hub": True,
|
||||
}
|
||||
mock_prisma.db.litellm_uisettings.find_unique = AsyncMock(
|
||||
return_value=mock_db_record
|
||||
|
|
@ -1376,10 +1377,12 @@ class TestProxySettingEndpoints:
|
|||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["values"]["disable_model_add_for_internal_users"] is True
|
||||
assert data["values"]["disable_model_add_for_internal_users"] is False
|
||||
assert data["values"]["forward_client_headers_to_llm_api"] is True
|
||||
assert data["source"]["disable_model_add_for_internal_users"] == "db"
|
||||
assert data["values"]["require_auth_for_public_ai_hub"] is True
|
||||
assert data["source"]["disable_model_add_for_internal_users"] == "config"
|
||||
assert data["source"]["forward_client_headers_to_llm_api"] == "config"
|
||||
assert data["source"]["require_auth_for_public_ai_hub"] == "db"
|
||||
|
||||
def test_get_ui_settings_schema_description_preserved_with_extensions(
|
||||
self, mock_auth, monkeypatch
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue