@@ -2197,30 +2197,30 @@ struct server_context {
2197
2197
const std::string str_test = slot.generated_text .substr (pos);
2198
2198
bool send_text = true ;
2199
2199
2200
- if (slot.n_sent_text == 0 && slot.has_next_token && !slot.params .start_strings .empty ()) {
2200
+ if (slot.n_sent_text == 0 && slot.has_next_token && !slot.params .start_strings .empty ()) {
2201
2201
size_t max_start_string_size = 0 ;
2202
- for (auto start_string: slot.params .start_strings ) {
2202
+ for (auto start_string: slot.params .start_strings ) {
2203
2203
max_start_string_size = std::max (max_start_string_size, start_string.size ());
2204
2204
}
2205
2205
size_t search_len = max_start_string_size + token_str.size ();
2206
2206
size_t search_pos = 0 ;
2207
- if (slot.generated_text .size () > search_len) {
2207
+ if (slot.generated_text .size () > search_len) {
2208
2208
search_pos = slot.generated_text .size () - search_len;
2209
2209
}
2210
2210
2211
2211
auto found_pos = slot.generated_text .npos ;
2212
2212
bool found = false ;
2213
2213
std::string found_string;
2214
- for (auto start_string: slot.params .start_strings ) {
2214
+ for (auto start_string: slot.params .start_strings ) {
2215
2215
found_pos = slot.generated_text .find (start_string,search_pos);
2216
- if (found_pos != slot.generated_text .npos ) {
2216
+ if (found_pos != slot.generated_text .npos ) {
2217
2217
found = true ;
2218
2218
found_string = start_string;
2219
2219
break ;
2220
2220
}
2221
2221
}
2222
2222
2223
- if (found && slot.generated_text .size () > (found_pos + found_string.size ()) ) {
2223
+ if (found && slot.generated_text .size () > (found_pos + found_string.size ()) ) {
2224
2224
slot.generated_text .erase (
2225
2225
slot.generated_text .begin (),
2226
2226
slot.generated_text .begin () + found_pos + found_string.size ());
0 commit comments