Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/cli/command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void CommandLineParser::SetupCommonCommands() {
run_cmd->usage("Usage:\n" + commands::GetCortexBinary() +
" run [options] [model_id]");
run_cmd->add_option("model_id", cml_data_.model_id, "");
run_cmd->add_flag("--chat", cml_data_.chat_flag, "Flag for interactive mode");
run_cmd->add_flag("-d,--detach", cml_data_.run_detach, "Detached mode");
run_cmd->callback([this, run_cmd] {
if (std::exchange(executed_, true))
return;
Expand All @@ -151,7 +151,7 @@ void CommandLineParser::SetupCommonCommands() {
commands::RunCmd rc(cml_data_.config.apiServerHost,
std::stoi(cml_data_.config.apiServerPort),
cml_data_.model_id, download_service_);
rc.Exec(cml_data_.chat_flag);
rc.Exec(cml_data_.run_detach);
});

auto chat_cmd = app_.add_subcommand(
Expand Down
2 changes: 1 addition & 1 deletion engine/cli/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CommandLineParser {
std::string engine_src;
std::string cortex_version;
bool check_upd = true;
bool chat_flag = false;
bool run_detach = false;
int port;
config_yaml_utils::CortexConfig config;
std::unordered_map<std::string, std::string> model_update_options;
Expand Down
2 changes: 1 addition & 1 deletion engine/cli/commands/chat_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ void ChatCmd::Exec(const std::string& host, int port,
const std::string& model_handle,
std::shared_ptr<DownloadService> download_service) {
RunCmd rc(host, port, model_handle, download_service);
rc.Exec(true /*chat_flag*/);
rc.Exec(false /*detach mode*/);
}
}; // namespace commands
8 changes: 4 additions & 4 deletions engine/cli/commands/run_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ std::string Repo2Engine(const std::string& r) {
};
} // namespace

void RunCmd::Exec(bool chat_flag) {
void RunCmd::Exec(bool run_detach) {
std::optional<std::string> model_id = model_handle_;

cortex::db::Models modellist_handler;
Expand Down Expand Up @@ -115,12 +115,12 @@ void RunCmd::Exec(bool chat_flag) {
}

// Chat
if (chat_flag) {
ChatCompletionCmd(model_service_).Exec(host_, port_, *model_id, mc, "");
} else {
if (run_detach) {
CLI_LOG(*model_id << " model started successfully. Use `"
<< commands::GetCortexBinary() << " chat " << *model_id
<< "` for interactive chat shell");
} else {
ChatCompletionCmd(model_service_).Exec(host_, port_, *model_id, mc, "");
}
} catch (const std::exception& e) {
CLI_LOG("Fail to run model with ID '" + model_handle_ + "': " + e.what());
Expand Down
Loading