diff --git a/public/img/send3.png b/public/img/send3.png index b3992109d..4f5bb69ce 100644 Binary files a/public/img/send3.png and b/public/img/send3.png differ diff --git a/public/index.html b/public/index.html index 39c451a48..1e6fdefcd 100644 --- a/public/index.html +++ b/public/index.html @@ -268,7 +268,7 @@ //console.log(online_status); if(online_status == 'no_connection'){ $("#send_textarea").attr('placeholder', "Not connected to API!"); //Input bar placeholder tells users they are not connected - $("#send_form").css("background-color", "rgba(255,0,0,0.3)"); //entire input form area is red when not connected + $("#send_form").css("background-color", "rgba(100,0,0,0.7)"); //entire input form area is red when not connected $("#send_but").css("display", "none"); //send button is hidden when not connected @@ -283,7 +283,7 @@ is_get_status_novel = false; }else{ $("#send_textarea").attr('placeholder', 'Type a message...'); //on connect, placeholder tells user to type message - $("#send_form").css("background-color", "rgba(0,0,0,0.3)"); //on connect, form BG changes to transprent black + $("#send_form").css("background-color", "rgba(0,0,0,0.7)"); //on connect, form BG changes to transprent black $("#send_but").css("display", "inline"); //on connect, send button shows up @@ -948,23 +948,25 @@ } if(online_status != 'no_connection' && this_chid != undefined){ - if(type != 'regenerate'){ + if(type !== 'regenerate'){ var textareaText = $("#send_textarea").val(); + //console.log('Not a Regenerate call, so posting normall with input of: ' +textareaText); $("#send_textarea").val('').trigger('input'); }else{ + //console.log('Regenerate call detected') var textareaText = ""; if(chat[chat.length-1]['is_user']){//If last message from You }else{ + //console.log('about to remove last msg') chat.length = chat.length-1; count_view_mes-=1; + //console.log('removing last msg') $('#chat').children().last().remove(); } } - //$("#send_textarea").attr("disabled","disabled"); - //$("#send_textarea").blur(); $( "#send_but" ).css("display", "none"); $( "#loading_mes" ).css("display", "inline-block"); @@ -1181,7 +1183,6 @@ //arrMes[arrMes.length-1] = '\n'+arrMes[arrMes.length-1]; let mesExmString = ''; for(let iii = 0; iii < mesExamplesArray.length; iii++){//mesExamplesArray It need to make from end to start - mesExmString = mesExmString+mesExamplesArray[iii]; if(encode(JSON.stringify(worldInfoString+storyString+mesExmString+chatString+anchorTop+anchorBottom+charPersonality+promptBias)).length+120 < this_max_context){ //example of dialogs if(!is_pygmalion){ @@ -1310,6 +1311,7 @@ mesSendString = '\nThen the roleplay chat between '+name1+' and '+name2+' begins.\n'+mesSendString; }else{ mesSendString = '\n'+mesSendString; + //mesSendString = mesSendString; } finalPromt = worldInfoBefore+storyString+worldInfoAfter+mesExmString+mesSendString+generatedPromtCache+promptBias; @@ -1623,24 +1625,37 @@ select_selected_character(this_chid); } - //hotkey to send input with shift+enter (normal enter keypress generates a new line in the chat input box) - //problem for mobile: default iOS keyboard function is to make AutoCapitalization happen on new lines. - //AutoCapitization effectively presses the virtual Shift key when it thinks a new line/sentence is happening. - //iOS result: First Enter press will make a new line, but the second will act like shift+enter, sending the prompt to AI. + //hotkey to send input with enter (shift+enter generates a new line in the chat input box) + //this is not ideal for touch device users with virtual keyboards. //ideally we would detect if the user is using a virtual keyboard, and disable this shortcut for them. - //because mobile users' hands are always near the screen, tapping the send button is better for them. - //caveat: people on an iPad using a Bluetooth keyboard will need to be treated as PC users for this purpose. + //because mobile users' hands are always near the screen, tapping the send button is better for them, and enter should always make a new line. //note: CAI seems to have this handled. PC: shift+enter = new line, enter = send. iOS: shift+enter AND enter both make new lines, and only the send button sends. //maybe a way to simulate this would be to disable the eventListener for people iOS. $("#send_textarea").keydown(function (e) { - if(e.which === 13 && !e.shiftKey && is_send_press == false) { + if(e.which === 13 && !e.shiftKey && !e.ctrlKey && is_send_press == false) { is_send_press = true; e.preventDefault(); Generate(); //$(this).closest("form").submit(); } }); + + //RossAscends: Lets add some hotkeys + document.addEventListener('keydown', (event) => { + //console.log(event.key); + if(event.ctrlKey && event.key == "Enter") { // Ctrl+Enter for Regeneration Last Response + //console.log('both CTRL and Enter were pressed'); + if(is_send_press == false){ + is_send_press = true; + Generate('regenerate'); + //console.log('confirmed keypress was caught '+ event.key); + } + }else if(event.ctrlKey && event.key == "ArrowUp") { //Ctrl+UpArrow for Connect to last server + document.getElementById('api_button').click(); + + } + }); //menu buttons var selected_button_style = { color: "#bcc1c8" }; @@ -2477,7 +2492,7 @@ switch(popup_type){ case 'char_not_selected': - $("#dialogue_popup_ok").css("background-color", "#191b31CC"); + $("#dialogue_popup_ok").text("Ok"); $("#dialogue_popup_cancel").css("display", "none"); break; @@ -2485,13 +2500,13 @@ case 'world_imported': case 'new_chat': - $("#dialogue_popup_ok").css("background-color", "#191b31CC"); + $("#dialogue_popup_ok").text("Yes"); break; case 'del_world': case 'del_group': default: - $("#dialogue_popup_ok").css("background-color", "#791b31"); + $("#dialogue_popup_ok").text("Delete"); } @@ -2799,24 +2814,45 @@ getSoftPromptsList(); } }); - - $( "body" ).click(function() { // this makes the input bar's option menu disappear when clicked away from + + + $(document).on('click', function(event) { // this makes the input bar's option menu disappear when clicked away from if($("#options").css('opacity') == 1.0){ - $('#options').transition({ - opacity: 0.0, - duration: 100,//animation_rm_duration, - easing: animation_rm_easing, - complete: function() { - $("#options").css('display', 'none'); - } - }); - } - }); - $( "#options_button" ).click(function() { + $('#options').transition({ + opacity: 0.0, + duration: 100,//animation_rm_duration, + easing: animation_rm_easing, + complete: function() { + $("#options").css('display', 'none'); + } + }) + + } + }); + + // RossAscends: Added functionality that will close the RightNav panels when User clicks outside them + + var NavToggle = document.getElementById("nav-toggle"); + var PanelPin = document.getElementById("rm_button_panel_pin"); + $('document').ready(function(){ + $("html").click(function(e){ + if (NavToggle.checked === true && PanelPin.checked === false) { + if ($(e.target).attr('id') !== "nav-toggle") { + if (document.querySelector('#right-nav-panel').contains(e.target) === false){ + document.getElementById('nav-toggle').click(); + } + } + }; + }); + }); + + //------------------------------------------------------------------------------------------------------------- + + $( "#options_button" ).click(function() { // this is the options button click function, shows the options menu if closed if($("#options").css('display') === 'none' && $("#options").css('opacity') == 0.0){ $("#options").css('display', 'block'); $('#options').transition({ - opacity: 1.0, + opacity: 1.0, // the manual setting of CSS via JS is what allows the click-away feature to work duration: 100, easing: animation_rm_easing, complete: function() { @@ -2856,55 +2892,14 @@ callPopup('

