From ae996a2fc858f61391d24a708c894013ff5f5761 Mon Sep 17 00:00:00 2001 From: ZXED Date: Sat, 12 Oct 2024 18:31:43 +0300 Subject: [PATCH] server: fix the disappearance of the end of the text when streaming with stop strings --- examples/server/server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index f809c46d5..6becb3d14 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -1083,7 +1083,7 @@ struct server_context { } // check if there is any token to predict - if (stop_pos == std::string::npos || (!slot.has_next_token && !is_stop_full && stop_pos > 0)) { + if (stop_pos == std::string::npos || is_stop_full || (!slot.has_next_token && !is_stop_full && stop_pos > 0)) { // no send the stop word in the response result.text_to_send = slot.generated_text.substr(pos, std::string::npos); slot.n_sent_text += result.text_to_send.size();