fix: prompt undefined caused match problem (#4010)

pull/4016/head
Joel 2 years ago committed by GitHub
parent 142814d451
commit c1fdaa6ae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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('.'))

Loading…
Cancel
Save