mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Don't modify legacy URL path for inappropriate API types
This commit is contained in:
@ -326,11 +326,13 @@ async function selectPreset(name) {
|
|||||||
function formatTextGenURL(value) {
|
function formatTextGenURL(value) {
|
||||||
try {
|
try {
|
||||||
const noFormatTypes = [MANCER, TOGETHERAI, INFERMATICAI, DREAMGEN, OPENROUTER];
|
const noFormatTypes = [MANCER, TOGETHERAI, INFERMATICAI, DREAMGEN, OPENROUTER];
|
||||||
|
const legacyApiTypes = [OOBA, APHRODITE];
|
||||||
if (noFormatTypes.includes(settings.type)) {
|
if (noFormatTypes.includes(settings.type)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = new URL(value);
|
const url = new URL(value);
|
||||||
|
if (legacyApiTypes.includes(settings.type)) {
|
||||||
if (url.pathname === '/api' && !settings.legacy_api) {
|
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 });
|
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 = '';
|
url.pathname = '';
|
||||||
@ -339,6 +341,7 @@ function formatTextGenURL(value) {
|
|||||||
if (!power_user.relaxed_api_urls && settings.legacy_api) {
|
if (!power_user.relaxed_api_urls && settings.legacy_api) {
|
||||||
url.pathname = '/api';
|
url.pathname = '/api';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return url.toString();
|
return url.toString();
|
||||||
} catch {
|
} catch {
|
||||||
// Just using URL as a validation check
|
// Just using URL as a validation check
|
||||||
|
Reference in New Issue
Block a user