send empty string when got stop_pos in partial

This commit is contained in:
Jhen 2023-08-22 09:18:46 +08:00
parent de8cd113c6
commit e1911ac47c

View file

@ -1287,7 +1287,10 @@ int main(int argc, char **argv)
STOP_PARTIAL); STOP_PARTIAL);
} }
const std::string to_send = llama.generated_text.substr(pos, stop_pos); const std::string to_send = stop_pos == std::string::npos
? llama.generated_text.substr(pos, std::string::npos)
: ""; // just don't send anything if we're not done
sent_count += to_send.size(); sent_count += to_send.size();
std::vector<completion_token_output> probs_output = {}; std::vector<completion_token_output> probs_output = {};