Comfy-Org / Comfy-Org/ComfyUI_frontend

[Feature Request]: Edit token weight - setting to edit entire tag instead of just word

Open
#4,483 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

This feature would be a new setting under Settings -> Comfy -> Edit Token Weight. A tentative name for it could be "If no existing weight, add weight to", with a dropdown with two choices: "word" (default) and "tag".

"word" would be the current behavior. "tag" would make it so when using CTRL+UP/DOWN to increase/decrease token weight on a word which doesn't already have a weight, the entire tag (as separated by commas) would be given a weight, instead of just the current word.

### Proposed workflow

When in a text input, here is how I would specify the CTRL+UP/DOWN behavior. Those examples could serve as unit test cases.

```
Note: The pipe (|) character represents the cursor. Square brackets ([]) represent visual selection.
"Ctrl+up/down precision" setting is assumed to be 0.1.

# word mode, current behavior

- case: one word in a multi-word tag
- input: `1girl, evil g|rin,` -> user presses CTRL-UP
- output: `1girl, evil (grin:1.1),`

- case: one word in a multi-word tag using underscores instead of spaces
- input: `1girl, evil_g|rin,` -> user presses CTRL-UP
- output: `1girl, evil_(grin:1.1),`

- case: a substring is visually selected
- input: `1gi[rl, evi]l grin,` -> user presses CTRL-UP
- output: `1gi(rl, evi:1.1)l grin,`

- case: existing weight
- input: `1gi(rl, e|vi:1.1)l grin,` -> user presses CTRL-UP
- output: `1gi(rl, evi:1.2)l grin,`

# tag mode, proposed new optional behavior

- case: one word in a multi-word tag
- input: `1girl, evil g|rin,` -> user presses CTRL-UP
- output: `1girl, (evil grin:1.1),`

- case: trailing comma can also be end of text
- input: `1girl, evil g|rin` -> user presses CTRL-UP
- output: `1girl, (evil grin:1.1)`

- case: leading comma can also be beginning of text
- input: `evil g|rin, 1girl` -> user presses CTRL-UP
- output: `(evil grin:1.1), 1girl`

- case: no commas
- input: `evil g|rin 1girl` -> user presses CTRL-UP
- output: `(evil grin 1girl:1.1)`

- case: natural language prompt (not the use case that this setting is mainly intended for, but good to specify)
- input: `A woman wearing a blue dress, pointing at the v|iewer, laughing.` -> user presses CTRL-UP
- output: `A woman wearing a blue dress, (pointing at the viewer:1.1), laughing.

- case: a substring is visually selected (same behavior as currently/as in word mode)
- input: `1gi[rl, evi]l grin,` -> user presses CTRL-UP
- output: `1gi(rl, evi:1.1)l grin,`

- case: existing weight (same behavior as currently/as in word mode)
- input: `1gi(rl, e|vi:1.1)l grin,` -> user presses CTRL-UP
- output: `1gi(rl, evi:1.2)l grin,`
```

Happy to make a PR if this feature request is accepted. The above examples can serve as unit test cases.

### Additional information

If this feature request is accepted, I can write a pull request for it.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-4483-Feature-Request-Edit-token-weight-setting-to-edit-entire-tag-instead-of-just-word-2366d73d36508140a6eeebdce0226be4) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.