make KAI url-fixing as flexible as webUI's

This commit is contained in:
50h100a
2023-08-03 16:28:02 -04:00
parent ea809023b5
commit 2d07cce1dd

View File

@ -35,13 +35,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);
url.pathname = '/api'; if (url.pathname.endsWith('/api')) {
return url.toString(); return url.toString();
} }
catch { } catch { } // Try and Catch both fall through to the same return.
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)) {