fix: chat history do not be saved

This commit is contained in:
FinleyGe
2025-10-13 17:28:50 +08:00
parent 8a68e9c208
commit 01ad76787f

View File

@@ -47,6 +47,7 @@ import { rewriteRuntimeWorkFlow, removeSystemVariable } from './utils';
import { getHandleId } from '@fastgpt/global/core/workflow/utils';
import { callbackMap } from './constants';
import { anyValueDecrypt } from '../../../common/secret/utils';
import { result } from 'lodash';
type Props = Omit<ChatDispatchProps, 'workflowDispatchDeep'> & {
runtimeNodes: RuntimeNodeItemType[];
@@ -164,7 +165,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
const isDebugMode = data.mode === 'debug';
/*
/*
工作流队列控制
特点:
1. 可以控制一个 team 下,并发 run 的节点数量。
@@ -576,14 +577,13 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
this.chatNodeUsages = this.chatNodeUsages.concat(nodeDispatchUsages);
}
if (toolResponses !== undefined && toolResponses !== null) {
if (Array.isArray(toolResponses) && toolResponses.length === 0) return;
if (
!Array.isArray(toolResponses) &&
if (
(toolResponses !== undefined && toolResponses !== null) ||
(Array.isArray(toolResponses) && toolResponses.length > 0) ||
(!Array.isArray(toolResponses) &&
typeof toolResponses === 'object' &&
Object.keys(toolResponses).length === 0
)
return;
Object.keys(toolResponses).length > 0)
) {
this.toolRunResponse = toolResponses;
}
@@ -609,6 +609,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
}
}
console.log('chatAssistantResponse:', this.chatAssistantResponse);
if (rewriteHistories) {
histories = rewriteHistories;
}
@@ -916,6 +918,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
data.chatConfig?.variables
);
console.log('chatAssistantResponse:', workflowQueue.chatAssistantResponse);
return {
flowResponses: workflowQueue.chatResponses,
flowUsages: workflowQueue.chatNodeUsages,