From acf75ce68f7152972fe5924b4880b3ae06c0ca65 Mon Sep 17 00:00:00 2001 From: Shenghang Tsai Date: Sat, 8 Feb 2025 16:34:17 +0800 Subject: [PATCH] Remove unnecessary trimming --- app/client/platforms/siliconflow.ts | 8 ++++---- app/utils/chat.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/client/platforms/siliconflow.ts b/app/client/platforms/siliconflow.ts index fe2f9862b27..90dc135110e 100644 --- a/app/client/platforms/siliconflow.ts +++ b/app/client/platforms/siliconflow.ts @@ -174,8 +174,8 @@ export class SiliconflowApi implements LLMApi { // Skip if both content and reasoning_content are empty or null if ( - (!reasoning || reasoning.trim().length === 0) && - (!content || content.trim().length === 0) + (!reasoning || reasoning.length === 0) && + (!content || content.length === 0) ) { return { isThinking: false, @@ -183,12 +183,12 @@ export class SiliconflowApi implements LLMApi { }; } - if (reasoning && reasoning.trim().length > 0) { + if (reasoning && reasoning.length > 0) { return { isThinking: true, content: reasoning, }; - } else if (content && content.trim().length > 0) { + } else if (content && content.length > 0) { return { isThinking: false, content: content, diff --git a/app/utils/chat.ts b/app/utils/chat.ts index c04d33cbfbf..b77955e6ecf 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -576,7 +576,7 @@ export function streamWithThink( try { const chunk = parseSSE(text, runTools); // Skip if content is empty - if (!chunk?.content || chunk.content.trim().length === 0) { + if (!chunk?.content || chunk.content.length === 0) { return; } // Check if thinking mode changed