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: handle path with space #1963

Merged
merged 1 commit into from
Feb 13, 2025
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
12 changes: 6 additions & 6 deletions engine/cli/commands/server_start_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ bool ServerStartCmd::Exec(const std::string& host, int port,
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
std::wstring params = L"--start-server";
params += L" --config_file_path " +
file_manager_utils::GetConfigurationPath().wstring();
params += L" --data_folder_path " +
file_manager_utils::GetCortexDataPath().wstring();
params += L" --config_file_path \"" +
file_manager_utils::GetConfigurationPath().wstring() + L"\"";
params += L" --data_folder_path \"" +
file_manager_utils::GetCortexDataPath().wstring() + L"\"";
params += L" --loglevel " + cortex::wc::Utf8ToWstring(log_level_);
std::wstring exe_w = cortex::wc::Utf8ToWstring(exe);
std::wstring current_path_w =
file_manager_utils::GetExecutableFolderContainerPath().wstring();
std::wstring wcmds = current_path_w + L"/" + exe_w + L" " + params;
CTL_DBG("wcmds: " << wcmds);
std::wstring wcmds = current_path_w + L"\\" + exe_w + L" " + params;
CTL_INF("wcmds: " << wcmds);
std::vector<wchar_t> mutable_cmds(wcmds.begin(), wcmds.end());
mutable_cmds.push_back(L'\0');
// Create child process
Expand Down
5 changes: 4 additions & 1 deletion engine/extensions/remote-engine/remote_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ size_t StreamWriteCallback(char* ptr, size_t size, size_t nmemb,
Json::Reader reader;
if (reader.parse(chunk, check_error)) {
CTL_WRN(chunk);
CTL_INF("Request: " << context->last_request);
Json::Value status;
status["is_done"] = true;
status["has_error"] = true;
Expand Down Expand Up @@ -143,7 +144,9 @@ CurlResponse RemoteEngine::MakeStreamingChatCompletionRequest(
"",
config.model,
renderer_,
stream_template};
stream_template,
true,
body};

curl_easy_setopt(curl, CURLOPT_URL, full_url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
Expand Down
1 change: 1 addition & 0 deletions engine/extensions/remote-engine/remote_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct StreamContext {
extensions::TemplateRenderer& renderer;
std::string stream_template;
bool need_stop = true;
std::string last_request;
};
struct CurlResponse {
std::string body;
Expand Down
10 changes: 5 additions & 5 deletions engine/services/hardware_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,16 @@ bool HardwareService::Restart(const std::string& host, int port) {
ZeroMemory(&pi, sizeof(pi));
// TODO (sang) write a common function for this and server_start_cmd
std::wstring params = L"--ignore_cout";
params += L" --config_file_path " +
file_manager_utils::GetConfigurationPath().wstring();
params += L" --data_folder_path " +
file_manager_utils::GetCortexDataPath().wstring();
params += L" --config_file_path \"" +
file_manager_utils::GetConfigurationPath().wstring() + L"\"";
params += L" --data_folder_path \"" +
file_manager_utils::GetCortexDataPath().wstring() + L"\"";
params += L" --loglevel " +
cortex::wc::Utf8ToWstring(luh::LogLevelStr(luh::global_log_level));
std::wstring exe_w = exe.wstring();
std::wstring current_path_w =
file_manager_utils::GetExecutableFolderContainerPath().wstring();
std::wstring wcmds = current_path_w + L"/" + exe_w + L" " + params;
std::wstring wcmds = current_path_w + L"\\" + exe_w + L" " + params;
CTL_DBG("wcmds: " << wcmds);
std::vector<wchar_t> mutable_cmds(wcmds.begin(), wcmds.end());
mutable_cmds.push_back(L'\0');
Expand Down
Loading