Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: preserve UI state memory on API override #3957

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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