diff --git a/public/script.js b/public/script.js index 3dd51692f..0797d14da 100644 --- a/public/script.js +++ b/public/script.js @@ -2818,21 +2818,22 @@ export function baseChatReplace(value, name1, name2) { */ export function getCharacterCardFields() { const result = { system: '', mesExamples: '', description: '', personality: '', persona: '', scenario: '', jailbreak: '', version: '' }; + result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2); + const character = characters[this_chid]; if (!character) { return result; } - const scenarioText = chat_metadata['scenario'] || characters[this_chid]?.scenario; - result.description = baseChatReplace(characters[this_chid].description?.trim(), name1, name2); - result.personality = baseChatReplace(characters[this_chid].personality?.trim(), name1, name2); + const scenarioText = chat_metadata['scenario'] || character.scenario || ''; + result.description = baseChatReplace(character.description?.trim(), name1, name2); + result.personality = baseChatReplace(character.personality?.trim(), name1, name2); result.scenario = baseChatReplace(scenarioText.trim(), name1, name2); - result.mesExamples = baseChatReplace(characters[this_chid].mes_example?.trim(), name1, name2); - result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2); - result.system = power_user.prefer_character_prompt ? baseChatReplace(characters[this_chid].data?.system_prompt?.trim(), name1, name2) : ''; - result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(characters[this_chid].data?.post_history_instructions?.trim(), name1, name2) : ''; - result.version = characters[this_chid].data?.character_version ?? ''; + result.mesExamples = baseChatReplace(character.mes_example?.trim(), name1, name2); + result.system = power_user.prefer_character_prompt ? baseChatReplace(character.data?.system_prompt?.trim(), name1, name2) : ''; + result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : ''; + result.version = character.data?.character_version ?? ''; if (selected_group) { const groupCards = getGroupCharacterCards(selected_group, Number(this_chid)); @@ -9179,6 +9180,27 @@ jQuery(async function () { callback: doCloseChat, helpString: 'Closes the current chat.', })); + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ + name: 'tempchat', + callback: () => { + return new Promise((resolve, reject) => { + const eventCallback = async (chatId) => { + if (chatId) { + return reject('Not in a temporary chat'); + } + await newAssistantChat(); + return resolve(''); + }; + eventSource.once(event_types.CHAT_CHANGED, eventCallback); + doCloseChat(); + setTimeout(() => { + reject('Failed to open temporary chat'); + eventSource.removeListener(event_types.CHAT_CHANGED, eventCallback); + }, debounce_timeout.relaxed); + }); + }, + helpString: 'Opens a temporary chat with Assistant.', + })); SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'panels', callback: doTogglePanels, @@ -9888,8 +9910,8 @@ jQuery(async function () { select_rm_characters(); sendSystemMessage(system_message_types.WELCOME); sendSystemMessage(system_message_types.WELCOME_PROMPT); - eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId()); await getClientVersion(); + await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId()); } else { toastr.info('Please stop the message generation first.'); } diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index 0c16b4393..2f13329a2 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -3752,7 +3752,7 @@ async function onImageSwiped({ message, element, direction }) { const generationType = message?.extra?.generationType ?? generationMode.FREE; const dimensions = setTypeSpecificDimensions(generationType); const originalSeed = extension_settings.sd.seed; - extension_settings.sd.seed = Math.round(Math.random() * Number.MAX_SAFE_INTEGER); + extension_settings.sd.seed = Math.round(Math.random() * (Math.pow(2, 32) - 1)); let imagePath = ''; try { diff --git a/public/scripts/instruct-mode.js b/public/scripts/instruct-mode.js index c62a1bf34..a1bac800c 100644 --- a/public/scripts/instruct-mode.js +++ b/public/scripts/instruct-mode.js @@ -611,15 +611,11 @@ jQuery(() => { if (state) { $('#instruct_system_sequence_block').addClass('disabled'); $('#instruct_system_suffix_block').addClass('disabled'); - $('#instruct_system_sequence').css('height', 'auto'); - $('#instruct_system_suffix').css('height', 'auto'); $('#instruct_system_sequence').prop('contenteditable', false); $('#instruct_system_suffix').prop('contenteditable', false); } else { $('#instruct_system_sequence_block').removeClass('disabled'); $('#instruct_system_suffix_block').removeClass('disabled'); - $('#instruct_system_sequence').css('height', ''); - $('#instruct_system_suffix').css('height', ''); $('#instruct_system_sequence').prop('contenteditable', true); $('#instruct_system_suffix').prop('contenteditable', true); } diff --git a/public/scripts/templates/welcomePrompt.html b/public/scripts/templates/welcomePrompt.html index 9deb2d7cb..db9c96600 100644 --- a/public/scripts/templates/welcomePrompt.html +++ b/public/scripts/templates/welcomePrompt.html @@ -1,3 +1,3 @@ - - Connect to an API and ask me anything! + + If you're connected to an API, try asking me something! diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index abb559d64..8a4aab252 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -2334,7 +2334,7 @@ async function getWorldEntry(name, data, entry) { input.on('select2:unselect', /** @type {function(*):void} */ event => updateWorldEntryKeyOptionsCache([event.params.data], { remove: true })); select2ChoiceClickSubscribe(input, target => { - const key = $(target).text(); + const key = $(target.closest('.regex-highlight')).text(); console.debug('Editing WI key', key); // Remove the current key from the actual selection diff --git a/public/style.css b/public/style.css index 1ad069775..ca2ef3897 100644 --- a/public/style.css +++ b/public/style.css @@ -5460,4 +5460,5 @@ body:not(.movingUI) .drawer-content.maximized { max-height: 50dvh; resize: vertical; overflow: auto; + min-height: 1.8em; }