diff --git a/public/index.html b/public/index.html index 61ce9e14d..1d37f0ed6 100644 --- a/public/index.html +++ b/public/index.html @@ -4141,6 +4141,10 @@ Request token probabilities +
Auto-swipe @@ -5796,6 +5800,7 @@
+
diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 5047c9dc4..7a5f4f24d 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -121,6 +121,7 @@ const DEFAULT_AUTO_MODE_DELAY = 5; export const groupCandidatesFilter = new FilterHelper(debounce(printGroupCandidates, debounce_timeout.quick)); let autoModeWorker = null; const saveGroupDebounced = debounce(async (group, reload) => await _save(group, reload), debounce_timeout.relaxed); +let groupChatQueueOrder = new Map(); function setAutoModeWorker() { clearInterval(autoModeWorker); @@ -787,7 +788,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { return Promise.resolve(); } - const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId); try { throwIfAborted(); hideSwipeButtons(); @@ -859,9 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { await saveChatConditional(); $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); } - if (showChatQueue){ + groupChatQueueOrder = new Map(); + + if (power_user.show_group_chat_queue){ for (let i = 0; i < activatedMembers.length; ++i){ - characters[activatedMembers[i]].queueOrder = (i+1); + groupChatQueueOrder.set(characters[activatedMembers[i]].avatar, i+1); } } // now the real generation begins: cycle through every activated character @@ -871,7 +873,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat'; setCharacterId(chId); setCharacterName(characters[chId].name); - if (showChatQueue){ + if (power_user.show_group_chat_queue){ printGroupMembers(); } await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); @@ -894,9 +896,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { messageChunk = textResult?.messageChunk; } } - if (showChatQueue){ - activatedMembers.filter(chidx => characters[chidx].queueOrder > 0) - .forEach(chindex => characters[chindex].queueOrder -= 1); + if (power_user.show_group_chat_queue){ + groupChatQueueOrder.delete(characters[chId].avatar); + groupChatQueueOrder.forEach((value, key, map) => map.set(key, value-1)); } } } finally { @@ -905,12 +907,8 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { is_group_generating = false; setSendButtonState(false); setCharacterId(undefined); - - if (showChatQueue){ - group.members.forEach(avatar => { - let character = characters.find(x => x.avatar === avatar || x.name === avatar); - character.queueOrder = undefined; - }); + if (power_user.show_group_chat_queue){ + groupChatQueueOrder = new Map(); printGroupMembers(); } setCharacterName(''); @@ -1333,10 +1331,15 @@ function getGroupCharacterBlock(character) { template.find('.ch_name').text(character.name + (character.queueOrder > 0?' (#' + character.queueOrder + ')':'')); template.attr('chid', characters.indexOf(character)); template.find('.ch_fav').val(isFav); template.toggleClass('is_fav', isFav); - template.toggleClass('is_active', character.queueOrder === 1); - template.toggleClass('is_queued', character.queueOrder > 1); + + let queuePosition = groupChatQueueOrder.get(character.avatar); + if (queuePosition){ + template.find('.queue_position').text(queuePosition); + template.toggleClass('is_queued', queuePosition > 1); + template.toggleClass('is_active', queuePosition === 1); + } + template.toggleClass('disabled', isGroupMemberDisabled(character.avatar)); - template.toggleClass('is_active', character.avatar === (this_chid && characters[this_chid] && characters[this_chid].avatar)); // Display inline tags const tagsElement = template.find('.tags'); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 32deaaf09..e484d2d99 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -179,6 +179,7 @@ let power_user = { send_on_enter: send_on_enter_options.AUTO, console_log_prompts: false, request_token_probabilities: false, + show_group_chat_queue: false, render_formulas: false, allow_name1_display: false, allow_name2_display: false, @@ -1601,6 +1602,7 @@ function loadPowerUserSettings(settings, data) { $('#console_log_prompts').prop('checked', power_user.console_log_prompts); $('#request_token_probabilities').prop('checked', power_user.request_token_probabilities); + $('#show_group_chat_queue').prop('checked', power_user.show_group_chat_queue); $('#auto_fix_generated_markdown').prop('checked', power_user.auto_fix_generated_markdown); $('#auto_scroll_chat_to_bottom').prop('checked', power_user.auto_scroll_chat_to_bottom); $('#bogus_folders').prop('checked', power_user.bogus_folders); @@ -3567,6 +3569,11 @@ $(document).ready(() => { saveSettingsDebounced(); }); + $('#show_group_chat_queue').on('input', function () { + power_user.show_group_chat_queue = !!$(this).prop('checked'); + saveSettingsDebounced(); + }); + $('#auto_scroll_chat_to_bottom').on('input', function () { power_user.auto_scroll_chat_to_bottom = !!$(this).prop('checked'); saveSettingsDebounced(); diff --git a/public/style.css b/public/style.css index 0a9a1eaf8..c079917da 100644 --- a/public/style.css +++ b/public/style.css @@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button { position: relative; } +.group_member .queue_position:not(:empty)::before { + content: "#"; +} + +.group_member .queue_position{ + margin-right: 1rem; +} + .group_member.is_queued { border: 2px solid var(--golden); }