We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a2bdcd commit 4ec118eCopy full SHA for 4ec118e
tools/server/webui/src/lib/utils/thinking.ts
@@ -23,12 +23,17 @@ export function parseThinkingContent(content: string): {
23
};
24
}
25
26
- const completeMatch = content.includes('</think>');
+ const completeMatch = content.match(/<think>([\s\S]*?)<\/think>/);
27
28
if (completeMatch) {
29
+ const thinkingContent = completeMatch[1]?.trim() ?? '';
30
+ const cleanContent = `${content.slice(0, completeMatch.index ?? 0)}${content.slice(
31
+ (completeMatch.index ?? 0) + completeMatch[0].length
32
+ )}`.trim();
33
+
34
return {
- thinking: content.split('</think>')?.[0]?.trim(),
- cleanContent: content.split('</think>')?.[1]?.trim()
35
+ thinking: thinkingContent,
36
+ cleanContent
37
38
39
0 commit comments