Recover the command '/node add'

This commit is contained in:
streetycat
2023-12-04 10:19:08 +00:00
parent 6ff7a07d19
commit 5bb1be1fe3
+17 -3
View File
@@ -29,6 +29,7 @@ sys.path.append(directory + '/../../')
import proxy import proxy
from aios import * from aios import *
import local_compute_node_builder import local_compute_node_builder
from component.llama_node.local_llama_compute_node import LocalLlama_ComputeNode
sys.path.append(directory + '/../../component/') sys.path.append(directory + '/../../component/')
@@ -403,14 +404,26 @@ class AIOS_Shell:
async def handle_node_commands(self, args): async def handle_node_commands(self, args):
show_text = FormattedText([("class:title", "sub command not support!\n" show_text = FormattedText([("class:title", "sub command not support!\n"
"/node add\n" "/node add $model_name $url\n"
"/node create\n"
"/node rm $model_name $url\n" "/node rm $model_name $url\n"
"/node list\n")]) "/node list\n")])
if len(args) < 1: if len(args) < 1:
return show_text return show_text
sub_cmd = args[0] sub_cmd = args[0]
if sub_cmd == "add": if sub_cmd == "create":
await local_compute_node_builder.build(session, shell_style) await local_compute_node_builder.build(session, shell_style)
elif sub_cmd == "add":
if len(args) < 3:
return show_text
model_name = args[1]
url = args[2]
ComputeNodeConfig.get_instance().add_node("llama", url, model_name)
ComputeNodeConfig.get_instance().save()
node = LocalLlama_ComputeNode(url, model_name)
node.start()
ComputeKernel.get_instance().add_compute_node(node)
elif sub_cmd == "rm": elif sub_cmd == "rm":
if len(args) < 3: if len(args) < 3:
return show_text return show_text
@@ -767,7 +780,8 @@ async def main():
'/set_config $key', '/set_config $key',
'/enable $feature', '/enable $feature',
'/disable $feature', '/disable $feature',
'/node add', '/node add $model_name $url',
'/node create',
'/node rm $model_name $url', '/node rm $model_name $url',
'/node list', '/node list',
'/show', '/show',