Add /tempchat command

17c60ca91689a7b89baea38c53870073080bc0ae

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +22 -1Ignore whitespace
public/script.js+22 -1
@@ -9180,6 +9180,27 @@ jQuery(async function () {
9180 helpString: 'Closes the current chat.',9180 helpString: 'Closes the current chat.',
9181 }));9181 }));
9182 SlashCommandParser.addCommandObject(SlashCommand.fromProps({9182 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
9183 name: 'tempchat',
9184 callback: async () => {
9185 return new Promise((resolve, reject) => {
9186 const eventCallback = async (chatId) => {
9187 if (chatId) {
9188 return reject('Not in a temporary chat');
9189 }
9190 await newAssistantChat();
9191 return resolve('');
9192 };
9193 eventSource.once(event_types.CHAT_CHANGED, eventCallback);
9194 doCloseChat();
9195 setTimeout(() => {
9196 reject('Failed to open temporary chat');
9197 eventSource.removeListener(event_types.CHAT_CHANGED, eventCallback);
9198 }, debounce_timeout.relaxed);
9199 });
9200 },
9201 helpString: 'Opens a temporary chat with Assistant.',
9202 }));
9203 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
9183 name: 'panels',9204 name: 'panels',
9184 callback: doTogglePanels,9205 callback: doTogglePanels,
9185 aliases: ['togglepanels'],9206 aliases: ['togglepanels'],
@@ -9888,8 +9909,8 @@ jQuery(async function () {
9888 select_rm_characters();9909 select_rm_characters();
9889 sendSystemMessage(system_message_types.WELCOME);9910 sendSystemMessage(system_message_types.WELCOME);
9890 sendSystemMessage(system_message_types.WELCOME_PROMPT);9911 sendSystemMessage(system_message_types.WELCOME_PROMPT);
9891 eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
9892 await getClientVersion();9912 await getClientVersion();
9913 await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
9893 } else {9914 } else {
9894 toastr.info('Please stop the message generation first.');9915 toastr.info('Please stop the message generation first.');
9895 }9916 }