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; res.status = 400;
return false; return false;
} }
llama.params.antiprompt.clear();
if (!body["stop"].is_null()) { if (!body["stop"].is_null()) {
llama.params.antiprompt = body["stop"].get<std::vector<std::string>>(); const auto stop = body["stop"].get<std::vector<std::string>>();
} else { std::copy_if(stop.begin(), stop.end(),
llama.params.antiprompt.clear(); std::back_inserter(llama.params.antiprompt),
[](const std::string &str) { return !str.empty(); });
} }
if (llama.verbose) { if (llama.verbose) {