- Adding display of queued speakers in group chat windows.

f85b843b3ebeaed162d4b28cbbc74b7a429a7a9a

David Fedolfi <dfedolfi@gmail.com>

3 files changed, +36 -4Ignore whitespace
public/scripts/char-data.js+1 -0
@@ -112,5 +112,6 @@
112112 * @property {string} chat - name of the current chat file chat
113113 * @property {string} avatar - file name of the avatar image (acts as a unique identifier)
114114 * @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.
115116 */
116117export default 0;// now this file is a module
public/scripts/group-chats.js+27 -4
@@ -70,6 +70,7 @@ import {
7070 animation_duration,
7171 depth_prompt_role_default,
7272 shouldAutoContinue,
73+ this_chid,
7374} from '../script.js';
7475import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js';
7576import { FILTER_TYPES, FilterHelper } from './filters.js';
@@ -785,7 +786,8 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
785786 sendSystemMessage(system_message_types.EMPTY, '', { isSmallSys: true });
786787 return Promise.resolve();
787788 }
788-
789+
790+ const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId);
789791 try {
790792 throwIfAborted();
791793 hideSwipeButtons();
@@ -857,7 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
857859 await saveChatConditional();
858860 $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true }));
859861 }
860-
862+ if (showChatQueue){
863+ for (let i = 0; i < activatedMembers.length; ++i){
864+ characters[activatedMembers[i]].queueOrder = (i+1);
865+ }
866+ }
861867 // now the real generation begins: cycle through every activated character
862868 for (const chId of activatedMembers) {
863869 throwIfAborted();
@@ -865,6 +871,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
865871 const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat';
866872 setCharacterId(chId);
867873 setCharacterName(characters[chId].name);
874+ if (showChatQueue){
875+ printGroupMembers();
876+ }
868877 await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId);
869878
870879 if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) {
@@ -885,6 +894,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
885894 messageChunk = textResult?.messageChunk;
886895 }
887896 }
897+ if (showChatQueue){
898+ activatedMembers.filter(chidx => characters[chidx].queueOrder > 0)
899+ .forEach(chindex => characters[chindex].queueOrder -= 1);
900+ }
888901 }
889902 } finally {
890903 typingIndicator.hide();
@@ -892,6 +905,14 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
892905 is_group_generating = false;
893906 setSendButtonState(false);
894907 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+ }
895916 setCharacterName('');
896917 activateSendButtons();
897918 showSwipeButtons();
@@ -1309,11 +1330,13 @@ function getGroupCharacterBlock(character) {
13091330 const isFav = character.fav || character.fav == 'true';
13101331 template.data('id', character.avatar);
13111332 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));
13141334 template.find('.ch_fav').val(isFav);
13151335 template.toggleClass('is_fav', isFav);
1336+ template.toggleClass('is_active', character.queueOrder === 1);
1337+ template.toggleClass('is_queued', character.queueOrder > 1);
13161338 template.toggleClass('disabled', isGroupMemberDisabled(character.avatar));
1339+ template.toggleClass('is_active', character.avatar === (this_chid && characters[this_chid] && characters[this_chid].avatar));
13171340
13181341 // Display inline tags
13191342 const tagsElement = template.find('.tags');
public/style.css+8 -0
@@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button {
29222922 position: relative;
29232923}
29242924
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+
29252933.character_select.is_fav .avatar,
29262934.group_select.is_fav .avatar,
29272935.group_member.is_fav .avatar,