- Adding display of queued speakers in group chat windows.
| @@ -112,5 +112,6 @@ | ||
| 112 | 112 | * @property {string} chat - name of the current chat file chat |
| 113 | 113 | * @property {string} avatar - file name of the avatar image (acts as a unique identifier) |
| 114 | 114 | * @property {string} json_data - the full raw JSON data of the character |
| 115 | + * @property {number} queueOrder - Characters position in the char queue. #1 is currently generating. | |
| 115 | 116 | */ |
| 116 | 117 | export default 0;// now this file is a module |
| @@ -70,6 +70,7 @@ import { | ||
| 70 | 70 | animation_duration, |
| 71 | 71 | depth_prompt_role_default, |
| 72 | 72 | shouldAutoContinue, |
| 73 | + this_chid, | |
| 73 | 74 | } from '../script.js'; |
| 74 | 75 | import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js'; |
| 75 | 76 | import { FILTER_TYPES, FilterHelper } from './filters.js'; |
| @@ -785,7 +786,8 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | ||
| 785 | 786 | sendSystemMessage(system_message_types.EMPTY, '', { isSmallSys: true }); |
| 786 | 787 | return Promise.resolve(); |
| 787 | 788 | } |
| 788 | - | |
| 789 | + | |
| 790 | + const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId); | |
| 789 | 791 | try { |
| 790 | 792 | throwIfAborted(); |
| 791 | 793 | hideSwipeButtons(); |
| @@ -857,7 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | ||
| 857 | 859 | await saveChatConditional(); |
| 858 | 860 | $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); |
| 859 | 861 | } |
| 860 | - | |
| 862 | + if (showChatQueue){ | |
| 863 | + for (let i = 0; i < activatedMembers.length; ++i){ | |
| 864 | + characters[activatedMembers[i]].queueOrder = (i+1); | |
| 865 | + } | |
| 866 | + } | |
| 861 | 867 | // now the real generation begins: cycle through every activated character |
| 862 | 868 | for (const chId of activatedMembers) { |
| 863 | 869 | throwIfAborted(); |
| @@ -865,6 +871,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | ||
| 865 | 871 | const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat'; |
| 866 | 872 | setCharacterId(chId); |
| 867 | 873 | setCharacterName(characters[chId].name); |
| 874 | + if (showChatQueue){ | |
| 875 | + printGroupMembers(); | |
| 876 | + } | |
| 868 | 877 | await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); |
| 869 | 878 | |
| 870 | 879 | if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) { |
| @@ -885,6 +894,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | ||
| 885 | 894 | messageChunk = textResult?.messageChunk; |
| 886 | 895 | } |
| 887 | 896 | } |
| 897 | + if (showChatQueue){ | |
| 898 | + activatedMembers.filter(chidx => characters[chidx].queueOrder > 0) | |
| 899 | + .forEach(chindex => characters[chindex].queueOrder -= 1); | |
| 900 | + } | |
| 888 | 901 | } |
| 889 | 902 | } finally { |
| 890 | 903 | typingIndicator.hide(); |
| @@ -892,6 +905,14 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | ||
| 892 | 905 | is_group_generating = false; |
| 893 | 906 | setSendButtonState(false); |
| 894 | 907 | setCharacterId(undefined); |
| 908 | + | |
| 909 | + if (showChatQueue){ | |
| 910 | + group.members.forEach(avatar => { | |
| 911 | + let character = characters.find(x => x.avatar === avatar || x.name === avatar); | |
| 912 | + character.queueOrder = undefined; | |
| 913 | + }); | |
| 914 | + printGroupMembers(); | |
| 915 | + } | |
| 895 | 916 | setCharacterName(''); |
| 896 | 917 | activateSendButtons(); |
| 897 | 918 | showSwipeButtons(); |
| @@ -1309,11 +1330,13 @@ function getGroupCharacterBlock(character) { | ||
| 1309 | 1330 | const isFav = character.fav || character.fav == 'true'; |
| 1310 | 1331 | template.data('id', character.avatar); |
| 1311 | 1332 | template.find('.avatar img').attr({ 'src': avatar, 'title': character.avatar }); |
| 1312 | - template.find('.ch_name').text(character.name); | |
| 1333 | + template.find('.ch_name').text(character.name + (character.queueOrder > 0?' (#' + character.queueOrder + ')':'')); template.attr('chid', characters.indexOf(character)); | |
| 1313 | - template.attr('chid', characters.indexOf(character)); | |
| 1314 | 1334 | template.find('.ch_fav').val(isFav); |
| 1315 | 1335 | template.toggleClass('is_fav', isFav); |
| 1336 | + template.toggleClass('is_active', character.queueOrder === 1); | |
| 1337 | + template.toggleClass('is_queued', character.queueOrder > 1); | |
| 1316 | 1338 | template.toggleClass('disabled', isGroupMemberDisabled(character.avatar)); |
| 1339 | + template.toggleClass('is_active', character.avatar === (this_chid && characters[this_chid] && characters[this_chid].avatar)); | |
| 1317 | 1340 | |
| 1318 | 1341 | // Display inline tags |
| 1319 | 1342 | const tagsElement = template.find('.tags'); |
| @@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button { | ||
| 2922 | 2922 | position: relative; |
| 2923 | 2923 | } |
| 2924 | 2924 | |
| 2925 | +.group_member.is_queued { | |
| 2926 | + border: 2px solid var(--golden); | |
| 2927 | +} | |
| 2928 | + | |
| 2929 | +.group_member.is_active { | |
| 2930 | + border: 2px solid var(--active); | |
| 2931 | +} | |
| 2932 | + | |
| 2925 | 2933 | .character_select.is_fav .avatar, |
| 2926 | 2934 | .group_select.is_fav .avatar, |
| 2927 | 2935 | .group_member.is_fav .avatar, |