updated AutoConnect to work with NAI and OobaWebUI

This commit is contained in:
RossAsscends
2023-03-21 18:29:38 +09:00
parent 4ddeeab3cc
commit 5f32055a64
2 changed files with 8 additions and 2 deletions

View File

@@ -196,12 +196,18 @@ function RA_checkOnlineStatus() {
//Auto-connect to API (when set to kobold, API URL exists, and auto_connect is true) //Auto-connect to API (when set to kobold, API URL exists, and auto_connect is true)
function RA_autoconnect() { function RA_autoconnect() {
console.log(main_api);
if (typeof online_status !== 'undefined' && (api_server !== '' || api_key_novel !== '')) { if (typeof online_status !== 'undefined' && (api_server !== '' || api_key_novel !== '')) {
if (online_status === "no_connection" && LoadLocalBool('AutoConnectEnabled')) { if (online_status === "no_connection" && LoadLocalBool('AutoConnectEnabled')) {
if (isUrlOrAPIKey(api_server) && main_api === "kobold") { if (isUrlOrAPIKey(api_server) && main_api === "kobold") {
$("#api_url_text").val(api_server);
$("#api_button").click(); $("#api_button").click();
} }
if (main_api === "novel") {
$("#api_button_novel").click();
}
if (isUrlOrAPIKey(api_server) && main_api === "textgenerationwebui") {
$("#api_button_textgenerationwebui").click();
}
} }
} else { } else {
setTimeout(RA_autoconnect, 100); setTimeout(RA_autoconnect, 100);
@@ -209,7 +215,6 @@ function RA_autoconnect() {
} }
function isUrlOrAPIKey(string) { function isUrlOrAPIKey(string) {
//const pattern = /^\d{3}-\d{3}-\d{3}-\d{3}$/; //need a sample novelAI key to set this format
try { try {
new URL(string); new URL(string);
return true; return true;

View File

@@ -224,6 +224,7 @@ margin-top:5px;
white-space: nowrap; white-space: nowrap;
width: 100%; width: 100%;
margin: 1px auto 10px auto; margin: 1px auto 10px auto;
z-index: 3;
} }
#send_form { #send_form {