Image Generation: Add tool message visibility toggle

This commit is contained in:
Cohee 2024-12-19 19:33:29 +02:00
parent f3c12fb926
commit e83182c03b
2 changed files with 20 additions and 3 deletions

View File

@ -319,6 +319,7 @@ const defaultSettings = {
wand_visible: false, wand_visible: false,
command_visible: false, command_visible: false,
interactive_visible: false, interactive_visible: false,
tool_visible: false,
// Stability AI settings // Stability AI settings
stability_style_preset: 'anime', stability_style_preset: 'anime',
@ -488,6 +489,7 @@ async function loadSettings() {
$('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible); $('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible);
$('#sd_command_visible').prop('checked', extension_settings.sd.command_visible); $('#sd_command_visible').prop('checked', extension_settings.sd.command_visible);
$('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible); $('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible);
$('#sd_tool_visible').prop('checked', extension_settings.sd.tool_visible);
$('#sd_stability_style_preset').val(extension_settings.sd.stability_style_preset); $('#sd_stability_style_preset').val(extension_settings.sd.stability_style_preset);
$('#sd_huggingface_model_id').val(extension_settings.sd.huggingface_model_id); $('#sd_huggingface_model_id').val(extension_settings.sd.huggingface_model_id);
$('#sd_function_tool').prop('checked', extension_settings.sd.function_tool); $('#sd_function_tool').prop('checked', extension_settings.sd.function_tool);
@ -844,6 +846,11 @@ function onInteractiveVisibleInput() {
saveSettingsDebounced(); saveSettingsDebounced();
} }
function onToolVisibleInput() {
extension_settings.sd.tool_visible = !!$('#sd_tool_visible').prop('checked');
saveSettingsDebounced();
}
function onClipSkipInput() { function onClipSkipInput() {
extension_settings.sd.clip_skip = Number($('#sd_clip_skip').val()); extension_settings.sd.clip_skip = Number($('#sd_clip_skip').val());
$('#sd_clip_skip_value').val(extension_settings.sd.clip_skip); $('#sd_clip_skip_value').val(extension_settings.sd.clip_skip);
@ -3670,6 +3677,8 @@ function getVisibilityByInitiator(initiator) {
return !!extension_settings.sd.wand_visible; return !!extension_settings.sd.wand_visible;
case initiators.command: case initiators.command:
return !!extension_settings.sd.command_visible; return !!extension_settings.sd.command_visible;
case initiators.tool:
return !!extension_settings.sd.tool_visible;
default: default:
return false; return false;
} }
@ -4417,6 +4426,7 @@ jQuery(async () => {
$('#sd_wand_visible').on('input', onWandVisibleInput); $('#sd_wand_visible').on('input', onWandVisibleInput);
$('#sd_command_visible').on('input', onCommandVisibleInput); $('#sd_command_visible').on('input', onCommandVisibleInput);
$('#sd_interactive_visible').on('input', onInteractiveVisibleInput); $('#sd_interactive_visible').on('input', onInteractiveVisibleInput);
$('#sd_tool_visible').on('input', onToolVisibleInput);
$('#sd_swap_dimensions').on('click', onSwapDimensionsClick); $('#sd_swap_dimensions').on('click', onSwapDimensionsClick);
$('#sd_stability_key').on('click', onStabilityKeyClick); $('#sd_stability_key').on('click', onStabilityKeyClick);
$('#sd_stability_style_preset').on('change', onStabilityStylePresetChange); $('#sd_stability_style_preset').on('change', onStabilityStylePresetChange);

View File

@ -459,25 +459,32 @@
<div class="flex-container flexFlowColumn marginTopBot5 flexGap10"> <div class="flex-container flexFlowColumn marginTopBot5 flexGap10">
<label for="sd_wand_visible" class="checkbox_label"> <label for="sd_wand_visible" class="checkbox_label">
<span class="flex1 flex-container alignItemsCenter"> <span class="flex1 flex-container alignItemsCenter">
<i class="fa-solid fa-wand-magic-sparkles"></i> <i class="fa-solid fa-wand-magic-sparkles fa-fw"></i>
<span data-i18n="Extensions Menu">Extensions Menu</span> <span data-i18n="Extensions Menu">Extensions Menu</span>
</span> </span>
<input id="sd_wand_visible" type="checkbox" /> <input id="sd_wand_visible" type="checkbox" />
</label> </label>
<label for="sd_command_visible" class="checkbox_label"> <label for="sd_command_visible" class="checkbox_label">
<span class="flex1 flex-container alignItemsCenter"> <span class="flex1 flex-container alignItemsCenter">
<i class="fa-solid fa-terminal"></i> <i class="fa-solid fa-terminal fa-fw"></i>
<span data-i18n="Slash Command">Slash Command</span> <span data-i18n="Slash Command">Slash Command</span>
</span> </span>
<input id="sd_command_visible" type="checkbox" /> <input id="sd_command_visible" type="checkbox" />
</label> </label>
<label for="sd_interactive_visible" class="checkbox_label"> <label for="sd_interactive_visible" class="checkbox_label">
<span class="flex1 flex-container alignItemsCenter"> <span class="flex1 flex-container alignItemsCenter">
<i class="fa-solid fa-message"></i> <i class="fa-solid fa-message fa-fw"></i>
<span data-i18n="Interactive Mode">Interactive Mode</span> <span data-i18n="Interactive Mode">Interactive Mode</span>
</span> </span>
<input id="sd_interactive_visible" type="checkbox" /> <input id="sd_interactive_visible" type="checkbox" />
</label> </label>
<label for="sd_tool_visible" class="checkbox_label">
<span class="flex1 flex-container alignItemsCenter">
<i class="fa-solid fa-code fa-fw"></i>
<span data-i18n="Function Tool">Function Tool</span>
</span>
<input id="sd_tool_visible" type="checkbox" />
</label>
</div> </div>
</div> </div>
</div> </div>