fix: reasoning response (#3684)

* perf: supplement assistant empty response

* check array

* fix: reasoning response

* fix: reasoning response
This commit is contained in:
Archer
2025-02-03 14:21:54 +08:00
committed by archer
parent 9e100957eb
commit 2a209d43af
9 changed files with 71 additions and 43 deletions

View File

@@ -88,7 +88,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
quoteTemplate,
quotePrompt,
aiChatVision,
aiChatReasoning,
aiChatReasoning = true,
fileUrlList: fileLinks, // node quote file links
stringQuoteText //abandon
}

View File

@@ -241,25 +241,28 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
// Histories store
if (assistantResponses) {
chatAssistantResponse = chatAssistantResponse.concat(assistantResponses);
} else if (answerText) {
// save assistant text response
const isResponseAnswerText =
inputs.find((item) => item.key === NodeInputKeyEnum.aiChatIsResponseText)?.value ?? true;
if (isResponseAnswerText) {
} else {
if (reasoningText) {
chatAssistantResponse.push({
type: ChatItemValueTypeEnum.text,
text: {
content: answerText
type: ChatItemValueTypeEnum.reasoning,
reasoning: {
content: reasoningText
}
});
}
} else if (reasoningText) {
chatAssistantResponse.push({
type: ChatItemValueTypeEnum.reasoning,
reasoning: {
content: reasoningText
if (answerText) {
// save assistant text response
const isResponseAnswerText =
inputs.find((item) => item.key === NodeInputKeyEnum.aiChatIsResponseText)?.value ?? true;
if (isResponseAnswerText) {
chatAssistantResponse.push({
type: ChatItemValueTypeEnum.text,
text: {
content: answerText
}
});
}
});
}
}
if (rewriteHistories) {

View File

@@ -244,7 +244,6 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
if (!httpJsonBody) return {};
if (httpContentType === ContentTypes.json) {
httpJsonBody = replaceJsonBodyString(httpJsonBody);
console.log(httpJsonBody);
return json5.parse(httpJsonBody);
}