diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor index 8b93606d..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 new file mode 100644 index 00000000..d229a0b4 --- /dev/null +++ b/app/MindWork AI Studio/Chat/StringExtension.cs @@ -0,0 +1,18 @@ +namespace AIStudio.Chat; + +public static class StringExtensions +{ + public static string RemoveThinkTags(this string input) + { + const string OPEN_TAG = ""; + const string CLOSE_TAG = ""; + if (string.IsNullOrEmpty(input) || !input.StartsWith(OPEN_TAG)) + return input; + + var endIndex = input.IndexOf(CLOSE_TAG, StringComparison.Ordinal); + if (endIndex == -1) + return string.Empty; + + 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 7cb70656..e19652a4 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md @@ -1,4 +1,5 @@ # v0.9.48, build 223 (2025-06-xx xx:xx UTC) - Improved German translation. - Improved the confirmation dialog for longer texts. -- Improved how configurations are applied in organizations and made the process more robust. \ No newline at end of file +- Improved how configurations are applied in organizations and made the process more robust. +- Removed `` tags from streaming and final text output because of reasoning models. \ No newline at end of file