diff --git a/aiserver.py b/aiserver.py index 4805515c..47932121 100644 --- a/aiserver.py +++ b/aiserver.py @@ -10189,16 +10189,17 @@ def UI_2_action_image(): def send_one_time_messages(data, wait_time=0): time.sleep(wait_time) #Need to wait a bit for the web page to load as the connect event is very eary messages = { - 1: {"id": 1, "title": "Warning New Save Format", "message": "This version of KoboldAI includes a new save game format which is incompatable with older versions of KoboldAI. Your old saves will not be modified and can be loaded on older versions but if you save and new actions taken will not be visible on older versions"}, + 1: {"id": 1, "title": "Warning New Save Format", "message": "This version of KoboldAI introduces a new save format which is incompatible with older versions of KoboldAI, this means your saves will not be able to load on the old version if they are saved with this version. For existing stories we will leave a copy of the original save intact if you wish to switch back to the older version, when you load your save in the old version of KoboldAI you will not see any of the changes saved with this version."}, } if data != '': - koboldai_vars.seen_messages.append(int(data)) - #Now let's save - filename = "settings/system_settings.v2_settings" - if not os.path.exists("settings"): - os.mkdir("settings") - with open(filename, "w") as settings_file: - settings_file.write(getattr(koboldai_vars, "_system_settings").to_json()) + if int(data) not in koboldai_vars.seen_messages: + koboldai_vars.seen_messages.append(int(data)) + #Now let's save + filename = "settings/system_settings.v2_settings" + if not os.path.exists("settings"): + os.mkdir("settings") + with open(filename, "w") as settings_file: + settings_file.write(getattr(koboldai_vars, "_system_settings").to_json()) for message in messages: if message not in koboldai_vars.seen_messages: socketio.emit("message", messages[message]) diff --git a/static/application.js b/static/application.js index 4550d1c5..f2ebb075 100644 --- a/static/application.js +++ b/static/application.js @@ -2321,6 +2321,7 @@ $(document).ready(function(){ // Connect to SocketIO server socket = io.connect(window.document.origin, {transports: ['polling', 'websocket'], closeOnBeforeunload: false, query:{"ui": "1"}}); + socket.on("message", function(data){show_message(data);}); //console.log(socket); socket.on('load_popup', function(data){load_popup(data);}); socket.on('popup_items', function(data){popup_items(data);}); @@ -3806,3 +3807,22 @@ function getSelectedOptions(element) { } return output; } + + +function show_message(data) { + const message_box_data = document.getElementById('message-popup').querySelector("#popup_list_area"); + const message_box_title = document.getElementById('message-popup').querySelector("#popup_title"); + const message_box_ok = document.getElementById('message-popup').querySelector("#ok"); + //clear out the error box + while (message_box_data.firstChild) { + message_box_data.removeChild(message_box_data.firstChild); + } + div = document.createElement('div'); + div.innerHTML = data['message']; + div.classList.add('console_text'); + message_box_data.append(div); + message_box_title.innerText = data['title']; + message_box_ok.setAttribute("message_id", data['id']) + + document.getElementById('message-popup').classList.remove('hidden'); +} diff --git a/templates/index.html b/templates/index.html index fda471e3..d1995373 100644 --- a/templates/index.html +++ b/templates/index.html @@ -496,5 +496,22 @@ + + +
+ +