mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Bugfix/AgentflowV2 State (#4512)
* add persistence state, http node variables, custom function flow state * update marketplace templates
This commit is contained in:
@@ -18,7 +18,7 @@ class Start_Agentflow implements INode {
|
||||
constructor() {
|
||||
this.label = 'Start'
|
||||
this.name = 'startAgentflow'
|
||||
this.version = 1.0
|
||||
this.version = 1.1
|
||||
this.type = 'Start'
|
||||
this.category = 'Agent Flows'
|
||||
this.description = 'Starting point of the agentflow'
|
||||
@@ -153,6 +153,13 @@ class Start_Agentflow implements INode {
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Persist State',
|
||||
name: 'startPersistState',
|
||||
type: 'boolean',
|
||||
description: 'Persist the state in the same session',
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -161,6 +168,7 @@ class Start_Agentflow implements INode {
|
||||
const _flowState = nodeData.inputs?.startState as string
|
||||
const startInputType = nodeData.inputs?.startInputType as string
|
||||
const startEphemeralMemory = nodeData.inputs?.startEphemeralMemory as boolean
|
||||
const startPersistState = nodeData.inputs?.startPersistState as boolean
|
||||
|
||||
let flowStateArray = []
|
||||
if (_flowState) {
|
||||
@@ -176,6 +184,13 @@ class Start_Agentflow implements INode {
|
||||
flowState[state.key] = state.value
|
||||
}
|
||||
|
||||
const runtimeState = options.agentflowRuntime?.state as ICommonObject
|
||||
if (startPersistState === true && runtimeState && Object.keys(runtimeState).length) {
|
||||
for (const state in runtimeState) {
|
||||
flowState[state] = runtimeState[state]
|
||||
}
|
||||
}
|
||||
|
||||
const inputData: ICommonObject = {}
|
||||
const outputData: ICommonObject = {}
|
||||
|
||||
@@ -202,6 +217,10 @@ class Start_Agentflow implements INode {
|
||||
outputData.ephemeralMemory = true
|
||||
}
|
||||
|
||||
if (startPersistState) {
|
||||
outputData.persistState = true
|
||||
}
|
||||
|
||||
const returnOutput = {
|
||||
id: nodeData.id,
|
||||
name: this.name,
|
||||
|
||||
Reference in New Issue
Block a user