Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove chat command #1527

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
32 changes: 0 additions & 32 deletions engine/cli/command_line_parser.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "command_line_parser.h"
#include <memory>
#include <optional>
#include "commands/chat_cmd.h"
#include "commands/chat_completion_cmd.h"
#include "commands/cortex_upd_cmd.h"
#include "commands/engine_get_cmd.h"
#include "commands/engine_install_cmd.h"
Expand Down Expand Up @@ -152,36 +150,6 @@ void CommandLineParser::SetupCommonCommands() {
cml_data_.model_id, download_service_);
rc.Exec(cml_data_.run_detach);
});

auto chat_cmd = app_.add_subcommand(
"chat",
"Shortcut for `cortex run --chat` or send a chat completion request");
chat_cmd->group(kCommonCommandsGroup);
chat_cmd->usage("Usage:\n" + commands::GetCortexBinary() +
" chat [model_id] -m [msg]");
chat_cmd->add_option("model_id", cml_data_.model_id, "");
chat_cmd->add_option("-m,--message", cml_data_.msg,
"Message to chat with model");
chat_cmd->callback([this, chat_cmd] {
if (std::exchange(executed_, true))
return;
if (cml_data_.model_id.empty()) {
CLI_LOG("[model_id] is required\n");
CLI_LOG(chat_cmd->help());
return;
}

if (cml_data_.msg.empty()) {
commands::ChatCmd().Exec(cml_data_.config.apiServerHost,
std::stoi(cml_data_.config.apiServerPort),
cml_data_.model_id, download_service_);
} else {
commands::ChatCompletionCmd(model_service_)
.Exec(cml_data_.config.apiServerHost,
std::stoi(cml_data_.config.apiServerPort), cml_data_.model_id,
cml_data_.msg);
}
});
}

void CommandLineParser::SetupInferenceCommands() {
Expand Down
Loading