88import os
99import platform
1010import re
11- from typing import Any , Dict , List , Optional , Union
11+ from typing import Any , Dict , List , Optional , Union , override
1212
1313from pydantic import TypeAdapter
1414from ruamel .yaml import YAML
@@ -136,13 +136,14 @@ def is_client_installed(self) -> bool:
136136 pass
137137
138138 @abc .abstractmethod
139- def activate_profile (self , profile_name : str , router_config : Dict [str , Any ]) -> bool :
139+ def activate_profile (self , profile_name : str , router_config : Dict [str , Any ], alias_name : str | None = None ) -> bool :
140140 """
141141 Activate a profile in the client config
142142
143143 Args:
144144 profile_name: Name of the profile
145145 router_config: Router configuration
146+ alias_name: Alias name for the router in client config
146147
147148 Returns:
148149 bool: Success or failure
@@ -406,11 +407,13 @@ def is_client_installed(self) -> bool:
406407 # Can be overridden by subclasses
407408 return os .path .isdir (os .path .dirname (self .config_path ))
408409
409- def activate_profile (self , profile_name : str , router_config : Dict [str , Any ]) -> bool :
410+ def activate_profile (self , profile_name : str , router_config : Dict [str , Any ], alias_name : str | None = None ) -> bool :
410411 """Activate a profile in the client config
411412
412413 Args:
413414 profile_name: Name of the profile
415+ router_config: Router configuration
416+ alias_name: Alias name for the router in client config
414417
415418 Returns:
416419 bool: Success or failure
@@ -419,11 +422,11 @@ def activate_profile(self, profile_name: str, router_config: Dict[str, Any]) ->
419422 port = router_config ["port" ]
420423 default_base_url = f"http://{ host } :{ port } /sse"
421424
422- server_config = self ._format_router_server (profile_name , default_base_url )
425+ server_config = self ._format_router_server (profile_name , default_base_url , alias_name )
423426 return self .add_server (server_config )
424427
425- def _format_router_server (self , profile_name , base_url ) -> ServerConfig :
426- return format_server_url (self .client_key , profile_name , base_url )
428+ def _format_router_server (self , profile_name , base_url , alias_name : str | None = None ) -> ServerConfig :
429+ return format_server_url (self .client_key , profile_name , base_url , alias_name )
427430
428431 def deactivate_profile (self ) -> bool :
429432 """Deactivate a profile in the client config
@@ -673,7 +676,7 @@ def is_client_installed(self) -> bool:
673676 # Check if the config directory exists
674677 return os .path .isdir (os .path .dirname (self .config_path ))
675678
676- def activate_profile (self , profile_name : str , router_config : Dict [str , Any ]) -> bool :
679+ def activate_profile (self , profile_name : str , router_config : Dict [str , Any ], alias_name : str | None = None ) -> bool :
677680 """Activate a profile in the client config
678681
679682 Args:
@@ -686,12 +689,13 @@ def activate_profile(self, profile_name: str, router_config: Dict[str, Any]) ->
686689 port = router_config ["port" ]
687690 default_base_url = f"http://{ host } :{ port } /sse"
688691
689- server_config = self ._format_router_server (profile_name , default_base_url )
692+ server_config = self ._format_router_server (profile_name , default_base_url , alias_name )
690693 return self .add_server (server_config )
691694
692- def _format_router_server (self , profile_name , base_url ) -> ServerConfig :
693- return format_server_url (self .client_key , profile_name , base_url )
695+ def _format_router_server (self , profile_name , base_url , server_name : str | None = None ) -> ServerConfig :
696+ return format_server_url (self .client_key , profile_name , base_url , server_name )
694697
698+ @override
695699 def deactivate_profile (self ) -> bool :
696700 """Deactivate a profile in the client config
697701
0 commit comments