Copy 'relaxed api url' functionality over to webui

This commit is contained in:
50h100a 2023-08-07 16:46:32 -04:00
parent 75bb0d641f
commit 128945aaaa
1 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,10 @@ import {
setGenerationParamsFromPreset,
} from "../script.js";
import {
power_user,
} from "./power-user.js";
export {
textgenerationwebui_settings,
loadTextGenSettings,
@ -98,9 +102,10 @@ function selectPreset(name) {
function formatTextGenURL(value) {
try {
const url = new URL(value);
if (url.pathname.endsWith('/api')) {
return url.toString();
if (!power_user.relaxed_api_urls) {
url.pathname = '/api';
}
return url.toString();
} catch { } // Try and Catch both fall through to the same return.
return null;
}