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

This commit is contained in:
Cohee 2024-09-04 21:53:25 +03:00
commit 26635f9f10
6 changed files with 36 additions and 17 deletions

View File

@ -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.');
}

View File

@ -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 {

View File

@ -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);
}

View File

@ -1,3 +1,3 @@
<strong data-i18n="Connect to an API and ask me anything!">
Connect to an API and ask me anything!
<strong data-i18n="If you're connected to an API, try asking me something!">
If you're connected to an API, try asking me something!
</strong>

View File

@ -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

View File

@ -5460,4 +5460,5 @@ body:not(.movingUI) .drawer-content.maximized {
max-height: 50dvh;
resize: vertical;
overflow: auto;
min-height: 1.8em;
}