Fix tags not being properly applied to prompt matrix (#610)

There is an issue on the beta where if you use pipe ( | ) in the prompt to make a prompt matrix, the optional prompts are only applied when the last prompt in the matrix is used.
This commit is contained in:
patriceac 2022-12-09 09:34:25 -08:00 committed by GitHub
parent 854e3d3576
commit 28f822afe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -899,14 +899,16 @@ function getPrompts(prompts) {
prompts = prompts.map(prompt => prompt.trim())
prompts = prompts.filter(prompt => prompt !== '')
let promptsToMake = applyPermuteOperator(prompts)
promptsToMake = applySetOperator(promptsToMake)
const newTags = activeTags.filter(tag => tag.inactive === undefined || tag.inactive === false)
if (newTags.length > 0) {
const promptTags = newTags.map(x => x.name).join(", ")
prompts = prompts.map((prompt) => `${prompt}, ${promptTags}`)
promptsToMake = promptsToMake.map((prompt) => `${prompt}, ${promptTags}`)
}
let promptsToMake = applySetOperator(prompts)
promptsToMake = applyPermuteOperator(promptsToMake)
promptsToMake = applySetOperator(promptsToMake)
return promptsToMake
}