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

[BUGFIX] Fix value.startsWith is not a function error #3747

Merged
Merged
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion packages/components/nodes/sequentialagents/commonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,22 @@ export const transformObjectPropertyToFunction = (obj: ICommonObject, state: ISe
(message) => message.additional_kwargs && message.additional_kwargs?.nodeId === parsedValue.id
)
const messageOutput = messageOutputs[messageOutputs.length - 1]
if (messageOutput) value = messageOutput.content
if (messageOutput) {
// if messageOutput.content is a string, set value to the content
if (typeof messageOutput.content === 'string') value = messageOutput.content
// if messageOutput.content is an array
else if (Array.isArray(messageOutput.content)) {
HenryHengZJ marked this conversation as resolved.
Show resolved Hide resolved
// Get the first element of the array
const messageOutputContentFirstElement: any = messageOutput.content[0]

if (typeof messageOutputContentFirstElement === 'string') value = messageOutputContentFirstElement
// If messageOutputContentFirstElement is an object and has a text property, set value to the text property
else if (typeof messageOutputContentFirstElement === 'object' && messageOutputContentFirstElement.text)
value = messageOutputContentFirstElement.text
// Otherwise, stringify the messageOutputContentFirstElement
else value = JSON.stringify(messageOutputContentFirstElement)
}
}
}
} catch (e) {
// do nothing
Expand Down
Loading