Merge branch 'dev-settings-on-top' into dev

This commit is contained in:
SillyLossy
2023-03-21 13:01:17 +02:00
3 changed files with 30 additions and 3 deletions

View File

@ -117,6 +117,18 @@
</div>
</div>
<div id="novel_api" style="display: none;position: relative;"> <!-- shows the novel settings -->
<form action="javascript:void(null);" method="post" enctype="multipart/form-data">
<h4>API key</h4>
<h5>Where to get (<a href="/notes/6" target="_blank">?</a>)</h5>
<input id="api_key_novel" name="api_key_novel" class="text_pole" maxlength="500" size="35" value="" autocomplete="off">
<input id="api_button_novel" type="submit" value="Connect">
<img id="api_loading_novel" src="img/load.svg">
</form>
<div id="online_status3">
<div id="online_status_indicator3"></div>
<div id="online_status_text3">No connection...</div>
</div>
<h4>Novel AI Model
<a href="/notes/8" class="notes-link" target="_blank">
<span class="note-link-span">?</span>

View File

@ -201,12 +201,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);
@ -214,7 +220,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;
@ -312,8 +317,17 @@ $("document").ready(function () {
}
if (event.ctrlKey && event.key == "ArrowUp") {
//Ctrl+UpArrow for Connect to last server
console.log(main_api);
if (online_status === "no_connection") {
document.getElementById("api_button").click();
if (main_api == "kobold") {
document.getElementById("api_button").click();
}
if (main_api == "novel") {
document.getElementById("api_button_novel").click();
}
if (main_api == "textgenerationwebui") {
document.getElementById("api_button_textgenerationwebui").click();
}
}
}
if (event.ctrlKey && event.key == "ArrowLeft") { //for debug, show all local stored vars

View File

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