feat: preserve UI state memory on API override (#3957)
This commit is contained in:
parent
e1ea1c68d1
commit
2a0e712b7d
|
|
@ -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] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue