mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
update_internal_user_settings
This commit is contained in:
parent
02db6f9d86
commit
508b474a1f
1 changed files with 36 additions and 0 deletions
|
@ -161,3 +161,39 @@ async def get_sso_settings():
|
|||
}
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@router.patch(
|
||||
"/update/internal_user_settings",
|
||||
tags=["SSO Settings"],
|
||||
dependencies=[Depends(user_api_key_auth)],
|
||||
)
|
||||
async def update_internal_user_settings(settings: DefaultInternalUserParams):
|
||||
"""
|
||||
Update the default internal user parameters for SSO users.
|
||||
These settings will be applied to new users who sign in via SSO.
|
||||
"""
|
||||
from litellm.proxy.proxy_server import proxy_config
|
||||
|
||||
# Update the in-memory settings
|
||||
litellm.default_internal_user_params = settings.model_dump(exclude_none=True)
|
||||
|
||||
# Load existing config
|
||||
config = await proxy_config.get_config()
|
||||
|
||||
# Update config with new settings
|
||||
if "litellm_settings" not in config:
|
||||
config["litellm_settings"] = {}
|
||||
|
||||
config["litellm_settings"]["default_internal_user_params"] = settings.model_dump(
|
||||
exclude_none=True
|
||||
)
|
||||
|
||||
# Save the updated config
|
||||
await proxy_config.save_config(new_config=config)
|
||||
|
||||
return {
|
||||
"message": "Internal user settings updated successfully",
|
||||
"status": "success",
|
||||
"settings": litellm.default_internal_user_params,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue