Skip to content

Commit a943218

Browse files
committed
remove empty whitespace
1 parent 3bead57 commit a943218

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/server/server.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,6 @@ struct server_context {
21962196
if (slot.params.return_tokens) {
21972197
slot.generated_tokens.push_back(result.tok);
21982198
}
2199-
22002199

22012200
// SECTION: compute conditions on generated tokens so far
22022201

@@ -2250,13 +2249,15 @@ struct server_context {
22502249
}
22512250
}
22522251

2252+
// @ngxson all the other stop reasons should be in this function
22532253
if(full_stop_reached)
22542254
{
22552255
slot.stop = STOP_TYPE_WORD;
22562256
slot.has_next_token = false;
22572257
SLT_DBG(slot, "stopped by word, n_decoded = %d, n_predict = %d\n", slot.n_decoded, slot.params.n_predict);
22582258
}
22592259

2260+
// hold the output if we are not ready
22602261
if(partial_stop_reached || start_string_missing)
22612262
{
22622263
result.text_to_send = "";
@@ -2269,8 +2270,10 @@ struct server_context {
22692270
slot.n_sent_text += result.text_to_send.size();
22702271
}
22712272

2273+
// @ngxson: add the token and its probabilities even if not valid utf8 data
22722274
slot.add_token(result);
22732275

2276+
// @ngxson: we also avoid outputting the final token if it's entirely a stop word
22742277
if (slot.params.stream && !result.text_to_send.empty()) {
22752278
send_partial_response(slot, result);
22762279
}

0 commit comments

Comments
 (0)