feat: implement mergeReasoningContent function for enhanced reasoning handling

This commit is contained in:
n4ze3m
2025-02-08 17:13:40 +05:30
parent 72eaaf9dd2
commit 8381f1c996
2 changed files with 61 additions and 15 deletions

View File

@@ -40,6 +40,7 @@ import { pageAssistEmbeddingModel } from "@/models/embedding"
import {
isReasoningEnded,
isReasoningStarted,
mergeReasoningContent,
removeReasoning
} from "@/libs/reasoning"
@@ -652,6 +653,15 @@ export const useMessageOption = () => {
for await (const chunk of chunks) {
contentToSave += chunk?.content
fullText += chunk?.content
// console.log(chunk)
// if (chunk?.reasoning_content) {
// const reasoningContent = mergeReasoningContent(
// fullText,
// chunk?.reasoning_content || ""
// )
// contentToSave += reasoningContent
// fullText += reasoningContent
// }
if (isReasoningStarted(fullText) && !reasoningStartTime) {
reasoningStartTime = new Date()