mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
setting for relaxed api urls
This commit is contained in:
@ -2542,6 +2542,9 @@
|
|||||||
<label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
|
<label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
|
||||||
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
|
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label for="relaxed_api_urls" title="Reduce the formatting requirements on API URLS"><input id="relaxed_api_urls" type="checkbox" />
|
||||||
|
<span data-i18n="Relaxed API URLS">Relaxed API URLS</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div class="inline-drawer wide100p flexFlowColumn">
|
<div class="inline-drawer wide100p flexFlowColumn">
|
||||||
<div class="inline-drawer-toggle inline-drawer-header">
|
<div class="inline-drawer-toggle inline-drawer-header">
|
||||||
|
@ -4,6 +4,10 @@ import {
|
|||||||
getStoppingStrings,
|
getStoppingStrings,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
power_user,
|
||||||
|
} from "./power-user.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
kai_settings,
|
kai_settings,
|
||||||
loadKoboldSettings,
|
loadKoboldSettings,
|
||||||
@ -35,7 +39,12 @@ const MIN_STREAMING_KCPPVERSION = '1.30';
|
|||||||
function formatKoboldUrl(value) {
|
function formatKoboldUrl(value) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(value);
|
const url = new URL(value);
|
||||||
if (url.pathname.endsWith('/api')) {
|
if (power_user.settings.relaxed_api_urls) {
|
||||||
|
if (url.pathname.endsWith('/api')) {
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
url.pathname = '/api';
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
} catch { } // Try and Catch both fall through to the same return.
|
} catch { } // Try and Catch both fall through to the same return.
|
||||||
|
@ -163,6 +163,7 @@ let power_user = {
|
|||||||
prefer_character_jailbreak: true,
|
prefer_character_jailbreak: true,
|
||||||
continue_on_send: false,
|
continue_on_send: false,
|
||||||
trim_spaces: true,
|
trim_spaces: true,
|
||||||
|
relaxed_api_urls: false,
|
||||||
|
|
||||||
instruct: {
|
instruct: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@ -671,6 +672,7 @@ function loadPowerUserSettings(settings, data) {
|
|||||||
power_user.chat_width = 50;
|
power_user.chat_width = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
|
||||||
$('#trim_spaces').prop("checked", power_user.trim_spaces);
|
$('#trim_spaces').prop("checked", power_user.trim_spaces);
|
||||||
$('#continue_on_send').prop("checked", power_user.continue_on_send);
|
$('#continue_on_send').prop("checked", power_user.continue_on_send);
|
||||||
$('#auto_swipe').prop("checked", power_user.auto_swipe);
|
$('#auto_swipe').prop("checked", power_user.auto_swipe);
|
||||||
@ -1979,6 +1981,12 @@ $(document).ready(() => {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#relaxed_api_urls").on("input", function () {
|
||||||
|
const value = !!$(this).prop('checked');
|
||||||
|
power_user.relaxed_api_urls = value;
|
||||||
|
saveSettingsDebounced();
|
||||||
|
});
|
||||||
|
|
||||||
$('#spoiler_free_mode').on('input', function () {
|
$('#spoiler_free_mode').on('input', function () {
|
||||||
power_user.spoiler_free_mode = !!$(this).prop('checked');
|
power_user.spoiler_free_mode = !!$(this).prop('checked');
|
||||||
switchSpoilerMode();
|
switchSpoilerMode();
|
||||||
|
Reference in New Issue
Block a user