diff --git a/public/script.js b/public/script.js index 908714892..d732f3c25 100644 --- a/public/script.js +++ b/public/script.js @@ -7824,6 +7824,12 @@ async function doDeleteChat() { $('#dialogue_popup_ok').trigger('click', { fromSlashCommand: true }); } +async function doGetChatName() { // `/getchatname` slash command + const group = selected_group ? groups.find(x => x.id === selected_group) : null; + const currentChat = selected_group ? group?.chat_id : characters[this_chid]['chat']; + return currentChat; +} + const isPwaMode = window.navigator.standalone; if (isPwaMode) { $('body').addClass('PWA'); } @@ -7975,6 +7981,7 @@ jQuery(async function () { registerSlashCommand('api', connectAPISlash, [], `(${Object.keys(CONNECT_API_MAP).join(', ')}) – connect to an API`, true, true); registerSlashCommand('impersonate', doImpersonate, ['imp'], '– calls an impersonation response', true, true); registerSlashCommand('delchat', doDeleteChat, [], '– deletes the current chat', true, true); + registerSlashCommand('getchatname', doGetChatName, [], '- gets the name of the current chat file', false, true); registerSlashCommand('closechat', doCloseChat, [], '– closes the current chat', true, true); registerSlashCommand('panels', doTogglePanels, ['togglepanels'], '– toggle UI panels on/off', true, true); registerSlashCommand('forcesave', doForceSave, [], '– forces a save of the current chat and settings', true, true);