diff --git a/packages/components/nodes/sequentialagents/State/State.ts b/packages/components/nodes/sequentialagents/State/State.ts index 31d7af0c0..5c48cb7a7 100644 --- a/packages/components/nodes/sequentialagents/State/State.ts +++ b/packages/components/nodes/sequentialagents/State/State.ts @@ -107,13 +107,15 @@ class State_SeqAgents implements INode { if (stateMemory && stateMemory !== 'stateMemoryUI' && stateMemory !== 'stateMemoryCode') { try { + const parsedSchemaFromUI = typeof stateMemoryUI === 'string' ? JSON.parse(stateMemoryUI) : stateMemoryUI const parsedSchema = typeof stateMemory === 'string' ? JSON.parse(stateMemory) : stateMemory + const combinedMemorySchema = [...parsedSchemaFromUI, ...parsedSchema] const obj: ICommonObject = {} - for (const sch of parsedSchema) { - const key = sch.Key + for (const sch of combinedMemorySchema) { + const key = sch.Key ?? sch.key if (!key) throw new Error(`Key is required`) - const type = sch.Operation - const defaultValue = sch['Default Value'] + const type = sch.Operation ?? sch.type + const defaultValue = sch['Default Value'] ?? sch.defaultValue if (type === 'Append') { obj[key] = {