Skip to content

Commit ae996a2

Browse files
committed
server: fix the disappearance of the end of the text when streaming with stop strings
1 parent edc2656 commit ae996a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/server/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ struct server_context {
10831083
}
10841084

10851085
// check if there is any token to predict
1086-
if (stop_pos == std::string::npos || (!slot.has_next_token && !is_stop_full && stop_pos > 0)) {
1086+
if (stop_pos == std::string::npos || is_stop_full || (!slot.has_next_token && !is_stop_full && stop_pos > 0)) {
10871087
// no send the stop word in the response
10881088
result.text_to_send = slot.generated_text.substr(pos, std::string::npos);
10891089
slot.n_sent_text += result.text_to_send.size();

0 commit comments

Comments
 (0)