server : fix passing prompt as tokens (#5955)

* server: fix passing prompt as tokens

* Update examples/server/server.cpp

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Alexey Parfenov 2024-03-09 11:16:53 +00:00 committed by GitHub
parent 8a3012a4ad
commit 0db32beaf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -852,7 +852,16 @@ struct server_context {
// infill // infill
slot.params.input_prefix = json_value(data, "input_prefix", default_params.input_prefix); slot.params.input_prefix = json_value(data, "input_prefix", default_params.input_prefix);
slot.params.input_suffix = json_value(data, "input_suffix", default_params.input_suffix); slot.params.input_suffix = json_value(data, "input_suffix", default_params.input_suffix);
slot.prompt = json_value(data, "prompt", std::string(""));
// get prompt
{
const auto & prompt = data.find("prompt");
if (prompt == data.end()) {
slot.prompt = "";
} else {
slot.prompt = *prompt;
}
}
// penalize user-provided tokens // penalize user-provided tokens
{ {