From a2f293b6afbbebcec39f509f30e4358c7a1a272f Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 1 Dec 2023 23:06:37 +0200
Subject: [PATCH] Make context stop strings togglable
---
public/index.html | 4 ++++
public/scripts/instruct-mode.js | 12 +++++++-----
public/scripts/power-user.js | 6 ++++++
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/public/index.html b/public/index.html
index 6f67fc5d4..6f136c947 100644
--- a/public/index.html
+++ b/public/index.html
@@ -2178,6 +2178,10 @@
+
diff --git a/public/scripts/instruct-mode.js b/public/scripts/instruct-mode.js
index 82c89c66a..24c1a5e2c 100644
--- a/public/scripts/instruct-mode.js
+++ b/public/scripts/instruct-mode.js
@@ -214,12 +214,14 @@ export function getInstructStoppingSequences() {
combined_sequence.split('\n').filter((line, index, self) => self.indexOf(line) === index).forEach(addInstructSequence);
}
- if (power_user.context.chat_start) {
- result.push(`\n${substituteParams(power_user.context.chat_start)}`);
- }
+ if (power_user.context.use_stop_strings) {
+ if (power_user.context.chat_start) {
+ result.push(`\n${substituteParams(power_user.context.chat_start)}`);
+ }
- if (power_user.context.example_separator) {
- result.push(`\n${substituteParams(power_user.context.example_separator)}`);
+ if (power_user.context.example_separator) {
+ result.push(`\n${substituteParams(power_user.context.example_separator)}`);
+ }
}
return result;
diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js
index 7aa362a21..c397536eb 100644
--- a/public/scripts/power-user.js
+++ b/public/scripts/power-user.js
@@ -206,6 +206,7 @@ let power_user = {
story_string: defaultStoryString,
chat_start: defaultChatStart,
example_separator: defaultExampleSeparator,
+ use_stop_strings: true,
},
personas: {},
@@ -271,6 +272,7 @@ const contextControls = [
{ id: "context_story_string", property: "story_string", isCheckbox: false, isGlobalSetting: false },
{ id: "context_example_separator", property: "example_separator", isCheckbox: false, isGlobalSetting: false },
{ id: "context_chat_start", property: "chat_start", isCheckbox: false, isGlobalSetting: false },
+ { id: "context_use_stop_strings", property: "use_stop_strings", isCheckbox: true, isGlobalSetting: false, defaultValue: true },
// Existing power user settings
{ id: "always-force-name2-checkbox", property: "always_force_name2", isCheckbox: true, isGlobalSetting: true, defaultValue: true },
@@ -1595,6 +1597,10 @@ function loadContextSettings() {
return;
}
+ if (control.defaultValue !== undefined && power_user.context[control.property] === undefined) {
+ power_user.context[control.property] = control.defaultValue;
+ }
+
if (control.isCheckbox) {
$element.prop('checked', power_user.context[control.property]);
} else {