mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-09 08:38:53 +01:00
Instruct "Bind to context" is now an option
This commit is contained in:
parent
ee75adbd2d
commit
dd661cf879
@ -2380,11 +2380,15 @@
|
|||||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
<div>
|
<div class="flex-container">
|
||||||
<label for="instruct_enabled" class="checkbox_label">
|
<label for="instruct_enabled" class="checkbox_label flex1">
|
||||||
<input id="instruct_enabled" type="checkbox" />
|
<input id="instruct_enabled" type="checkbox" />
|
||||||
<span data-i18n="Enabled">Enabled</span>
|
<span data-i18n="Enabled">Enabled</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label for="instruct_bind_to_context" class="checkbox_label flex1" title="If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference.">
|
||||||
|
<input id="instruct_bind_to_context" type="checkbox" />
|
||||||
|
<span data-i18n="Bind to Context">Bind to Context</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="instruct_presets">
|
<label for="instruct_presets">
|
||||||
<span data-i18n="Presets">Presets</span>
|
<span data-i18n="Presets">Presets</span>
|
||||||
|
@ -29,6 +29,7 @@ const controls = [
|
|||||||
{ id: 'instruct_first_output_sequence', property: 'first_output_sequence', isCheckbox: false },
|
{ id: 'instruct_first_output_sequence', property: 'first_output_sequence', isCheckbox: false },
|
||||||
{ id: 'instruct_last_output_sequence', property: 'last_output_sequence', isCheckbox: false },
|
{ id: 'instruct_last_output_sequence', property: 'last_output_sequence', isCheckbox: false },
|
||||||
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
|
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
|
||||||
|
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -409,6 +410,10 @@ jQuery(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#instruct_enabled').on('change', function () {
|
$('#instruct_enabled').on('change', function () {
|
||||||
|
if (!power_user.instruct.bind_to_context) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// When instruct mode gets enabled, select context template matching selected instruct preset
|
// When instruct mode gets enabled, select context template matching selected instruct preset
|
||||||
if (power_user.instruct.enabled) {
|
if (power_user.instruct.enabled) {
|
||||||
selectMatchingContextTemplate(power_user.instruct.preset);
|
selectMatchingContextTemplate(power_user.instruct.preset);
|
||||||
@ -440,8 +445,10 @@ jQuery(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Select matching context template
|
if (power_user.instruct.bind_to_context) {
|
||||||
selectMatchingContextTemplate(name);
|
// Select matching context template
|
||||||
|
selectMatchingContextTemplate(name);
|
||||||
|
}
|
||||||
|
|
||||||
highlightDefaultPreset();
|
highlightDefaultPreset();
|
||||||
});
|
});
|
||||||
|
@ -205,6 +205,7 @@ let power_user = {
|
|||||||
names: false,
|
names: false,
|
||||||
names_force_groups: true,
|
names_force_groups: true,
|
||||||
activation_regex: '',
|
activation_regex: '',
|
||||||
|
bind_to_context: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
default_context: 'Default',
|
default_context: 'Default',
|
||||||
@ -1718,17 +1719,18 @@ function loadContextSettings() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Select matching instruct preset
|
if (power_user.instruct.bind_to_context) {
|
||||||
for (const instruct_preset of instruct_presets) {
|
// Select matching instruct preset
|
||||||
// If instruct preset matches the context template
|
for (const instruct_preset of instruct_presets) {
|
||||||
if (instruct_preset.name === name) {
|
// If instruct preset matches the context template
|
||||||
selectInstructPreset(instruct_preset.name);
|
if (instruct_preset.name === name) {
|
||||||
break;
|
selectInstructPreset(instruct_preset.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightDefaultContext();
|
highlightDefaultContext();
|
||||||
|
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -303,6 +303,7 @@ class PresetManager {
|
|||||||
'model_novel',
|
'model_novel',
|
||||||
'streaming_kobold',
|
'streaming_kobold',
|
||||||
'enabled',
|
'enabled',
|
||||||
|
'bind_to_context',
|
||||||
'seed',
|
'seed',
|
||||||
'legacy_api',
|
'legacy_api',
|
||||||
'mancer_model',
|
'mancer_model',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user