Skip to content

Commit

Permalink
fix bugs for proxy and dynamics node
Browse files Browse the repository at this point in the history
  • Loading branch information
streetycat committed Oct 24, 2023
1 parent e4be896 commit c342e56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/aios_kernel/compute_node_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ def add_node(self, model_type: str, url: str, model_name: str):
def remove_node(self, model_type: str, url: str, model_name: str):
if model_type == "llama":
llama_nodes_cfg = self.config.get("llama") or []
for i in range(0, len(llama_nodes_cfg)):
cfg = llama_nodes_cfg[i]
i = 0
for cfg in llama_nodes_cfg:
if url == cfg["url"] and model_name == cfg["model_name"]:
llama_nodes_cfg.pop(i)
else:
i += 1

def list(self) -> str:
return toml.dumps(self.config)
Expand Down
7 changes: 6 additions & 1 deletion src/service/aios_shell/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ def apply_storage():
socks.set_default_proxy(socks.SOCKS5, host, int(port), username = username, password = password)
socket.socket = socks.socksocket
logger.info(f"proxy {host_url} will be used.")
case "http":
(host, port) = host.split(":")
socks.set_default_proxy(socks.HTTP, host, int(port), username = username, password = password)
socket.socket = socks.socksocket
logger.info(f"proxy {host_url} will be used.")
case _:
logger.error(f"the proxy type ({proxy_type}) has not support. proxy will not be used.")


def declare_user_config():
user_config = AIStorage.get_instance().get_user_config()
user_config.add_user_config("proxy", "set your proxy service as 'proxy_type@host:port@username@password', 'proxy_type' = 'socks5'", True, None)
user_config.add_user_config("proxy", "set your proxy service as 'proxy_type@host:port@username@password', 'proxy_type' = 'socks5|http'", True, None)

0 comments on commit c342e56

Please sign in to comment.