document autocompletions engine

for #247
This commit is contained in:
Alex "mcmonkey" Goodwin
2024-04-22 23:12:40 -07:00
parent e659c8bd20
commit 9cf1dad810
4 changed files with 31 additions and 6 deletions

24
docs/Autocompletions.md Normal file
View File

@@ -0,0 +1,24 @@
# StableSwarmUI Autocompletions Engine
When you're typing into a prompt box within Swarm, the **autocompletions engine** is looking for ways to help you.
### Prompt Syntax
The first way it will try to help you is with regards to advanced prompt syntax, as documented in [Basic Usage](/docs/Basic%20Usage.md). As soon as you type the `<` symbol, you'll see suggestions for prompt syntax options:
![image](images/autocompletions.png)
- You can start typing the name of one to narrow down to just that option.
- You can hit *tab* or click an option to immediately complete it.
- For syntax features with more options/configuration, it will complete to eg `<random:` with a colon on the end, and the replace the completions with documentation on what options you have available.
### Word Lists
If you want to have autocompletions for word lists (*such as anime booru tags*), you can! You just need to set it up first:
- Find a word-list file. There are [several here you can use](https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/tree/main/tags). Any `.csv` will do (if the word is the first entry per row), or `.txt` files (for newline-separated wordlists, allowing `#` to mark comments).
- Save the file into `StableSwarmUI/Data/Autocompletions`.
- Restart swarm or reload parameter values if necessary.
- Go to `User` -> `User Settings`
- find the option `AutoCompletionsSource` and select your word list file of choice.
- Go back to the generate tab, and start typing! Words will pop up and are tab completable or clickable.

View File

@@ -5,6 +5,7 @@
- [Presets](/docs/Presets.md) for info about presets, and a download of an official list of high quality SDXL presets.
- [Advanced usage](/docs/Advanced%20Usage.md) for various examples of advanced usages and explanations of them.
- [Model Support](/docs/Model%20Support.md) for details about support of different model types.
- [Autocompletions](/docs/Autocompletions.md) for details about the prompt autocompletions engine.
- TODO: Settings
- TODO: Account system
- [Command line arguments](/docs/Command%20Line%20Arguments.md) describes the available command line arguments in detail.

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -1193,12 +1193,6 @@ class PromptTabCompleteClass {
let apply = name;
let isClickable = true;
let index = lastBrace;
if (val.startsWith(`<raw>`)) {
name = val.substring(5);
desc = '';
apply = name;
index = wordIndex;
}
if (typeof val == 'object') {
[name, desc] = val;
if (this.prefixes[name].selfStanding) {
@@ -1208,6 +1202,12 @@ class PromptTabCompleteClass {
apply = `<${name}:`;
}
}
else if (val.startsWith(`<raw>`)) {
name = val.substring(5);
desc = '';
apply = name;
index = wordIndex;
}
else if (val.startsWith('\n')) {
isClickable = false;
name = '';