From c1fdaa6ae0c828342ad2402b9d11dccb2f178659 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 30 Apr 2024 16:31:36 +0800 Subject: [PATCH] fix: prompt undefined caused match problem (#4010) --- .../workflow/nodes/_base/components/variable/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index ee3a70456b..1c396be536 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/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('.'))