add /getchatname slash command to get name of current chat file

Example:

/getchatname | /echo {{pipe}}
This commit is contained in:
Juha Jeronen 2024-02-07 22:51:41 +02:00
parent 58c3d3eb7f
commit 5d1f3b13ea
1 changed files with 7 additions and 0 deletions

View File

@ -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, [], `<span class="monospace">(${Object.keys(CONNECT_API_MAP).join(', ')})</span> 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);