Преглед на файлове

fix: prompt undefined caused match problem (#4010)

Joel преди 11 месеца
родител
ревизия
c1fdaa6ae0
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      web/app/components/workflow/nodes/_base/components/variable/utils.ts

+ 2 - 0
web/app/components/workflow/nodes/_base/components/variable/utils.ts

@@ -235,6 +235,8 @@ const matchNotSystemVars = (prompts: string[]) => {
   const allVars: string[] = []
   prompts.forEach((prompt) => {
     VAR_REGEX.lastIndex = 0
+    if (typeof prompt !== 'string')
+      return
     allVars.push(...(prompt.match(VAR_REGEX) || []))
   })
   const uniqVars = uniq(allVars).map(v => v.replaceAll('{{#', '').replace('#}}', '').split('.'))