mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
updated AutoConnect to work with NAI and OobaWebUI
This commit is contained in:
@@ -196,12 +196,18 @@ function RA_checkOnlineStatus() {
|
||||
//Auto-connect to API (when set to kobold, API URL exists, and auto_connect is true)
|
||||
|
||||
function RA_autoconnect() {
|
||||
console.log(main_api);
|
||||
if (typeof online_status !== 'undefined' && (api_server !== '' || api_key_novel !== '')) {
|
||||
if (online_status === "no_connection" && LoadLocalBool('AutoConnectEnabled')) {
|
||||
if (isUrlOrAPIKey(api_server) && main_api === "kobold") {
|
||||
$("#api_url_text").val(api_server);
|
||||
$("#api_button").click();
|
||||
}
|
||||
if (main_api === "novel") {
|
||||
$("#api_button_novel").click();
|
||||
}
|
||||
if (isUrlOrAPIKey(api_server) && main_api === "textgenerationwebui") {
|
||||
$("#api_button_textgenerationwebui").click();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTimeout(RA_autoconnect, 100);
|
||||
@@ -209,7 +215,6 @@ function RA_autoconnect() {
|
||||
}
|
||||
|
||||
function isUrlOrAPIKey(string) {
|
||||
//const pattern = /^\d{3}-\d{3}-\d{3}-\d{3}$/; //need a sample novelAI key to set this format
|
||||
try {
|
||||
new URL(string);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user