From bb22f0718b13e2258b920975c066675124b809f7 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 9 Apr 2024 07:19:27 -0700 Subject: [PATCH 1/2] fix - ui qa --- litellm/proxy/proxy_server.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index f0791a40f41..5291801e46d 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1835,26 +1835,8 @@ class ProxyConfig: return config async def save_config(self, new_config: dict): - global prisma_client, llm_router, user_config_file_path, llm_model_list, general_settings + global prisma_client, general_settings, user_config_file_path # Load existing config - backup_config = await self.get_config() - - # update Router - verifies if this is a valid config - try: - ( - llm_router, - llm_model_list, - general_settings, - ) = await proxy_config.load_config( - router=llm_router, config_file_path=user_config_file_path - ) - except Exception as e: - traceback.print_exc() - # Revert to old config instead - with open(f"{user_config_file_path}", "w") as config_file: - yaml.dump(backup_config, config_file, default_flow_style=False) - raise HTTPException(status_code=400, detail="Invalid config passed in") - ## DB - writes valid config to db """ - Do not write restricted params like 'api_key' to the database @@ -7975,8 +7957,6 @@ async def update_config(config_info: ConfigYAML): # Load existing config config = await proxy_config.get_config() - - backup_config = copy.deepcopy(config) verbose_proxy_logger.debug("Loaded config: %s", config) # update the general settings From 23ce5c2fad5f513bc10241333355d1e1aa5ee22c Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 9 Apr 2024 07:32:24 -0700 Subject: [PATCH 2/2] instantly add deployment on /model/new --- litellm/proxy/proxy_server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 5291801e46d..bfba52969b5 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -6900,7 +6900,7 @@ async def add_new_model( model_params: Deployment, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): - global llm_router, llm_model_list, general_settings, user_config_file_path, proxy_config, prisma_client, master_key, store_model_in_db + global llm_router, llm_model_list, general_settings, user_config_file_path, proxy_config, prisma_client, master_key, store_model_in_db, proxy_logging_obj try: import base64 @@ -6939,6 +6939,11 @@ async def add_new_model( "updated_by": user_api_key_dict.user_id or litellm_proxy_admin_name, } ) + + await proxy_config.add_deployment( + prisma_client=prisma_client, proxy_logging_obj=proxy_logging_obj + ) + else: raise HTTPException( status_code=500,