@@ -1386,8 +1386,6 @@ export class WorkflowQueue {
13861386 }
13871387}
13881388export const runWorkflow = async ( data : RunWorkflowProps ) : Promise < DispatchFlowResponse > => {
1389- let { runtimeNodes = [ ] , runtimeEdges = [ ] , variables = { } , externalProvider } = data ;
1390-
13911389 // Over max depth
13921390 data . workflowDispatchDeep ++ ;
13931391 const isRootRuntime = data . workflowDispatchDeep === 1 ;
@@ -1406,20 +1404,19 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
14061404 [ DispatchNodeResponseKeyEnum . assistantResponses ] : [ ] ,
14071405 [ DispatchNodeResponseKeyEnum . toolResponses ] : null ,
14081406 [ DispatchNodeResponseKeyEnum . newVariables ] : runtimeSystemVar2StoreType ( {
1409- variables,
1410- removeObj : externalProvider . externalWorkflowVariables ,
1407+ variables : data . variables ,
1408+ removeObj : data . externalProvider . externalWorkflowVariables ,
14111409 userVariablesConfigs : data . chatConfig ?. variables
14121410 } ) ,
14131411 durationSeconds : 0
14141412 } ;
14151413 }
14161414
1417- runtimeEdges = filterOrphanEdges ( {
1418- edges : runtimeEdges ,
1419- nodes : runtimeNodes ,
1415+ data . runtimeEdges = filterOrphanEdges ( {
1416+ edges : data . runtimeEdges ,
1417+ nodes : data . runtimeNodes ,
14201418 workflowId : data . runningAppInfo . id
14211419 } ) ;
1422- data . runtimeEdges = runtimeEdges ;
14231420
14241421 return withActiveSpan (
14251422 {
@@ -1434,23 +1431,27 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
14341431 'fastgpt.workflow.chat_id' : data . chatId ,
14351432 'fastgpt.workflow.app_version' : data . apiVersion ,
14361433 'fastgpt.workflow.is_tool_call' : ! ! data . isToolCall ,
1437- 'fastgpt.workflow.node_count' : runtimeNodes . length ,
1438- 'fastgpt.workflow.edge_count' : runtimeEdges . length
1434+ 'fastgpt.workflow.node_count' : data . runtimeNodes . length ,
1435+ 'fastgpt.workflow.edge_count' : data . runtimeEdges . length
14391436 }
14401437 } ,
14411438 async ( workflowSpan ) => {
14421439 const startTime = Date . now ( ) ;
14431440
1444- await rewriteRuntimeWorkFlow ( { nodes : runtimeNodes , edges : runtimeEdges , lang : data . lang } ) ;
1441+ await rewriteRuntimeWorkFlow ( {
1442+ nodes : data . runtimeNodes ,
1443+ edges : data . runtimeEdges ,
1444+ lang : data . lang
1445+ } ) ;
14451446 // Init default value
14461447 data . retainDatasetCite = data . retainDatasetCite ?? true ;
14471448 data . responseDetail = data . responseDetail ?? true ;
14481449 data . responseAllData = data . responseAllData ?? true ;
14491450
14501451 // Start process width initInput
1451- const entryNodes = runtimeNodes . filter ( ( item ) => item . isEntry ) ;
1452+ const entryNodes = data . runtimeNodes . filter ( ( item ) => item . isEntry ) ;
14521453 // Reset entry
1453- runtimeNodes . forEach ( ( item ) => {
1454+ data . runtimeNodes . forEach ( ( item ) => {
14541455 // Interactively nodes will use the "isEntry", which does not need to be updated
14551456 if (
14561457 item . flowNodeType !== FlowNodeTypeEnum . userSelect &&
@@ -1519,8 +1520,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
15191520 ) ,
15201521 [ DispatchNodeResponseKeyEnum . toolResponses ] : workflowQueue . toolRunResponse ,
15211522 [ DispatchNodeResponseKeyEnum . newVariables ] : runtimeSystemVar2StoreType ( {
1522- variables,
1523- removeObj : externalProvider . externalWorkflowVariables ,
1523+ variables : data . variables ,
1524+ removeObj : data . externalProvider . externalWorkflowVariables ,
15241525 userVariablesConfigs : data . chatConfig ?. variables
15251526 } ) ,
15261527 [ DispatchNodeResponseKeyEnum . memories ] :
0 commit comments