Skip to content

Commit 3370b3d

Browse files
grapestoretenuar
authored andcommitted
feat: preserve UI state memory on API override (FlowiseAI#3957)
1 parent 1be62b4 commit 3370b3d

File tree

1 file changed

+6
-4
lines changed
  • packages/components/nodes/sequentialagents/State

1 file changed

+6
-4
lines changed

packages/components/nodes/sequentialagents/State/State.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,15 @@ class State_SeqAgents implements INode {
107107

108108
if (stateMemory && stateMemory !== 'stateMemoryUI' && stateMemory !== 'stateMemoryCode') {
109109
try {
110+
const parsedSchemaFromUI = typeof stateMemoryUI === 'string' ? JSON.parse(stateMemoryUI) : stateMemoryUI
110111
const parsedSchema = typeof stateMemory === 'string' ? JSON.parse(stateMemory) : stateMemory
112+
const combinedMemorySchema = [...parsedSchemaFromUI, ...parsedSchema]
111113
const obj: ICommonObject = {}
112-
for (const sch of parsedSchema) {
113-
const key = sch.Key
114+
for (const sch of combinedMemorySchema) {
115+
const key = sch.Key ?? sch.key
114116
if (!key) throw new Error(`Key is required`)
115-
const type = sch.Operation
116-
const defaultValue = sch['Default Value']
117+
const type = sch.Operation ?? sch.type
118+
const defaultValue = sch['Default Value'] ?? sch.defaultValue
117119

118120
if (type === 'Append') {
119121
obj[key] = {

0 commit comments

Comments
 (0)