mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-11-05 00:17:25 +00:00
[GH-ISSUE #47] Have issue working with weight syntanx and editing prompt #36
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
low priority
low priority
pull-request
question
waiting for feedback
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DominikDoom/a1111-sd-webui-tagcomplete#36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @byzod on GitHub (Oct 29, 2022).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/47
Interfere vanilla hotkey to chagne weight, i.e. select a word and press
ctrl+↑orctrl+↓to quick change weight of it. With tagcomplete runnig, this hotkey no longer worksFor example double click to select word
dogin promptgirl, (sad:1.5), dogand pressctrl+↑, the prompt changes togirl, (sad:1.5), (dog:1.1)automatically, when tagcomplete is not installedHave problem showing complete drop list inside weight parenthesis when edit existed tag
For example select
dogingirl, (sad:1.5), dogand typerunnto overwrite it, the tagcomplete list shows and I cantabto selectrunningBut select
sadand typerunnto overwrite it, no list shows.Select
sadand typerunnstill no list show.Select
sadand typerunnthe list shows buttabor clickrunningnothing happens.demo

@DominikDoom commented on GitHub (Oct 29, 2022):
9fc9f1ab7d(v1.6.0), so if you're on a version newer than that it should work (it does for me on the current version).@byzod commented on GitHub (Oct 29, 2022):
Thanks for the confirm, after few test I found that it's a hardcode bug of webui's localization... this feature is not working at all with chinese localization ..I didn't realized that until now :/
github.com/AUTOMATIC1111/stable-diffusion-webui@35c45df28b/javascript/edit-attention.js (L4)It check if the placeholder has
prompt, but in chinese it's提示词, so always return falseParenthesis of correctly written tags are always escaped like
Nero \(fate\), just ignore unescaped (wrong) parenthesis would make things easier@DominikDoom commented on GitHub (Oct 29, 2022):
Good to know, you should probably open an issue there for that bug if there isn't one alreadyAh I see you already did that.
For 2 simply ignoring it sadly isn't an option because () aren't escaped yet if the user is still typing them, but I am currently working on the proper solution with a separate check for the (<tag>:<num>) weighting format. With that in place you should then be able to edit & complete tags in the weighting brackets like any other.
@byzod commented on GitHub (Oct 29, 2022):
Got it: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/3904
I don't know much about the parser thing so no more suggestions I could give :)
Don't forget that webui support complex syntax like this: (part of a real prompt from a friend)
@DominikDoom commented on GitHub (Oct 29, 2022):
Yeah I'm aware, I do some complex prompts from time to time myself.

With my current WIP regex it would look like this:
Everything that is green was matched as a weighted tag, while brown tries to match "normal" tags. As you can see, it already works pretty well, even for nested tags - as long as they have no spaces, which is a limitation of all tags currently.
So when editing a tag that was already inserted, you'd have use underscores:

to still get a proper match. Maybe I'll automate or work around that in the future somehow, but for now it's out of scope.
With spaces ignored, it matches all of them as expected though, so I know the regex will also work for the future.

I just can't ignore them for now because I have no mechanism in place to search & insert tags with underscores or spaces seen as the same.
@byzod commented on GitHub (Oct 29, 2022):
It's worth noting that
(cat ears:1.5)is(cat_ears:1.5), but(girl with cat ears:1.5)is not(girl_with_cat_ears:1.5), there's no way to tell the difference unless you search the tag in database all the time (will that be a performance hit?), nor you can tell user want to editcat earsorgirl with cat earswhen they double click oncat@DominikDoom commented on GitHub (Oct 29, 2022):
Yeah, that is the big problem. I can't know where multi-word tags start or end, and searching for multiple pair combinations would be impossible due to performance reasons - trying out every combination would be:
a. For all groups size 2 to size n, where n is our total tag count.
That would put us at a complexity of O(cn) or worse, which gets out of hand really fast.
That's why I'm choosing to ignore it for now 😅
Finding a proper solution for that would only work in very restrictive circumstances, so I think it's fair game to require manual underscore replacement by the user on that part (or leaving
replaceUnderscoresoff in the config, but that might lead to worse results for some models.@DominikDoom commented on GitHub (Oct 29, 2022):
Editing inside brackets should work now, as long as the hard-coding bug is fixed for you on the webui side.
https://user-images.githubusercontent.com/34448969/198831834-6d31418c-1ad9-41d0-b928-808587ec6059.mp4