Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#6186 from siliconflow/fix-truc-of-r…
Browse files Browse the repository at this point in the history
…easoning-model

Fix formatting of reasoning model on SiliconFlow
  • Loading branch information
Leizhenpeng authored Feb 8, 2025
2 parents 4273aa0 + acf75ce commit c6199db
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 c6199db

Please sign in to comment.