]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : fix token duplication when streaming with stop strings (#10997)
authorAlexey Parfenov <redacted>
Sat, 28 Dec 2024 15:08:54 +0000 (15:08 +0000)
committerGitHub <redacted>
Sat, 28 Dec 2024 15:08:54 +0000 (16:08 +0100)
examples/server/server.cpp

index 30ff3b14957dc76b15831a5f483a935b9e0e890f..3558ddb7c711f14a55154056324635b8109af2df 100644 (file)
@@ -1856,6 +1856,8 @@ struct server_context {
                 result.text_to_send = slot.generated_text.substr(pos, std::string::npos);
                 slot.n_sent_text += result.text_to_send.size();
                 // add the token to slot queue and cache
+            } else {
+                result.text_to_send = "";
             }
 
             slot.add_token(result);