mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #872 from 50h100a/kai-fmt
This commit is contained in:
@ -2545,6 +2545,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,13 +39,13 @@ 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 (!power_user.relaxed_api_urls) {
|
||||||
url.pathname = '/api';
|
url.pathname = '/api';
|
||||||
|
}
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
} catch { } // Just using URL as a validation check
|
||||||
catch {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function loadKoboldSettings(preset) {
|
function loadKoboldSettings(preset) {
|
||||||
for (const name of Object.keys(kai_settings)) {
|
for (const name of Object.keys(kai_settings)) {
|
||||||
|
@ -164,6 +164,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,
|
||||||
@ -673,6 +674,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);
|
||||||
@ -1982,6 +1984,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();
|
||||||
|
@ -6,6 +6,10 @@ import {
|
|||||||
setGenerationParamsFromPreset,
|
setGenerationParamsFromPreset,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
power_user,
|
||||||
|
} from "./power-user.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
textgenerationwebui_settings,
|
textgenerationwebui_settings,
|
||||||
loadTextGenSettings,
|
loadTextGenSettings,
|
||||||
@ -98,10 +102,11 @@ function selectPreset(name) {
|
|||||||
function formatTextGenURL(value) {
|
function formatTextGenURL(value) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(value);
|
const url = new URL(value);
|
||||||
if (url.pathname.endsWith('/api')) {
|
if (!power_user.relaxed_api_urls) {
|
||||||
return url.toString();
|
url.pathname = '/api';
|
||||||
}
|
}
|
||||||
} catch { } // Try and Catch both fall through to the same return.
|
return url.toString();
|
||||||
|
} catch { } // Just using URL as a validation check
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user