feat: preserve UI state memory on API override (#3957)

This commit is contained in:
inkyu 2025-02-04 02:12:09 +09:00 committed by GitHub
parent e1ea1c68d1
commit 2a0e712b7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -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] = {