From 61764a9a2149c7a19a4537757a893f1b6979a212 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:13:39 +0200 Subject: [PATCH] Change mancer base URL via debug menu --- public/scripts/textgen-settings.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 6c898cebb..2da9e5916 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -11,6 +11,7 @@ import { import { power_user, + registerDebugFunction, } from "./power-user.js"; import { getTextTokens, tokenizers } from "./tokenizers.js"; import { onlyUnique } from "./utils.js"; @@ -29,7 +30,10 @@ export const textgen_types = { }; // Maybe let it be configurable in the future? -export const MANCER_SERVER = 'https://neuro.mancer.tech'; +// (7 days later) The future has come. +const MANCER_SERVER_KEY = 'mancer_server'; +const MANCER_SERVER_DEFAULT = 'https://neuro.mancer.tech'; +export let MANCER_SERVER = localStorage.getItem(MANCER_SERVER_KEY) ?? MANCER_SERVER_DEFAULT; const textgenerationwebui_settings = { temp: 0.7, @@ -259,6 +263,15 @@ function loadTextGenSettings(data, settings) { $(this).show() }) } + + registerDebugFunction('change-mancer-url', 'Change Mancer base URL', 'Change Mancer API server base URL', () => { + const result = prompt(`Enter Mancer base URL\nDefault: ${MANCER_SERVER_DEFAULT}`, MANCER_SERVER); + + if (result) { + localStorage.setItem(MANCER_SERVER_KEY, result); + MANCER_SERVER = result; + } + }); } export function isMancer() {