mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 06:25:53 +08:00
fix: prompt undefined caused match problem (#4010)
This commit is contained in:
parent
142814d451
commit
c1fdaa6ae0
@ -235,6 +235,8 @@ const matchNotSystemVars = (prompts: string[]) => {
|
|||||||
const allVars: string[] = []
|
const allVars: string[] = []
|
||||||
prompts.forEach((prompt) => {
|
prompts.forEach((prompt) => {
|
||||||
VAR_REGEX.lastIndex = 0
|
VAR_REGEX.lastIndex = 0
|
||||||
|
if (typeof prompt !== 'string')
|
||||||
|
return
|
||||||
allVars.push(...(prompt.match(VAR_REGEX) || []))
|
allVars.push(...(prompt.match(VAR_REGEX) || []))
|
||||||
})
|
})
|
||||||
const uniqVars = uniq(allVars).map(v => v.replaceAll('{{#', '').replace('#}}', '').split('.'))
|
const uniqVars = uniq(allVars).map(v => v.replaceAll('{{#', '').replace('#}}', '').split('.'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user