diff --git a/public/index.html b/public/index.html
index 615afaac7..d837524e5 100644
--- a/public/index.html
+++ b/public/index.html
@@ -48,6 +48,7 @@
+
Tavern.AI
@@ -122,7 +123,7 @@
API key
Where to get (?)
-
+
@@ -137,27 +138,32 @@
- Preset settings
-
- ?
-
+
+
+ Preset settings
+
+ ?
+
+
-
+
-
Make sure you run it:
+
+ Make sure you run it:
- - with
+
-
+ with
--no-stream
option
- - in notebook mode (not
+
-
+ in notebook mode (not
--cai-chat
or
--chat
)
@@ -457,7 +463,7 @@
Top K
- select
+ select
@@ -467,7 +473,7 @@
Top P
- select
+ select
@@ -478,7 +484,7 @@
Typical P
- select
+ select
@@ -489,7 +495,7 @@
Penalty Alpha
- select
+ select
diff --git a/public/script.js b/public/script.js
index 2bfcc4e09..564857702 100644
--- a/public/script.js
+++ b/public/script.js
@@ -6,6 +6,11 @@ import {
loadKoboldSettings,
} from "./scripts/kai-settings.js";
+import {
+ textgenerationwebui_settings,
+ loadTextGenSettings,
+} from "./scripts/textgen-settings.js";
+
import {
world_info_budget,
world_info_data,
@@ -245,16 +250,6 @@ var user_avatar = "you.png";
var amount_gen = 80; //default max length of AI generated responses
var max_context = 2048;
-var textgenerationwebui_settings = {
- temp: 0.5,
- top_p: 0.9,
- top_k: 0,
- typical_p: 1,
- rep_pen: 1.1,
- rep_pen_size: 0,
- penalty_alpha: 0,
-};
-
var is_pygmalion = false;
var tokens_already_generated = 0;
var message_already_generated = "";
@@ -1973,8 +1968,7 @@ async function getSettings(type) {
//Load AI model config settings (temp, context length, anchors, and anchor order)
- textgenerationwebui_settings =
- settings.textgenerationwebui_settings || textgenerationwebui_settings;
+ loadTextGenSettings(settings.textgenerationwebui_settings);
amount_gen = settings.amount_gen;
if (settings.max_context !== undefined)
@@ -2084,23 +2078,6 @@ async function getSettings(type) {
api_server_textgenerationwebui
);
- for (var i of [
- "temp",
- "rep_pen",
- "rep_pen_size",
- "top_k",
- "top_p",
- "typical_p",
- "penalty_alpha",
- ]) {
- $("#" + i + "_textgenerationwebui").val(
- textgenerationwebui_settings[i]
- );
- $("#" + i + "_counter_textgenerationwebui").html(
- textgenerationwebui_settings[i]
- );
- }
-
selected_button = settings.selected_button;
}
@@ -3712,31 +3689,6 @@ $(document).ready(function () {
}
});
-
-
- for (var i of [
- "temp",
- "rep_pen",
- "rep_pen_size",
- "top_k",
- "top_p",
- "typical_p",
- "penalty_alpha",
- ]) {
- $("#" + i + "_textgenerationwebui").attr("x-setting-id", i);
- $(document).on("input", "#" + i + "_textgenerationwebui", function () {
- var i = $(this).attr("x-setting-id");
- var val = $(this).val();
- if (isInt(val)) {
- $("#" + i + "_counter_textgenerationwebui").html($(this).val() + ".00");
- } else {
- $("#" + i + "_counter_textgenerationwebui").html($(this).val());
- }
- textgenerationwebui_settings[i] = parseFloat(val);
- saveSettingsDebounced();
- });
- }
-
////////////////// OPTIMIZED RANGE SLIDER LISTENERS////////////////
const sliders = [
diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js
new file mode 100644
index 000000000..847e54c94
--- /dev/null
+++ b/public/scripts/textgen-settings.js
@@ -0,0 +1,51 @@
+import {
+ saveSettingsDebounced,
+} from "../script.js";
+
+export {
+ textgenerationwebui_settings,
+ loadTextGenSettings,
+}
+
+let textgenerationwebui_settings = {
+ temp: 0.5,
+ top_p: 0.9,
+ top_k: 0,
+ typical_p: 1,
+ rep_pen: 1.1,
+ rep_pen_size: 0,
+ penalty_alpha: 0,
+};
+
+const setting_names = [
+ "temp",
+ "rep_pen",
+ "rep_pen_size",
+ "top_k",
+ "top_p",
+ "typical_p",
+ "penalty_alpha",
+];
+
+function loadTextGenSettings(settings) {
+ textgenerationwebui_settings = settings ? settings : textgenerationwebui_settings;
+
+ for (const i of setting_names) {
+ const val = parseFloat(textgenerationwebui_settings[i]);
+ $(`#${i}_textgenerationwebui`).val(val);
+ $(`#${i}_counter_textgenerationwebui`).text(val.toFixed(2));
+ }
+}
+
+$(document).ready(function() {
+ for (const i of setting_names) {
+ $(`#${i}_textgenerationwebui`).attr("x-setting-id", i);
+ $(document).on("input", `#${i}_textgenerationwebui`, function () {
+ const id = $(this).attr("x-setting-id");
+ const val = parseFloat($(this).val());
+ $(`#${id}_counter_textgenerationwebui`).text(val.toFixed(2));
+ textgenerationwebui_settings[id] = parseFloat(val);
+ saveSettingsDebounced();
+ });
+ }
+})
\ No newline at end of file
diff --git a/public/style.css b/public/style.css
index 42fb0ff53..21f44ea04 100644
--- a/public/style.css
+++ b/public/style.css
@@ -787,7 +787,8 @@ img[src*="user-slash-solid.svg"] {
}
#api_button:hover,
-#api_button_novel:hover {
+#api_button_novel:hover,
+#api_button_textgenerationwebui {
background-color: green;
}