From 8ff4a4a36aad8cdd4da244582b68fb24493ded09 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:01:38 +0300 Subject: [PATCH] Don't modify legacy URL path for inappropriate API types --- public/scripts/textgen-settings.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index ce07273a8..50f0c3d4d 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -326,18 +326,21 @@ async function selectPreset(name) { function formatTextGenURL(value) { try { const noFormatTypes = [MANCER, TOGETHERAI, INFERMATICAI, DREAMGEN, OPENROUTER]; + const legacyApiTypes = [OOBA, APHRODITE]; if (noFormatTypes.includes(settings.type)) { return value; } const url = new URL(value); - if (url.pathname === '/api' && !settings.legacy_api) { - toastr.info('Enable Legacy API or start Ooba with the OpenAI extension enabled.', 'Legacy API URL detected. Generation may fail.', { preventDuplicates: true, timeOut: 10000, extendedTimeOut: 20000 }); - url.pathname = ''; - } + if (legacyApiTypes.includes(settings.type)) { + if (url.pathname === '/api' && !settings.legacy_api) { + toastr.info('Enable Legacy API or start Ooba with the OpenAI extension enabled.', 'Legacy API URL detected. Generation may fail.', { preventDuplicates: true, timeOut: 10000, extendedTimeOut: 20000 }); + url.pathname = ''; + } - if (!power_user.relaxed_api_urls && settings.legacy_api) { - url.pathname = '/api'; + if (!power_user.relaxed_api_urls && settings.legacy_api) { + url.pathname = '/api'; + } } return url.toString(); } catch {