Skip to content

Commit

Permalink
Remove unnecessary trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
jackalcooper committed Feb 8, 2025
1 parent bf265d3 commit acf75ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/client/platforms/siliconflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,21 @@ 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,
content: "",
};
}

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,
Expand Down
2 changes: 1 addition & 1 deletion app/utils/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acf75ce

Please sign in to comment.