File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -1090,22 +1090,21 @@ struct server_context {
10901090            size_t  pos = std::min (slot.n_sent_text , slot.generated_text .size ());
10911091
10921092            const  std::string str_test = slot.generated_text .substr (pos);
1093-             bool  is_stop_full  = false ;
1093+             bool  send_text  = true ;
10941094
10951095            size_t  stop_pos = slot.find_stopping_strings (str_test, token_str.size (), STOP_TYPE_FULL);
10961096            if  (stop_pos != std::string::npos) {
1097-                 is_stop_full = true ;
10981097                slot.generated_text .erase (
10991098                    slot.generated_text .begin () + pos + stop_pos,
11001099                    slot.generated_text .end ());
11011100                pos = std::min (slot.n_sent_text , slot.generated_text .size ());
1102-             } else  {
1103-                 is_stop_full = false ;
1101+             } else  if  (slot.has_next_token ) {
11041102                stop_pos = slot.find_stopping_strings (str_test, token_str.size (), STOP_TYPE_PARTIAL);
1103+                 send_text = stop_pos == std::string::npos;
11051104            }
11061105
11071106            //  check if there is any token to predict
1108-             if  (stop_pos == std::string::npos || (!slot. has_next_token  && !is_stop_full && stop_pos >  0 ) ) {
1107+             if  (send_text ) {
11091108                //  no send the stop word in the response
11101109                result.text_to_send  = slot.generated_text .substr (pos, std::string::npos);
11111110                slot.n_sent_text  += result.text_to_send .size ();
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments