Skip to content

Commit

Permalink
feat: preserve UI state memory on API override (FlowiseAI#3957)
Browse files Browse the repository at this point in the history
  • Loading branch information
grapestore authored and tenuar committed Feb 9, 2025
1 parent 1be62b4 commit 3370b3d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/components/nodes/sequentialagents/State/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down

0 comments on commit 3370b3d

Please sign in to comment.