File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 6767 @if (this .Content .IsStreaming )
6868 {
6969 < MudText Typo = " Typo.body1" Style = " white-space: pre-wrap;" >
70- @textContent .Text
70+ @textContent .Text . RemoveThinkTags ()
7171 < / MudText >
7272 }
7373 else
7474 {
75- < MudMarkdown Value = " @textContent.Text" OverrideHeaderTypo = " @Markdown.OverrideHeaderTypo" CodeBlockTheme = " @this.CodeColorPalette" / >
75+ < MudMarkdown Value = " @textContent.Text.RemoveThinkTags().Trim() " OverrideHeaderTypo = " @Markdown.OverrideHeaderTypo" CodeBlockTheme = " @this.CodeColorPalette" / >
7676 }
7777 }
7878 }
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ await Task.Run(async () =>
119119 this . InitialRemoteWait = false ;
120120 this . IsStreaming = false ;
121121 } , token ) ;
122+
123+ this . Text = this . Text . RemoveThinkTags ( ) . Trim ( ) ;
122124
123125 // Inform the UI that the streaming is done:
124126 await this . StreamingDone ( ) ;
Original file line number Diff line number Diff line change 1+ namespace AIStudio . Chat ;
2+
3+ public static class StringExtensions
4+ {
5+ public static string RemoveThinkTags ( this string input )
6+ {
7+ const string OPEN_TAG = "<think>" ;
8+ const string CLOSE_TAG = "</think>" ;
9+ if ( string . IsNullOrEmpty ( input ) || ! input . StartsWith ( OPEN_TAG ) )
10+ return input ;
11+
12+ var endIndex = input . IndexOf ( CLOSE_TAG , StringComparison . Ordinal ) ;
13+ if ( endIndex == - 1 )
14+ return string . Empty ;
15+
16+ return input [ ( endIndex + CLOSE_TAG . Length ) ..] ;
17+ }
18+ }
Original file line number Diff line number Diff line change 11# v0.9.48, build 223 (2025-06-xx xx: xx UTC)
22- Improved German translation.
33- Improved the confirmation dialog for longer texts.
4- - Improved how configurations are applied in organizations and made the process more robust.
4+ - Improved how configurations are applied in organizations and made the process more robust.
5+ - Removed ` <think> ` tags from streaming and final text output because of reasoning models.
You can’t perform that action at this time.
0 commit comments