chore: fix DSL crash

This commit is contained in:
JzoNg 2025-02-10 12:41:54 +08:00
parent e149775616
commit ae800c21dd

View File

@ -57,11 +57,11 @@ const nodeDefault: NodeDefault<AgentNodeType> = {
} }
// check form of tool // check form of tool
else { else {
const schemas = toolValue.schemas const schemas = toolValue.schemas || []
const userSettings = toolValue.settings const userSettings = toolValue.settings
const reasoningConfig = toolValue.parameters const reasoningConfig = toolValue.parameters
schemas.forEach((schema: any) => { schemas.forEach((schema: any) => {
if (schema.required) { if (schema?.required) {
if (schema.form === 'form' && !userSettings[schema.name]?.value) { if (schema.form === 'form' && !userSettings[schema.name]?.value) {
return { return {
isValid: false, isValid: false,
@ -102,11 +102,11 @@ const nodeDefault: NodeDefault<AgentNodeType> = {
errorMessage: '', errorMessage: '',
} }
for (const tool of tools) { for (const tool of tools) {
const schemas = tool.schemas const schemas = tool.schemas || []
const userSettings = tool.settings const userSettings = tool.settings
const reasoningConfig = tool.parameters const reasoningConfig = tool.parameters
schemas.forEach((schema: any) => { schemas.forEach((schema: any) => {
if (schema.required) { if (schema?.required) {
if (schema.form === 'form' && !userSettings[schema.name]?.value) { if (schema.form === 'form' && !userSettings[schema.name]?.value) {
return validState = { return validState = {
isValid: false, isValid: false,