mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
Bugfix/AgentflowV2 State (#4512)
* add persistence state, http node variables, custom function flow state * update marketplace templates
This commit is contained in:
@@ -1324,6 +1324,24 @@ export const executeAgentFlow = async ({
|
||||
}
|
||||
}
|
||||
|
||||
// If the state is persistent, get the state from the previous execution
|
||||
const startPersistState = nodes.find((node) => node.data.name === 'startAgentflow')?.data.inputs?.startPersistState
|
||||
if (startPersistState === true && previousExecution) {
|
||||
const previousExecutionData = (JSON.parse(previousExecution.executionData) as IAgentflowExecutedData[]) ?? []
|
||||
|
||||
let previousState = {}
|
||||
if (Array.isArray(previousExecutionData) && previousExecutionData.length) {
|
||||
for (const execData of previousExecutionData.reverse()) {
|
||||
if (execData.data.state) {
|
||||
previousState = execData.data.state
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
agentflowRuntime.state = previousState
|
||||
}
|
||||
|
||||
// If the start input type is form input, get the form values from the previous execution (form values are persisted in the same session)
|
||||
if (startInputType === 'formInput' && previousExecution) {
|
||||
const previousExecutionData = (JSON.parse(previousExecution.executionData) as IAgentflowExecutedData[]) ?? []
|
||||
|
||||
Reference in New Issue
Block a user