mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Decrease connection timeout, set 'valid' status on 'invalid URL', don't wait if not needed
Fixes #3683
This commit is contained in:
@ -9288,10 +9288,12 @@ async function connectAPISlash(args, text) {
|
||||
const toast = quiet ? jQuery() : toastr.info(t`API set to ${text}, trying to connect..`);
|
||||
|
||||
try {
|
||||
await waitUntilCondition(() => online_status !== 'no_connection', 10000, 100);
|
||||
if (connectionRequired) {
|
||||
await waitUntilCondition(() => online_status !== 'no_connection', 5000, 500);
|
||||
}
|
||||
console.log('Connection successful');
|
||||
} catch {
|
||||
console.log('Could not connect after 10 seconds, skipping.');
|
||||
console.log('Could not connect after 5 seconds, skipping.');
|
||||
}
|
||||
|
||||
toastr.clear(toast);
|
||||
|
@ -3493,7 +3493,7 @@ async function getStatusOpen() {
|
||||
|
||||
if (oai_settings.chat_completion_source === chat_completion_sources.CUSTOM && !isValidUrl(oai_settings.custom_url)) {
|
||||
console.debug('Invalid endpoint URL of Custom OpenAI API:', oai_settings.custom_url);
|
||||
setOnlineStatus('no_connection');
|
||||
setOnlineStatus(t`Invalid endpoint URL. Requests may fail.`);
|
||||
return resultCheckStatus();
|
||||
}
|
||||
|
||||
@ -4757,11 +4757,6 @@ async function onConnectButtonClick(e) {
|
||||
if (api_key_custom.length) {
|
||||
await writeSecret(SECRET_KEYS.CUSTOM, api_key_custom);
|
||||
}
|
||||
|
||||
if (!oai_settings.custom_url) {
|
||||
console.log('No API URL saved for Custom');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.COHERE) {
|
||||
|
Reference in New Issue
Block a user