setting for relaxed api urls
This commit is contained in:
parent
2d07cce1dd
commit
6b2455da2b
|
@ -2542,6 +2542,9 @@
|
|||
<label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
|
||||
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
|
||||
</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-toggle inline-drawer-header">
|
||||
|
|
|
@ -4,6 +4,10 @@ import {
|
|||
getStoppingStrings,
|
||||
} from "../script.js";
|
||||
|
||||
import {
|
||||
power_user,
|
||||
} from "./power-user.js";
|
||||
|
||||
export {
|
||||
kai_settings,
|
||||
loadKoboldSettings,
|
||||
|
@ -35,7 +39,12 @@ const MIN_STREAMING_KCPPVERSION = '1.30';
|
|||
function formatKoboldUrl(value) {
|
||||
try {
|
||||
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();
|
||||
}
|
||||
} catch { } // Try and Catch both fall through to the same return.
|
||||
|
|
|
@ -163,6 +163,7 @@ let power_user = {
|
|||
prefer_character_jailbreak: true,
|
||||
continue_on_send: false,
|
||||
trim_spaces: true,
|
||||
relaxed_api_urls: false,
|
||||
|
||||
instruct: {
|
||||
enabled: false,
|
||||
|
@ -671,6 +672,7 @@ function loadPowerUserSettings(settings, data) {
|
|||
power_user.chat_width = 50;
|
||||
}
|
||||
|
||||
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
|
||||
$('#trim_spaces').prop("checked", power_user.trim_spaces);
|
||||
$('#continue_on_send').prop("checked", power_user.continue_on_send);
|
||||
$('#auto_swipe').prop("checked", power_user.auto_swipe);
|
||||
|
@ -1979,6 +1981,12 @@ $(document).ready(() => {
|
|||
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 () {
|
||||
power_user.spoiler_free_mode = !!$(this).prop('checked');
|
||||
switchSpoilerMode();
|
||||
|
|
Loading…
Reference in New Issue