Start new chat?

'); } }); - //RossAscends: Lets add some hotkeys - document.addEventListener('keydown', (event) => { - if(event.ctrlKey && event.key == "Enter") { // Ctrl+Enter for Regeneration Last Response - if(is_send_press == false){ - is_send_press = true; - Generate('regenerate'); - } - }else if(event.ctrlKey && event.key == "ArrowUp") { //Ctrl+UpArrow for Connect to last server - document.getElementById('api_button').click(); - - } - }); - - //----------------------------------------------- - - // Now let's add functionality that will close the BG menu and/or RightNav panels when User clicks outside them - - // COULDN'T GET THIS TO WORK BUT CODE LEFT FOR FUTURE REFERENCE - - // general function to deetct which elements are being clicked on. - //$('body').on('click', function(e){ - // alert( 'Class is '+ $(e.target).attr('class') + '. ID is '+ $(e.target).attr('id')); - //}); - - //general function to watch the status of the nav-toggle checkbox - //var checkb = document.getElementById("nav-toggle"); - //checkb.addEventListener('change', function(e) { - // alert(checkb.checked, checkb.value); - - //}); - - //$('document').ready(function(){ - // $("body").click(function(e){ - // if (e.target.parentNode.classList.contains('.nav') == false){ - // alert('triggered!'); - // document.getElementById('nav-toggle').click(); - // }; - //}); - //}); - - //--------------------------------------------------- - + $( "#option_regenerate" ).click(function() { if(is_send_press == false){ is_send_press = true; Generate('regenerate'); } }); - // this function hides the input form, and shows the delete/cancel buttons fro deleting messages from chat + // this function hides the input form, and shows the delete/cancel buttons for deleting messages from chat $( "#option_delete_mes" ).click(function() { if(this_chid != undefined && !is_send_press || (selected_group && !is_group_generating)){ $('#dialogue_del_mes').css('display','block'); @@ -4382,7 +4377,7 @@

Scenario

Circumstances and context of the dialogue (?)
- +
@@ -4520,8 +4515,6 @@
- -
@@ -4562,16 +4555,11 @@
- -
- -
- - +
- + -