From 473036c739739d3501a4b6b28ba9de00a7d7433e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peer=20Sch=C3=BCtt?=
<20603780+peerschuett@users.noreply.github.com>
Date: Tue, 10 Jun 2025 14:29:18 +0200
Subject: [PATCH] Removed `` tags from text processing in reasoning
models and updated related components.
---
.../Chat/ContentBlockComponent.razor | 4 ++--
app/MindWork AI Studio/Chat/ContentText.cs | 2 ++
app/MindWork AI Studio/Chat/StringExtension.cs | 10 ++++++----
app/MindWork AI Studio/wwwroot/changelog/v0.9.48.md | 1 +
4 files changed, 11 insertions(+), 6 deletions(-)
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