Merge branch 'staging' into fix-swipes-with-floating-prompts

26635f9f10207f2300b8381294ccd9c2acc61a6d

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

6 files changed, +36 -17Ignore whitespace
public/script.js+31 -9
@@ -2818,21 +2818,22 @@ export function baseChatReplace(value, name1, name2) {
2818 */2818 */
2819export function getCharacterCardFields() {2819export function getCharacterCardFields() {
2820 const result = { system: '', mesExamples: '', description: '', personality: '', persona: '', scenario: '', jailbreak: '', version: '' };2820 const result = { system: '', mesExamples: '', description: '', personality: '', persona: '', scenario: '', jailbreak: '', version: '' };
2821 result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);
2822
2821 const character = characters[this_chid];2823 const character = characters[this_chid];
28222824
2823 if (!character) {2825 if (!character) {
2824 return result;2826 return result;
2825 }2827 }
28262828
2827 const scenarioText = chat_metadata['scenario'] || characters[this_chid]?.scenario;2829 const scenarioText = chat_metadata['scenario'] || character.scenario || '';
2828 result.description = baseChatReplace(characters[this_chid].description?.trim(), name1, name2);2830 result.description = baseChatReplace(character.description?.trim(), name1, name2);
2829 result.personality = baseChatReplace(characters[this_chid].personality?.trim(), name1, name2);2831 result.personality = baseChatReplace(character.personality?.trim(), name1, name2);
2830 result.scenario = baseChatReplace(scenarioText.trim(), name1, name2);2832 result.scenario = baseChatReplace(scenarioText.trim(), name1, name2);
2831 result.mesExamples = baseChatReplace(characters[this_chid].mes_example?.trim(), name1, name2);2833 result.mesExamples = baseChatReplace(character.mes_example?.trim(), name1, name2);
2832 result.persona = baseChatReplace(power_user.persona_description?.trim(), name1, name2);2834 result.system = power_user.prefer_character_prompt ? baseChatReplace(character.data?.system_prompt?.trim(), name1, name2) : '';
2833 result.system = power_user.prefer_character_prompt ? baseChatReplace(characters[this_chid].data?.system_prompt?.trim(), name1, name2) : '';2835 result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(character.data?.post_history_instructions?.trim(), name1, name2) : '';
2834 result.jailbreak = power_user.prefer_character_jailbreak ? baseChatReplace(characters[this_chid].data?.post_history_instructions?.trim(), name1, name2) : '';2836 result.version = character.data?.character_version ?? '';
2835 result.version = characters[this_chid].data?.character_version ?? '';
28362837
2837 if (selected_group) {2838 if (selected_group) {
2838 const groupCards = getGroupCharacterCards(selected_group, Number(this_chid));2839 const groupCards = getGroupCharacterCards(selected_group, Number(this_chid));
@@ -9180,6 +9181,27 @@ jQuery(async function () {
9180 helpString: 'Closes the current chat.',9181 helpString: 'Closes the current chat.',
9181 }));9182 }));
9182 SlashCommandParser.addCommandObject(SlashCommand.fromProps({9183 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
9184 name: 'tempchat',
9185 callback: () => {
9186 return new Promise((resolve, reject) => {
9187 const eventCallback = async (chatId) => {
9188 if (chatId) {
9189 return reject('Not in a temporary chat');
9190 }
9191 await newAssistantChat();
9192 return resolve('');
9193 };
9194 eventSource.once(event_types.CHAT_CHANGED, eventCallback);
9195 doCloseChat();
9196 setTimeout(() => {
9197 reject('Failed to open temporary chat');
9198 eventSource.removeListener(event_types.CHAT_CHANGED, eventCallback);
9199 }, debounce_timeout.relaxed);
9200 });
9201 },
9202 helpString: 'Opens a temporary chat with Assistant.',
9203 }));
9204 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
9183 name: 'panels',9205 name: 'panels',
9184 callback: doTogglePanels,9206 callback: doTogglePanels,
9185 aliases: ['togglepanels'],9207 aliases: ['togglepanels'],
@@ -9888,8 +9910,8 @@ jQuery(async function () {
9888 select_rm_characters();9910 select_rm_characters();
9889 sendSystemMessage(system_message_types.WELCOME);9911 sendSystemMessage(system_message_types.WELCOME);
9890 sendSystemMessage(system_message_types.WELCOME_PROMPT);9912 sendSystemMessage(system_message_types.WELCOME_PROMPT);
9891 eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
9892 await getClientVersion();9913 await getClientVersion();
9914 await eventSource.emit(event_types.CHAT_CHANGED, getCurrentChatId());
9893 } else {9915 } else {
9894 toastr.info('Please stop the message generation first.');9916 toastr.info('Please stop the message generation first.');
9895 }9917 }
public/scripts/extensions/stable-diffusion/index.js+1 -1
@@ -3752,7 +3752,7 @@ async function onImageSwiped({ message, element, direction }) {
3752 const generationType = message?.extra?.generationType ?? generationMode.FREE;3752 const generationType = message?.extra?.generationType ?? generationMode.FREE;
3753 const dimensions = setTypeSpecificDimensions(generationType);3753 const dimensions = setTypeSpecificDimensions(generationType);
3754 const originalSeed = extension_settings.sd.seed;3754 const originalSeed = extension_settings.sd.seed;
3755 extension_settings.sd.seed = Math.round(Math.random() * Number.MAX_SAFE_INTEGER);3755 extension_settings.sd.seed = Math.round(Math.random() * (Math.pow(2, 32) - 1));
3756 let imagePath = '';3756 let imagePath = '';
37573757
3758 try {3758 try {
public/scripts/instruct-mode.js+0 -4
@@ -611,15 +611,11 @@ jQuery(() => {
611 if (state) {611 if (state) {
612 $('#instruct_system_sequence_block').addClass('disabled');612 $('#instruct_system_sequence_block').addClass('disabled');
613 $('#instruct_system_suffix_block').addClass('disabled');613 $('#instruct_system_suffix_block').addClass('disabled');
614 $('#instruct_system_sequence').css('height', 'auto');
615 $('#instruct_system_suffix').css('height', 'auto');
616 $('#instruct_system_sequence').prop('contenteditable', false);614 $('#instruct_system_sequence').prop('contenteditable', false);
617 $('#instruct_system_suffix').prop('contenteditable', false);615 $('#instruct_system_suffix').prop('contenteditable', false);
618 } else {616 } else {
619 $('#instruct_system_sequence_block').removeClass('disabled');617 $('#instruct_system_sequence_block').removeClass('disabled');
620 $('#instruct_system_suffix_block').removeClass('disabled');618 $('#instruct_system_suffix_block').removeClass('disabled');
621 $('#instruct_system_sequence').css('height', '');
622 $('#instruct_system_suffix').css('height', '');
623 $('#instruct_system_sequence').prop('contenteditable', true);619 $('#instruct_system_sequence').prop('contenteditable', true);
624 $('#instruct_system_suffix').prop('contenteditable', true);620 $('#instruct_system_suffix').prop('contenteditable', true);
625 }621 }
public/scripts/templates/welcomePrompt.html+2 -2
@@ -1,3 +1,3 @@
1<strong data-i18n="Connect to an API and ask me anything!">1<strong data-i18n="If you're connected to an API, try asking me something!">
2 Connect to an API and ask me anything!2 If you're connected to an API, try asking me something!
3</strong>3</strong>
public/scripts/world-info.js+1 -1
@@ -2334,7 +2334,7 @@ async function getWorldEntry(name, data, entry) {
2334 input.on('select2:unselect', /** @type {function(*):void} */ event => updateWorldEntryKeyOptionsCache([event.params.data], { remove: true }));2334 input.on('select2:unselect', /** @type {function(*):void} */ event => updateWorldEntryKeyOptionsCache([event.params.data], { remove: true }));
23352335
2336 select2ChoiceClickSubscribe(input, target => {2336 select2ChoiceClickSubscribe(input, target => {
2337 const key = $(target).text();2337 const key = $(target.closest('.regex-highlight')).text();
2338 console.debug('Editing WI key', key);2338 console.debug('Editing WI key', key);
23392339
2340 // Remove the current key from the actual selection2340 // Remove the current key from the actual selection
public/style.css+1 -0
@@ -5460,4 +5460,5 @@ body:not(.movingUI) .drawer-content.maximized {
5460 max-height: 50dvh;5460 max-height: 50dvh;
5461 resize: vertical;5461 resize: vertical;
5462 overflow: auto;5462 overflow: auto;
5463 min-height: 1.8em;
5463}5464}