From bf5b6090eb7727f16dadf01acd6cd0548a2c2864 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Sat, 21 Sep 2024 22:37:15 +0300
Subject: [PATCH] Remove the concept of default context and instruct. Swap
columns
---
default/content/settings.json | 2 -
public/index.html | 276 +++++++++++++++----------------
public/scripts/instruct-mode.js | 43 -----
public/scripts/power-user.js | 23 ---
public/scripts/preset-manager.js | 5 -
public/style.css | 8 -
6 files changed, 137 insertions(+), 220 deletions(-)
diff --git a/default/content/settings.json b/default/content/settings.json
index 6870d28b3..6b188ec3f 100644
--- a/default/content/settings.json
+++ b/default/content/settings.json
@@ -150,7 +150,6 @@
"continue_on_send": false,
"trim_spaces": true,
"relaxed_api_urls": false,
- "default_instruct": "",
"instruct": {
"enabled": false,
"preset": "Alpaca",
@@ -178,7 +177,6 @@
"name": "Neutral - Chat",
"content": "Write {{char}}'s next reply in a fictional chat between {{char}} and {{user}}."
},
- "default_context": "Default",
"context": {
"preset": "Default",
"story_string": "{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}",
diff --git a/public/index.html b/public/index.html
index 735ffeb1b..2addae7ef 100644
--- a/public/index.html
+++ b/public/index.html
@@ -3190,7 +3190,6 @@
-
@@ -3285,143 +3284,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Custom Stopping Strings
-
-
-
-
-
-
-
- JSON serialized array of strings
-
-
-
-
-
-
-
-
-
-
-
-
Tokenizer
-
-
-
-
-
-
-
-
-
Token Padding
-
-
-
-
-
-
-
-
-
-
Miscellaneous
-
-
-
- Non-markdown strings
-
-
-
-
-
-
-
-
-
-
-
- Start Reply With
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Custom Stopping Strings
+
+
+
+
+
+
+
+ JSON serialized array of strings
+
+
+
+
+
+
+
+
+
+
+
+
Tokenizer
+
+
+
+
+
+
+
+
+
Token Padding
+
+
+
+
+
+
+
+
+
+
Miscellaneous
+
+
+
+ Non-markdown strings
+
+
+
+
+
+
+
+
+
+
+
+ Start Reply With
+
+
+
+
+
+
+
+
+
+
diff --git a/public/scripts/instruct-mode.js b/public/scripts/instruct-mode.js
index 6c6124fa9..30badcc31 100644
--- a/public/scripts/instruct-mode.js
+++ b/public/scripts/instruct-mode.js
@@ -136,12 +136,6 @@ export async function loadInstructMode(data) {
option.selected = name === power_user.instruct.preset;
$('#instruct_presets').append(option);
});
-
- highlightDefaultPreset();
-}
-
-function highlightDefaultPreset() {
- $('#instruct_set_default').toggleClass('default', power_user.default_instruct === power_user.instruct.preset);
}
/**
@@ -158,13 +152,6 @@ export function selectContextPreset(preset, { quiet = false, isAuto = false } =
!quiet && toastr.info(`Context Template: "${preset}" ${isAuto ? 'auto-' : ''}selected`);
}
- // If instruct mode is disabled, enable it, except for default context template
- if (!power_user.instruct.enabled && preset !== power_user.default_context) {
- power_user.instruct.enabled = true;
- $('#instruct_enabled').prop('checked', true).trigger('change');
- !quiet && toastr.info('Instruct Mode enabled');
- }
-
saveSettingsDebounced();
}
@@ -234,13 +221,6 @@ export function autoSelectInstructPreset(modelId) {
}
}
}
-
- if (power_user.instruct.bind_to_context && power_user.default_instruct && power_user.instruct.preset !== power_user.default_instruct) {
- if (instruct_presets.some(p => p.name === power_user.default_instruct)) {
- console.log(`Instruct mode: default preset "${power_user.default_instruct}" selected`);
- $('#instruct_presets').val(power_user.default_instruct).trigger('change');
- }
- }
}
return false;
@@ -579,10 +559,6 @@ function selectMatchingContextTemplate(name) {
break;
}
}
- if (!foundMatch) {
- // If no match was found, select default context preset
- selectContextPreset(power_user.default_context, { isAuto: true });
- }
}
/**
@@ -637,20 +613,6 @@ export function replaceInstructMacros(input, env) {
}
jQuery(() => {
- $('#instruct_set_default').on('click', function () {
- if (power_user.instruct.preset === power_user.default_instruct) {
- power_user.default_instruct = null;
- $(this).removeClass('default');
- toastr.info('Default instruct template cleared');
- } else {
- power_user.default_instruct = power_user.instruct.preset;
- $(this).addClass('default');
- toastr.info(`Default instruct template set to ${power_user.default_instruct}`);
- }
-
- saveSettingsDebounced();
- });
-
$('#instruct_system_same_as_user').on('input', function () {
const state = !!$(this).prop('checked');
if (state) {
@@ -679,9 +641,6 @@ jQuery(() => {
// When instruct mode gets enabled, select context template matching selected instruct preset
if (power_user.instruct.enabled) {
selectMatchingContextTemplate(power_user.instruct.preset);
- } else {
- // When instruct mode gets disabled, select default context preset
- selectContextPreset(power_user.default_context);
}
});
@@ -722,7 +681,5 @@ jQuery(() => {
// Select matching context template
selectMatchingContextTemplate(name);
}
-
- highlightDefaultPreset();
});
});
diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js
index d0cef199a..6bd029564 100644
--- a/public/scripts/power-user.js
+++ b/public/scripts/power-user.js
@@ -207,7 +207,6 @@ let power_user = {
disable_group_trimming: false,
single_line: false,
- default_instruct: '',
instruct: {
enabled: false,
preset: 'Alpaca',
@@ -234,7 +233,6 @@ let power_user = {
separator_sequence: '',
},
- default_context: 'Default',
context: {
preset: 'Default',
story_string: defaultStoryString,
@@ -1824,29 +1822,8 @@ async function loadContextSettings() {
}
}
- highlightDefaultContext();
saveSettingsDebounced();
});
-
- $('#context_set_default').on('click', function () {
- if (power_user.context.preset !== power_user.default_context) {
- power_user.default_context = power_user.context.preset;
- $(this).addClass('default');
- toastr.info(`Default context template set to ${power_user.default_context}`);
-
- highlightDefaultContext();
-
- saveSettingsDebounced();
- }
- });
-
- highlightDefaultContext();
-}
-
-function highlightDefaultContext() {
- $('#context_set_default').toggleClass('default', power_user.default_context === power_user.context.preset);
- $('#context_set_default').toggleClass('disabled', power_user.default_context === power_user.context.preset);
- $('#context_delete_preset').toggleClass('disabled', power_user.default_context === power_user.context.preset);
}
/**
diff --git a/public/scripts/preset-manager.js b/public/scripts/preset-manager.js
index e1911dfb7..05789ba0f 100644
--- a/public/scripts/preset-manager.js
+++ b/public/scripts/preset-manager.js
@@ -615,11 +615,6 @@ export async function initPresetManager() {
return;
}
- // default context preset cannot be deleted
- if (apiId == 'context' && power_user.default_context === power_user.context.preset) {
- return;
- }
-
const headerText = !presetManager.isAdvancedFormatting() ? 'Delete this preset?' : 'Delete this template?';
const confirm = await Popup.show.confirm(headerText, 'This action is irreversible and your current settings will be overwritten.');
if (!confirm) {
diff --git a/public/style.css b/public/style.css
index ee1e1ba86..a7fb7d5cd 100644
--- a/public/style.css
+++ b/public/style.css
@@ -2630,14 +2630,6 @@ select option:not(:checked) {
color: var(--active) !important;
}
-#context_set_default.default {
- color: var(--preferred) !important;
-}
-
-#instruct_set_default.default {
- color: var(--preferred) !important;
-}
-
.displayBlock {
display: block !important;
}