@@ -24,7 +24,7 @@ import type {
2424} from '@fastgpt/global/core/workflow/runtime/type' ;
2525import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type.d' ;
2626import { getErrText , UserError } from '@fastgpt/global/common/error/utils' ;
27- import { ChatItemValueTypeEnum } from '@fastgpt/global/core/chat/constants' ;
27+ import { ChatItemValueTypeEnum , ChatRoleEnum } from '@fastgpt/global/core/chat/constants' ;
2828import { filterPublicNodeResponseData } from '@fastgpt/global/core/chat/utils' ;
2929import {
3030 checkNodeRunStatus ,
@@ -57,13 +57,12 @@ import { addPreviewUrlToChatItems, presignVariablesFileUrls } from '../../chat/u
5757import type { MCPClient } from '../../app/mcp' ;
5858import { TeamErrEnum } from '@fastgpt/global/common/error/code/team' ;
5959import { i18nT } from '../../../../web/i18n/utils' ;
60- import { clone } from 'lodash' ;
6160import { validateFileUrlDomain } from '../../../common/security/fileUrlValidator' ;
6261import { delAgentRuntimeStopSign , shouldWorkflowStop } from './workflowStatus' ;
6362
6463type Props = Omit <
6564 ChatDispatchProps ,
66- 'checkIsStopping' | 'workflowDispatchDeep' | 'timezone' | 'externalProvider' | 'cloneVariables'
65+ 'checkIsStopping' | 'workflowDispatchDeep' | 'timezone' | 'externalProvider'
6766> & {
6867 runtimeNodes : RuntimeNodeItemType [ ] ;
6968 runtimeEdges : RuntimeEdgeItemType [ ] ;
@@ -182,7 +181,6 @@ export async function dispatchWorkFlow({
182181 }
183182
184183 // Get default variables
185- const cloneVariables = clone ( data . variables ) ;
186184 const defaultVariables = {
187185 ...externalProvider . externalWorkflowVariables ,
188186 ...( await getSystemVariables ( {
@@ -228,8 +226,7 @@ export async function dispatchWorkFlow({
228226 workflowDispatchDeep : 0 ,
229227 usageId : newUsageId ,
230228 concatUsage,
231- mcpClientMemory,
232- cloneVariables
229+ mcpClientMemory
233230 } ) . finally ( async ( ) => {
234231 if ( streamCheckTimer ) {
235232 clearInterval ( streamCheckTimer ) ;
@@ -273,8 +270,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
273270 usageId,
274271 concatUsage,
275272 runningUserInfo : { teamId } ,
276- mcpClientMemory,
277- cloneVariables
273+ mcpClientMemory
278274 } = data ;
279275
280276 // Over max depth
@@ -296,7 +292,6 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
296292 [ DispatchNodeResponseKeyEnum . toolResponses ] : null ,
297293 [ DispatchNodeResponseKeyEnum . newVariables ] : runtimeSystemVar2StoreType ( {
298294 variables,
299- cloneVariables,
300295 removeObj : externalProvider . externalWorkflowVariables ,
301296 userVariablesConfigs : data . chatConfig ?. variables
302297 } ) ,
@@ -343,6 +338,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
343338 }
344339 | undefined ;
345340 system_memories : Record < string , any > = { } ; // Workflow node memories
341+ customFeedbackList : string [ ] = [ ] ; // Custom feedbacks collected from nodes
346342
347343 // Debug
348344 debugNextStepRunNodes : RuntimeNodeItemType [ ] = [ ] ; // 记录 Debug 模式下,下一个阶段需要执行的节点。
@@ -720,7 +716,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
720716 assistantResponses,
721717 rewriteHistories,
722718 runTimes = 1 ,
723- system_memories : newMemories
719+ system_memories : newMemories ,
720+ customFeedbacks
724721 } : NodeResponseCompleteType ) => {
725722 // Add run times
726723 this . workflowRunTimes += runTimes ;
@@ -737,6 +734,11 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
737734 this . chatResponses . push ( responseData ) ;
738735 }
739736
737+ // Collect custom feedbacks
738+ if ( customFeedbacks && Array . isArray ( customFeedbacks ) ) {
739+ this . customFeedbackList = this . customFeedbackList . concat ( customFeedbacks ) ;
740+ }
741+
740742 // Push usage in real time. Avoid a workflow usage a large number of points
741743 if ( nodeDispatchUsages ) {
742744 if ( usageId ) {
@@ -1120,14 +1122,15 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
11201122 [ DispatchNodeResponseKeyEnum . toolResponses ] : workflowQueue . toolRunResponse ,
11211123 [ DispatchNodeResponseKeyEnum . newVariables ] : runtimeSystemVar2StoreType ( {
11221124 variables,
1123- cloneVariables,
11241125 removeObj : externalProvider . externalWorkflowVariables ,
11251126 userVariablesConfigs : data . chatConfig ?. variables
11261127 } ) ,
11271128 [ DispatchNodeResponseKeyEnum . memories ] :
11281129 Object . keys ( workflowQueue . system_memories ) . length > 0
11291130 ? workflowQueue . system_memories
11301131 : undefined ,
1132+ [ DispatchNodeResponseKeyEnum . customFeedbacks ] :
1133+ workflowQueue . customFeedbackList . length > 0 ? workflowQueue . customFeedbackList : undefined ,
11311134 durationSeconds
11321135 } ;
11331136} ;
0 commit comments