@@ -25,10 +25,12 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
2525 auto start_cmd = models_cmd->add_subcommand (" start" , " Start a model by ID" );
2626 start_cmd->add_option (" model_id" , model_id, " " );
2727 start_cmd->callback ([&model_id]() {
28- // TODO(sang) switch to <model_id>.yaml when implement model manager
28+ commands::CmdInfo ci (model_id);
29+ std::string model_file =
30+ ci.branch == " main" ? ci.model_name : ci.model_name + " -" + ci.branch ;
2931 config::YamlHandler yaml_handler;
3032 yaml_handler.ModelConfigFromFile (cortex_utils::GetCurrentPath () +
31- " /models/" + model_id + " /model.yml " );
33+ " /models/" + model_file + " .yaml " );
3234 commands::ModelStartCmd msc (" 127.0.0.1" , 3928 ,
3335 yaml_handler.GetModelConfig ());
3436 msc.Exec ();
@@ -38,10 +40,12 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
3840 models_cmd->add_subcommand (" stop" , " Stop a model by ID" );
3941 stop_model_cmd->add_option (" model_id" , model_id, " " );
4042 stop_model_cmd->callback ([&model_id]() {
41- // TODO(sang) switch to <model_id>.yaml when implement model manager
43+ commands::CmdInfo ci (model_id);
44+ std::string model_file =
45+ ci.branch == " main" ? ci.model_name : ci.model_name + " -" + ci.branch ;
4246 config::YamlHandler yaml_handler;
4347 yaml_handler.ModelConfigFromFile (cortex_utils::GetCurrentPath () +
44- " /models/" + model_id + " /model.yml " );
48+ " /models/" + model_file + " .yaml " );
4549 commands::StopModelCmd smc (" 127.0.0.1" , 3928 ,
4650 yaml_handler.GetModelConfig ());
4751 smc.Exec ();
@@ -90,10 +94,12 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
9094 chat_cmd->add_option (" -m,--message" , msg, " Message to chat with model" );
9195
9296 chat_cmd->callback ([&model_id, &msg] {
93- // TODO(sang) switch to <model_id>.yaml when implement model manager
97+ commands::CmdInfo ci (model_id);
98+ std::string model_file =
99+ ci.branch == " main" ? ci.model_name : ci.model_name + " -" + ci.branch ;
94100 config::YamlHandler yaml_handler;
95101 yaml_handler.ModelConfigFromFile (cortex_utils::GetCurrentPath () +
96- " /models/" + model_id + " /model.yml " );
102+ " /models/" + model_file + " .yaml " );
97103 commands::ChatCmd cc (" 127.0.0.1" , 3928 , yaml_handler.GetModelConfig ());
98104 cc.Exec (msg);
99105 });
0 commit comments