Don't modify legacy URL path for inappropriate API types

8ff4a4a36aad8cdd4da244582b68fb24493ded09

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -0Showing whitespace changes
public/scripts/textgen-settings.js+3 -0
@@ -326,11 +326,13 @@ async function selectPreset(name) {
326326function formatTextGenURL(value) {
327327 try {
328328 const noFormatTypes = [MANCER, TOGETHERAI, INFERMATICAI, DREAMGEN, OPENROUTER];
329+ const legacyApiTypes = [OOBA, APHRODITE];
329330 if (noFormatTypes.includes(settings.type)) {
330331 return value;
331332 }
332333
333334 const url = new URL(value);
335+ if (legacyApiTypes.includes(settings.type)) {
334336 if (url.pathname === '/api' && !settings.legacy_api) {
335337 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 });
336338 url.pathname = '';
@@ -339,6 +341,7 @@ function formatTextGenURL(value) {
339341 if (!power_user.relaxed_api_urls && settings.legacy_api) {
340342 url.pathname = '/api';
341343 }
344+ }
342345 return url.toString();
343346 } catch {
344347 // Just using URL as a validation check