mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Power user: new module
This commit is contained in:
@ -44,6 +44,7 @@
|
||||
|
||||
<script type="module" src="scripts/world-info.js"></script>
|
||||
<script type="module" src="scripts/group-chats.js"></script>
|
||||
<script type="module" src="scripts/power-user.js"></script>
|
||||
|
||||
<title>Tavern.AI</title>
|
||||
</head>
|
||||
@ -739,6 +740,9 @@
|
||||
<label for="collapse-newlines-checkbox"><input id="collapse-newlines-checkbox" type="checkbox" />
|
||||
<h4>Collapse Newlines in Output</h4>
|
||||
</label>
|
||||
<label for="force-pygmalion-formatting-checkbox"><input id="force-pygmalion-formatting-checkbox" type="checkbox" />
|
||||
<h4>Force Pygmalion formatting for any model</h4>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -25,6 +25,11 @@ import {
|
||||
select_group_chats,
|
||||
} from "./scripts/group-chats.js";
|
||||
|
||||
import {
|
||||
force_pygmalion_formatting,
|
||||
collapse_newlines,
|
||||
} from "./scripts/power-user.js";
|
||||
|
||||
import { debounce, delay } from "./scripts/utils.js";
|
||||
|
||||
//RossAscends: exporting functions and vars for RA mods.
|
||||
@ -97,7 +102,6 @@ const system_avatar = "img/five.png";
|
||||
let is_colab = false;
|
||||
let is_checked_colab = false;
|
||||
let is_mes_reload_avatar = false;
|
||||
let collapse_newlines = false;
|
||||
|
||||
const durationSaveEdit = 500;
|
||||
const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit);
|
||||
@ -157,9 +161,6 @@ const system_messages = {
|
||||
};
|
||||
|
||||
const talkativeness_default = 0.5;
|
||||
const storage_keys = {
|
||||
collapse_newlines: "TavernAI_collapse_newlines",
|
||||
};
|
||||
|
||||
var is_advanced_char_open = false;
|
||||
|
||||
@ -234,8 +235,6 @@ var anchor_order = 0;
|
||||
var style_anchor = true;
|
||||
var character_anchor = true;
|
||||
let extension_prompts = {};
|
||||
var auto_connect = false;
|
||||
var auto_load_chat = false;
|
||||
|
||||
var main_api = "kobold";
|
||||
//novel settings
|
||||
@ -376,7 +375,7 @@ async function getStatus() {
|
||||
if (online_status == undefined) {
|
||||
online_status = "no_connection";
|
||||
}
|
||||
if (online_status.toLowerCase().indexOf("pygmalion") != -1) {
|
||||
if (online_status.toLowerCase().indexOf("pygmalion") != -1 || force_pygmalion_formatting) {
|
||||
is_pygmalion = true;
|
||||
online_status += " (Pyg. formatting on)";
|
||||
} else {
|
||||
@ -2059,12 +2058,6 @@ async function getSettings(type) {
|
||||
if (settings.character_anchor !== undefined)
|
||||
character_anchor = !!settings.character_anchor;
|
||||
|
||||
//load poweruser options
|
||||
if (settings.auto_connect !== undefined)
|
||||
auto_connect = !!settings.auto_connect;
|
||||
if (settings.auto_load_chat !== undefined)
|
||||
auto_load_chat = !!settings.auto_load_chat;
|
||||
|
||||
rep_pen = settings.rep_pen;
|
||||
rep_pen_size = settings.rep_pen_size;
|
||||
|
||||
@ -2080,9 +2073,6 @@ async function getSettings(type) {
|
||||
"true"
|
||||
);
|
||||
|
||||
$("#auto-connect-checkbox").prop("checked", auto_connect);
|
||||
$("#auto-load-chat-checkbox").prop("checked", auto_load_chat);
|
||||
|
||||
$("#max_context").val(max_context);
|
||||
$("#max_context_counter").html(max_context + " Tokens");
|
||||
|
||||
@ -2230,10 +2220,6 @@ async function getSettings(type) {
|
||||
console.log(jqXHR);
|
||||
},
|
||||
});
|
||||
|
||||
collapse_newlines =
|
||||
localStorage.getItem(storage_keys.collapse_newlines) == "true";
|
||||
$("#collapse-newlines-checkbox").prop("checked", collapse_newlines);
|
||||
}
|
||||
|
||||
async function saveSettings(type) {
|
||||
@ -2254,8 +2240,6 @@ async function saveSettings(type) {
|
||||
anchor_order: anchor_order,
|
||||
style_anchor: style_anchor,
|
||||
character_anchor: character_anchor,
|
||||
auto_connect: auto_connect,
|
||||
auto_load_chat: auto_load_chat,
|
||||
main_api: main_api,
|
||||
api_key_novel: api_key_novel,
|
||||
rep_pen: rep_pen,
|
||||
@ -2297,8 +2281,6 @@ async function saveSettings(type) {
|
||||
console.log(jqXHR);
|
||||
},
|
||||
});
|
||||
|
||||
localStorage.setItem(storage_keys.collapse_newlines, collapse_newlines);
|
||||
}
|
||||
|
||||
function isInt(value) {
|
||||
@ -3739,21 +3721,6 @@ $(document).ready(function () {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#auto-connect-checkbox").change(function () {
|
||||
auto_connect = !!$("#auto-connect-checkbox").prop("checked");
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#auto-load-chat-checkbox").change(function () {
|
||||
auto_load_chat = !!$("#auto-load-chat-checkbox").prop("checked");
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#collapse-newlines-checkbox").change(function () {
|
||||
collapse_newlines = !!$("#collapse-newlines-checkbox").prop("checked");
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(document).on("input", "#rep_pen", function () {
|
||||
rep_pen = $(this).val();
|
||||
if (isInt(rep_pen)) {
|
||||
|
35
public/scripts/power-user.js
Normal file
35
public/scripts/power-user.js
Normal file
@ -0,0 +1,35 @@
|
||||
export {
|
||||
collapse_newlines,
|
||||
force_pygmalion_formatting,
|
||||
};
|
||||
|
||||
let collapse_newlines = false;
|
||||
let force_pygmalion_formatting = false;
|
||||
|
||||
const storage_keys = {
|
||||
collapse_newlines: "TavernAI_collapse_newlines",
|
||||
force_pygmalion_formatting: "TavernAI_force_pygmalion_formatting",
|
||||
};
|
||||
|
||||
function loadPowerUserSettings() {
|
||||
collapse_newlines = localStorage.getItem(storage_keys.collapse_newlines) == "true";
|
||||
force_pygmalion_formatting = localStorage.getItem(storage_keys.force_pygmalion_formatting) == "true";
|
||||
|
||||
$("#force-pygmalion-formatting-checkbox").prop("checked", force_pygmalion_formatting);
|
||||
$("#collapse-newlines-checkbox").prop("checked", collapse_newlines);
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
// Auto-load from local storage
|
||||
loadPowerUserSettings();
|
||||
|
||||
$("#collapse-newlines-checkbox").change(function () {
|
||||
collapse_newlines = !!$("#collapse-newlines-checkbox").prop("checked");
|
||||
localStorage.setItem(storage_keys.collapse_newlines, collapse_newlines);
|
||||
});
|
||||
|
||||
$("#force-pygmalion-formatting-checkbox").change(function () {
|
||||
force_pygmalion_formatting = !!$("#force-pygmalion-formatting-checkbox").prop("checked");
|
||||
localStorage.setItem(storage_keys.force_pygmalion_formatting, force_pygmalion_formatting);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user