diff --git a/public/index.html b/public/index.html index 207310882..12e892856 100644 --- a/public/index.html +++ b/public/index.html @@ -1866,6 +1866,8 @@ +
diff --git a/public/script.js b/public/script.js index 416a41a50..cfe0dcdba 100644 --- a/public/script.js +++ b/public/script.js @@ -6440,9 +6440,27 @@ $(document).ready(function () { name1 = $("#your_name").val(); if (name1 === undefined || name1 == "") name1 = default_user_name; console.log(name1); + toastr.success(`Your messages will now be sent as ${name1}`, 'User Name updated'); saveSettings("change_name"); } }); + + $('#sync_name_button').on('click', async function () { + const confirmation = await callPopup(`

Are you sure?

All user-sent messages in this chat will be attributed to ${name1}.`, 'confirm'); + + if (!confirmation) { + return; + } + + for (const mes of chat) { + if (mes.is_user) { + mes.name = name1; + } + } + + await saveChatConditional(); + await reloadCurrentChat(); + }); //Select chat $("#api_button_novel").on('click', async function (e) {