File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
tools/server/webui/src/lib/services Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ export class ChatService {
208208 onError ?.( contextError ) ;
209209 return ;
210210 }
211- onComplete ?.( fullResponse ) ;
211+ onComplete ?.( regularContent ) ;
212212 return ;
213213 }
214214
@@ -219,6 +219,9 @@ export class ChatService {
219219 hasReceivedData = true ;
220220 fullResponse += content ;
221221
222+ // Track the regular content before processing this chunk
223+ const regularContentBefore = regularContent ;
224+
222225 // Process content character by character to handle think tags
223226 insideThinkTag = this . processContentForThinkTags (
224227 content ,
@@ -231,7 +234,11 @@ export class ChatService {
231234 }
232235 ) ;
233236
234- onChunk ?.( content ) ;
237+ // Only send the new regular content that was added in this chunk
238+ const newRegularContent = regularContent . slice ( regularContentBefore . length ) ;
239+ if ( newRegularContent ) {
240+ onChunk ?.( newRegularContent ) ;
241+ }
235242 }
236243 } catch ( e ) {
237244 console . error ( 'Error parsing JSON chunk:' , e ) ;
You can’t perform that action at this time.
0 commit comments