when using the same id in additional_text, the text is asked only once and then used in every occurrence. see #525
This commit is contained in:
parent
5bbe379c0c
commit
ae26e9288b
1 changed files with 9 additions and 4 deletions
|
|
@ -489,11 +489,16 @@ export const placeholdersUtils = {
|
|||
const regex = /{%\s*additional_text(?::(.*?))?\s*%}/g;
|
||||
let matches = [];
|
||||
let match;
|
||||
let foundIds = new Set();
|
||||
while ((match = regex.exec(prompt_text)) !== null) {
|
||||
matches.push({
|
||||
placeholder: match[0],
|
||||
info: match[1] ? match[1].trim() : ""
|
||||
});
|
||||
let info = match[1] ? match[1].trim() : "";
|
||||
if (!foundIds.has(info)) {
|
||||
foundIds.add(info);
|
||||
matches.push({
|
||||
placeholder: match[0],
|
||||
info: info
|
||||
});
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue