feat(prompts): hotkey controlled prompt weighting
Summary
Adds the ability to use keyboard controls to adjust prompt weightings using ctrl + up / down.
Related Issues / Discussions
https://discord.com/channels/1020123559063990373/1407078244531965963
QA Instructions
Merge Plan
Checklist
- [x] The PR has a short but descriptive title, suitable for a changelog
- [x] Tests added / updated (if applicable)
- [ ] ❗Changes to a redux slice have a corresponding migration
- [ ] Documentation added / updated (if applicable)
- [ ] Updated
What's Newcopy (if doing a release after this PR)
I had a quick look at this, but couldn't figure out the UI for adjusting the prompt weightings. I guess the prompt weight code isn't wired up to the UI yet?
What is the intended interface? Does the user select a word or phrase in the prompt textbox and then presses ctrl-up/down in order to increase or decrease the weighting?
I had a quick look at this, but couldn't figure out the UI for adjusting the prompt weightings. I guess the prompt weight code isn't wired up to the UI yet?
What is the intended interface? Does the user select a word or phrase in the prompt textbox and then presses ctrl-up/down in order to increase or decrease the weighting?
Yeah I've got a local implementation but it's not solid enough to commit yet. But yes that's the current way to use it (ctrl + up/down). There is a long list of rules to make sure it automagically makes intelligent selections to modify, some of those are in the discord forum on this topic.
@joshistoast Just checking in to see if you're still working on this?
@joshistoast Just checking in to see if you're still working on this?
@lstein Apologies for my tardiness on this, it's sitting on my PC at home mostly done but I'm out of state ATM. Will try to have this done within the month god willing.
Including this here:
Behavior Rules:
ATTENTION SYNTAX:
- Words support +/- attention:
word+,word-,word++,word--, etc. - Groups support both +/- and numeric:
(words)+,(words)1.2,(words)0.8 word++is roughly equivalent to(word)1.2in effect- Mixed attention like
word+-or numeric on wordsword1.2is invalid
ADJUSTMENT RULES:
word++down →word+word+down →word(attention removed)worddown →word-word-down →word--(content)1.2down →(content)1.1(content)1.1down →content(group unwrapped)content contentdown →(content content)0.9(new group created)
SELECTION BEHAVIOR:
- Cursor/selection within a word → expand to full word, adjust word attention
- Cursor touching group boundary (parens or weight) → adjust group attention
- Selection entirely within a group → adjust that group's attention
- Selection spans multiple content nodes → create new group with initial attention
- Whitespace and punctuation are ignored for content selection
Ctrl + Mouse Wheel would be great. It needs to get around the default zooming function somehow though.
Yippee test succeeded
You are still getting lint:prettier errors. I was able to fix this on my local copy using pnpm prettier --write invokeai/frontend. However, I don't have permission to push to your branch. Once all the tests pass, I'll merge your PR.
You are still getting lint:prettier errors. I was able to fix this on my local copy using
pnpm prettier --write invokeai/frontend. However, I don't have permission to push to your branch. Once all the tests pass, I'll merge your PR.
Fixed the lint issue. Also, I have Allow edits by maintainers checked, so I'm not sure why it's not letting you push to it.