diff --git a/.gitignore b/.gitignore index 33b6f6f34..2e9bb7e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ -node_modules -.DS_Store -/public/chats -/public/characters -/public/User Avatars -/public/backgrounds -/uploads -/config.conf +node_modules/ +public/chats/ +public/characters/ +public/User Avatars/ +public/backgrounds/ +/uploads/ +*.jsonl +public/settings.json +config.conf +.DS_Store \ No newline at end of file diff --git a/config.conf b/config.conf index 38a6aeac0..25d278e14 100644 --- a/config.conf +++ b/config.conf @@ -1,8 +1,9 @@ + const port = 8000; const whitelist = ['127.0.0.1']; //Example for add several IP in whitelist: ['127.0.0.1', '192.168.0.10'] -const whitelistMode = true; //Disabling enabling the ip whitelist mode. true/false +const whitelistMode = false; //Disabling enabling the ip whitelist mode. true/false const autorun = true; //Autorun in the browser. true/false module.exports = { port, whitelist, whitelistMode, autorun -}; \ No newline at end of file +}; diff --git a/public/index.html b/public/index.html index 8eb1f5381..4d7d29f6f 100644 --- a/public/index.html +++ b/public/index.html @@ -240,6 +240,11 @@ function checkOnlineStatus(){ //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_but").css("display", "none"); //send button is hidden when not connected + + $("#online_status_indicator").css("background-color", "red"); $("#online_status").css("opacity", 0.3); $("#online_status_text").html("No connection..."); @@ -250,6 +255,11 @@ is_get_status = false; 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_but").css("display", "inline"); //on connect, send button shows up + + $("#online_status_indicator").css("background-color", "black"); $("#online_status").css("display", "none"); $("#online_status_text").html(""); @@ -1469,10 +1479,21 @@ printMessages(); select_selected_character(this_chid); } - $("#send_textarea").keypress(function (e) { - if(e.which === 13 && !e.shiftKey && is_send_press == false) { - is_send_press = true; - e.preventDefault(); + + //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. + //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. + //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) { + is_send_press = true; + e.preventDefault(); Generate(); //$(this).closest("form").submit(); } @@ -1680,16 +1701,16 @@ } }); - $(document).on('click', '.del_checkbox', function(){ //when a checkbox is clicked + $(document).on('click', '.del_checkbox', function(){ //when a 'delete message' checkbox is clicked $('.del_checkbox').each(function(){ $(this).prop( "checked", false ); $(this).parent().css('background', css_mes_bg); }); - $(this).parent().css('background', "#791b31"); //sets the bg of the selected msg to a muted red + $(this).parent().css('background', "#600"); //sets the bg of the mes selected for deletion var i = $(this).parent().attr('mesid'); //checks the message ID in the chat this_del_mes = i; while(i < chat.length){ //as long as the current message ID is less than the total chat length - $(".mes[mesid='"+i+"']").css('background', "#791b31"); //sets the bg of the all msgs BELOW the selected msg to a muted red as well + $(".mes[mesid='"+i+"']").css('background', "#600"); //sets the bg of the all msgs BELOW the selected .mes $(".mes[mesid='"+i+"']").children('.del_checkbox').prop( "checked", true ); i++; //console.log(i); @@ -4165,7 +4186,7 @@
-

+
@@ -4182,7 +4203,7 @@
- +