File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -127,19 +127,20 @@ async fn start_infer_service(
127127 tokens = & tokens[ 1 ..]
128128 }
129129 let think = if session_info. think {
130- & tokens[ ..tokens. iter ( ) . take_while ( |t| * * t != _think) . count ( ) ]
130+ if let Some ( _think) = tokens. iter ( ) . position ( |t| * t == _think) {
131+ session_info. think = false ;
132+ let think = & tokens[ .._think] ;
133+ tokens = & tokens[ _think + 1 ..] ;
134+ think
135+ } else {
136+ let think = tokens;
137+ tokens = & [ ] ;
138+ think
139+ }
131140 } else {
132141 & [ ]
133142 } ;
134143
135- if session_info. think {
136- if think. len ( ) < tokens. len ( ) {
137- session_info. think = false ;
138- tokens = & tokens[ think. len ( ) + 1 ..]
139- } else {
140- tokens = & [ ]
141- }
142- }
143144 let think = service_manager_for_recv
144145 . terminal
145146 . decode ( think, & mut session_info. buf ) ;
You can’t perform that action at this time.
0 commit comments