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:
@@ -157,7 +157,8 @@ class CustomFunction_Agentflow implements INode {
|
||||
chatflowId: options.chatflowid,
|
||||
sessionId: options.sessionId,
|
||||
chatId: options.chatId,
|
||||
input
|
||||
input,
|
||||
state: newState
|
||||
}
|
||||
|
||||
let sandbox: any = {
|
||||
|
||||
@@ -21,7 +21,7 @@ class HTTP_Agentflow implements INode {
|
||||
constructor() {
|
||||
this.label = 'HTTP'
|
||||
this.name = 'httpAgentflow'
|
||||
this.version = 1.0
|
||||
this.version = 1.1
|
||||
this.type = 'HTTP'
|
||||
this.category = 'Agent Flows'
|
||||
this.description = 'Send a HTTP request'
|
||||
@@ -72,6 +72,7 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Headers',
|
||||
name: 'headers',
|
||||
type: 'array',
|
||||
acceptVariable: true,
|
||||
array: [
|
||||
{
|
||||
label: 'Key',
|
||||
@@ -83,7 +84,8 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: ''
|
||||
default: '',
|
||||
acceptVariable: true
|
||||
}
|
||||
],
|
||||
optional: true
|
||||
@@ -92,6 +94,7 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Query Params',
|
||||
name: 'queryParams',
|
||||
type: 'array',
|
||||
acceptVariable: true,
|
||||
array: [
|
||||
{
|
||||
label: 'Key',
|
||||
@@ -103,7 +106,8 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: ''
|
||||
default: '',
|
||||
acceptVariable: true
|
||||
}
|
||||
],
|
||||
optional: true
|
||||
@@ -147,6 +151,7 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Body',
|
||||
name: 'body',
|
||||
type: 'array',
|
||||
acceptVariable: true,
|
||||
show: {
|
||||
bodyType: ['xWwwFormUrlencoded', 'formData']
|
||||
},
|
||||
@@ -161,7 +166,8 @@ class HTTP_Agentflow implements INode {
|
||||
label: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: ''
|
||||
default: '',
|
||||
acceptVariable: true
|
||||
}
|
||||
],
|
||||
optional: true
|
||||
|
||||
@@ -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