diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor index f0bfcd71..07db41eb 100644 --- a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor +++ b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor @@ -67,12 +67,12 @@ @if (this.Content.IsStreaming) { - @textContent.Text + @textContent.Text.RemoveThinkTags() } else { - + } } } diff --git a/app/MindWork AI Studio/Chat/ContentText.cs b/app/MindWork AI Studio/Chat/ContentText.cs index 13d8f3ce..590bef35 100644 --- a/app/MindWork AI Studio/Chat/ContentText.cs +++ b/app/MindWork AI Studio/Chat/ContentText.cs @@ -119,6 +119,8 @@ public sealed class ContentText : IContent this.InitialRemoteWait = false; this.IsStreaming = false; }, token); + + this.Text = this.Text.RemoveThinkTags().Trim(); // Inform the UI that the streaming is done: await this.StreamingDone(); diff --git a/app/MindWork AI Studio/Chat/StringExtension.cs b/app/MindWork AI Studio/Chat/StringExtension.cs index 7eef7841..d229a0b4 100644 --- a/app/MindWork AI Studio/Chat/StringExtension.cs +++ b/app/MindWork AI Studio/Chat/StringExtension.cs @@ -4,13 +4,15 @@ public static class StringExtensions { public static string RemoveThinkTags(this string input) { - if (string.IsNullOrEmpty(input) || !input.StartsWith("")) + const string OPEN_TAG = ""; + const string CLOSE_TAG = ""; + if (string.IsNullOrEmpty(input) || !input.StartsWith(OPEN_TAG)) return input; - int endIndex = input.IndexOf(""); + var endIndex = input.IndexOf(CLOSE_TAG, StringComparison.Ordinal); if (endIndex == -1) - return input; + return string.Empty; - return input.Substring(endIndex + "".Length); + return input[(endIndex + CLOSE_TAG.Length)..]; } } \ No newline at end of file diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md index 11526d08..b2500c67 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md @@ -1 +1,2 @@ # v0.9.48, build 223 (2025-06-xx xx:xx UTC) +- Removed `` tags from streaming and final text output because of reasoning models. \ No newline at end of file