Moving attention weighting to InvokeAI syntax (#1055)

* Moving attention weighting to InvokeAI syntax

() and [] were actually ignored by the legacy parser, so moving the Ctrl+Wheel shortcut to the InvokeAI syntax of '+' and '-'.

* Moving attention weighting to InvokeAI syntax

() and [] were actually ignored by the legacy parser, so moving the Ctrl+Wheel shortcut to the InvokeAI syntax of '+' and '-'.

* Properly cleanup parenthesis

'(image tag)++' need to be trimmed to 'image tag'

* Add parenthesis as needed when adjusting weights

In the InvokeAI syntax, 'image modifier' must become '(image modifier)++' when adjusting weight.

* Code cleanup
This commit is contained in:
patriceac
2023-03-28 03:05:51 -07:00
committed by GitHub
parent d81be64711
commit a10dfd0386
2 changed files with 29 additions and 14 deletions

View File

@ -129,7 +129,10 @@ function createModifierGroup(modifierGroup, initiallyExpanded, removeBy) {
}
function trimModifiers(tag) {
return tag.replace(/^\(+|\)+$/g, '').replace(/^\[+|\]+$/g, '')
// Remove trailing '-' and/or '+'
tag = tag.replace(/[-+]+$/, '');
// Remove parentheses at beginning and end
return tag.replace(/^[(]+|[\s)]+$/g, '');
}
async function loadModifiers() {