File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -624,19 +624,13 @@ export function streamWithThink(
624624 if ( ! isInThinkingMode || isThinkingChanged ) {
625625 // If this is a new thinking block or mode changed, add prefix
626626 isInThinkingMode = true ;
627- if ( remainText . length > 0 ) {
627+ if ( remainText . length > 0 && ! remainText . endsWith ( "\n" ) ) {
628628 remainText += "\n" ;
629629 }
630- remainText += "> " + chunk . content ;
631- } else {
632- // Handle newlines in thinking content
633- if ( chunk . content . includes ( "\n\n" ) ) {
634- const lines = chunk . content . split ( "\n\n" ) ;
635- remainText += lines . join ( "\n\n> " ) ;
636- } else {
637- remainText += chunk . content ;
638- }
630+ remainText += "> " ;
639631 }
632+ // Append content, ensuring newlines are quoted
633+ remainText += chunk . content . replace ( / \n / g, "\n> " ) ;
640634 } else {
641635 // If in normal mode
642636 if ( isInThinkingMode || isThinkingChanged ) {
You can’t perform that action at this time.
0 commit comments