mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-10 06:13:48 +00:00
Dont display <think> tags (#496)
This commit is contained in:
1 parent
368fc9ce39
commit
793a9cae0a
4 files changed
+24
-3
No files matched your search
@@ -0,0 +1,18 @@
|
||||
namespace AIStudio.Chat;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string RemoveThinkTags(this string input)
|
||||
{
|
||||
const string OPEN_TAG = "<think>";
|
||||
const string CLOSE_TAG = "</think>";
|
||||
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)..];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user