CFG: Add ability to combine negative prompts

This allows for flexibility with global, character, and chat negative
prompts. Combining prompts is very useful for users who want to maintain
a set of global negatives and then add extra layers on top of that. The
ordering is chat -> character -> global tags due to the specificity of
each.

The guidance scale follows the cascade of chat -> character -> global
due to being one number that is set when CFG is fired. If the guidance
scale is 1, nothing happens.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri
2023-08-12 16:17:35 -04:00
parent 5bb6c89868
commit 4a21ee0337
3 changed files with 114 additions and 57 deletions

View File

@@ -63,10 +63,6 @@
</label>
<textarea id="chara_cfg_negative_prompt" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]write short replies, write replies using past tense" placeholder="write short replies, write replies using past tense"></textarea>
</div>
<label class="checkbox_label" for="use_chara_cfg">
<input id="use_chara_cfg" type="checkbox" />
<span data-i18n="Use character CFG">Use character CFG</span>
</label>
</div>
</div>
<hr class="sysHR">
@@ -99,5 +95,33 @@
</div>
</div>
</div>
<hr class="sysHR">
<div class="inline-drawer">
<div id="defaultANBlockToggle" class="inline-drawer-toggle inline-drawer-header">
<b>Negative Cascading</b>
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
</div>
<div class="inline-drawer-content">
<small>
Combine negative prompts from other boxes. For example, ticking the chat, global, and character boxes combine all negative prompts into a comma-separated string.
</small>
<br />
<label for="cfg_negative_combine">
<span data-i18n="Scale">Always Include</span>
</label>
<label class="checkbox_label">
<input type="checkbox" name="cfg_negative_combine" value="0" />
<span data-i18n="Only Format Display">Chat Negatives</span>
</label>
<label class="checkbox_label">
<input type="checkbox" name="cfg_negative_combine" value="1" />
<span data-i18n="Only Format Display">Character Negatives</span>
</label>
<label class="checkbox_label">
<input type="checkbox" name="cfg_negative_combine" value="2" />
<span data-i18n="Use character CFG">Global Negatives</span>
</label>
</div>
</div>
</div>
</div>