filter empty stopping strings

This commit is contained in:
anon 2023-05-31 16:54:12 -03:00
parent 276fa99873
commit 43d295fddc

View file

@ -608,10 +608,12 @@ bool parse_options_completion(json body, llama_server_context& llama, Response &
res.status = 400;
return false;
}
if (!body["stop"].is_null()) {
llama.params.antiprompt = body["stop"].get<std::vector<std::string>>();
} else {
llama.params.antiprompt.clear();
if (!body["stop"].is_null()) {
const auto stop = body["stop"].get<std::vector<std::string>>();
std::copy_if(stop.begin(), stop.end(),
std::back_inserter(llama.params.antiprompt),
[](const std::string &str) { return !str.empty(); });
}
if (llama.verbose) {