- Adding display of queued speakers in group chat windows.
| @@ -112,5 +112,6 @@ | |||
| 112 | * @property {string} chat - name of the current chat file chat | 112 | * @property {string} chat - name of the current chat file chat |
| 113 | * @property {string} avatar - file name of the avatar image (acts as a unique identifier) | 113 | * @property {string} avatar - file name of the avatar image (acts as a unique identifier) |
| 114 | * @property {string} json_data - the full raw JSON data of the character | 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 | export default 0;// now this file is a module | 117 | export default 0;// now this file is a module |
| @@ -70,6 +70,7 @@ import { | |||
| 70 | animation_duration, | 70 | animation_duration, |
| 71 | depth_prompt_role_default, | 71 | depth_prompt_role_default, |
| 72 | shouldAutoContinue, | 72 | shouldAutoContinue, |
| 73 | this_chid, | ||
| 73 | } from '../script.js'; | 74 | } from '../script.js'; |
| 74 | import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js'; | 75 | import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js'; |
| 75 | import { FILTER_TYPES, FilterHelper } from './filters.js'; | 76 | import { FILTER_TYPES, FilterHelper } from './filters.js'; |
| @@ -786,6 +787,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | |||
| 786 | return Promise.resolve(); | 787 | return Promise.resolve(); |
| 787 | } | 788 | } |
| 788 | 789 | ||
| 790 | const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId); | ||
| 789 | try { | 791 | try { |
| 790 | throwIfAborted(); | 792 | throwIfAborted(); |
| 791 | hideSwipeButtons(); | 793 | hideSwipeButtons(); |
| @@ -857,7 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | |||
| 857 | await saveChatConditional(); | 859 | await saveChatConditional(); |
| 858 | $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); | 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 | // now the real generation begins: cycle through every activated character | 867 | // now the real generation begins: cycle through every activated character |
| 862 | for (const chId of activatedMembers) { | 868 | for (const chId of activatedMembers) { |
| 863 | throwIfAborted(); | 869 | throwIfAborted(); |
| @@ -865,6 +871,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | |||
| 865 | const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat'; | 871 | const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat'; |
| 866 | setCharacterId(chId); | 872 | setCharacterId(chId); |
| 867 | setCharacterName(characters[chId].name); | 873 | setCharacterName(characters[chId].name); |
| 874 | if (showChatQueue){ | ||
| 875 | printGroupMembers(); | ||
| 876 | } | ||
| 868 | await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); | 877 | await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); |
| 869 | 878 | ||
| 870 | if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) { | 879 | if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) { |
| @@ -885,6 +894,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | |||
| 885 | messageChunk = textResult?.messageChunk; | 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 | } finally { | 902 | } finally { |
| 890 | typingIndicator.hide(); | 903 | typingIndicator.hide(); |
| @@ -892,6 +905,14 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { | |||
| 892 | is_group_generating = false; | 905 | is_group_generating = false; |
| 893 | setSendButtonState(false); | 906 | setSendButtonState(false); |
| 894 | setCharacterId(undefined); | 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 | setCharacterName(''); | 916 | setCharacterName(''); |
| 896 | activateSendButtons(); | 917 | activateSendButtons(); |
| 897 | showSwipeButtons(); | 918 | showSwipeButtons(); |
| @@ -1309,11 +1330,13 @@ function getGroupCharacterBlock(character) { | |||
| 1309 | const isFav = character.fav || character.fav == 'true'; | 1330 | const isFav = character.fav || character.fav == 'true'; |
| 1310 | template.data('id', character.avatar); | 1331 | template.data('id', character.avatar); |
| 1311 | template.find('.avatar img').attr({ 'src': avatar, 'title': character.avatar }); | 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 | template.find('.ch_fav').val(isFav); | 1334 | template.find('.ch_fav').val(isFav); |
| 1315 | template.toggleClass('is_fav', isFav); | 1335 | template.toggleClass('is_fav', isFav); |
| 1336 | template.toggleClass('is_active', character.queueOrder === 1); | ||
| 1337 | template.toggleClass('is_queued', character.queueOrder > 1); | ||
| 1316 | template.toggleClass('disabled', isGroupMemberDisabled(character.avatar)); | 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 | // Display inline tags | 1341 | // Display inline tags |
| 1319 | const tagsElement = template.find('.tags'); | 1342 | const tagsElement = template.find('.tags'); |
| @@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button { | |||
| 2922 | position: relative; | 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 | .character_select.is_fav .avatar, | 2933 | .character_select.is_fav .avatar, |
| 2926 | .group_select.is_fav .avatar, | 2934 | .group_select.is_fav .avatar, |
| 2927 | .group_member.is_fav .avatar, | 2935 | .group_member.is_fav .avatar, |