UI: add UI to enable/disable auto-derived templates

This commit is contained in:
Karl-Johan Alm
2024-11-20 00:23:59 +09:00
parent bb062f5ec9
commit 50ffaeb06a
4 changed files with 40 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ const controls = [
{ id: 'instruct_first_input_sequence', property: 'first_input_sequence', isCheckbox: false },
{ id: 'instruct_last_input_sequence', property: 'last_input_sequence', isCheckbox: false },
{ id: 'instruct_activation_regex', property: 'activation_regex', isCheckbox: false },
{ id: 'instruct_derived', property: 'derived', isCheckbox: true },
{ id: 'instruct_bind_to_context', property: 'bind_to_context', isCheckbox: true },
{ id: 'instruct_skip_examples', property: 'skip_examples', isCheckbox: true },
{ id: 'instruct_names_behavior', property: 'names_behavior', isCheckbox: false },
@@ -100,6 +101,7 @@ export async function loadInstructMode(data) {
$('#instruct_enabled').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.enabled);
$('#instructSettingsBlock, #InstructSequencesColumn').toggleClass('disabled', !power_user.instruct.enabled);
$('#instruct_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.derived);
$('#instruct_bind_to_context').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.bind_to_context);
controls.forEach(control => {
@@ -715,6 +717,10 @@ jQuery(() => {
}
});
$('#instruct_derived').on('change', function () {
$('#instruct_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.derived);
});
$('#instruct_bind_to_context').on('change', function () {
$('#instruct_bind_to_context').parent().find('i').toggleClass('toggleEnabled', !!power_user.instruct.bind_to_context);
});

View File

@@ -226,6 +226,7 @@ let power_user = {
macro: true,
names_behavior: names_behavior_types.FORCE,
activation_regex: '',
derived: false,
bind_to_context: false,
user_alignment_message: '',
system_same_as_user: false,
@@ -243,6 +244,8 @@ let power_user = {
names_as_stop_strings: true,
},
context_derived: false,
sysprompt: {
enabled: true,
name: 'Neutral - Chat',
@@ -1472,6 +1475,7 @@ async function loadPowerUserSettings(settings, data) {
$('#encode_tags').prop('checked', power_user.encode_tags);
$('#example_messages_behavior').val(getExampleMessagesBehavior());
$(`#example_messages_behavior option[value="${getExampleMessagesBehavior()}"]`).prop('selected', true);
$('#context_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.context_derived);
$('#console_log_prompts').prop('checked', power_user.console_log_prompts);
$('#request_token_probabilities').prop('checked', power_user.request_token_probabilities);
@@ -3057,6 +3061,16 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$('#context_derived').on('input', function () {
const value = !!$(this).prop('checked');
power_user.context_derived = value;
saveSettingsDebounced();
});
$('#context_derived').on('change', function () {
$('#context_derived').parent().find('i').toggleClass('toggleEnabled', !!power_user.context_derived);
});
$('#always-force-name2-checkbox').change(function () {
power_user.always_force_name2 = !!$(this).prop('checked');
saveSettingsDebounced();