Tag Folders: Additional Fixes

- Refactored to one general printTagList method
- Made a robust getTagKeyForEntity function
- Fixed group not displaying tags if autoloaded
- Fixed added tags on character/groups not being auto sorted
- Fixed autoload of group/character that I killed
- Fixed typo
This commit is contained in:
Wolfsblvt
2024-03-07 23:48:50 +01:00
parent 7b49290fec
commit 5ac7826fec
6 changed files with 131 additions and 82 deletions

View File

@@ -69,7 +69,7 @@ import {
loadItemizedPrompts,
animation_duration,
} from '../script.js';
import { appendTagToList, createTagMapFromList, getTagsList, applyTagsOnCharacterSelect, tag_map } from './tags.js';
import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map } from './tags.js';
import { FILTER_TYPES, FilterHelper } from './filters.js';
export {
@@ -546,9 +546,8 @@ export function getGroupBlock(group) {
template.find('.group_select_block_list').append(namesList.join(''));
// Display inline tags
const tags = getTagsList(group.id);
const tagsElement = template.find('.tags');
tags.forEach(tag => appendTagToList(tagsElement, tag, {}));
printTagList(tagsElement, { forEntityOrKey: group.id });
const avatar = getGroupAvatar(group);
if (avatar) {
@@ -579,7 +578,7 @@ function isValidImageUrl(url) {
function getGroupAvatar(group) {
if (!group) {
return $(`<div class="avatar" title="[Group] ${group.name}"><img src="${default_avatar}"></div>`);
return $(`<div class="avatar"><img src="${default_avatar}"></div>`);
}
// if isDataURL or if it's a valid local file url
if (isValidImageUrl(group.avatar_url)) {
@@ -1185,9 +1184,8 @@ function getGroupCharacterBlock(character) {
template.toggleClass('disabled', isGroupMemberDisabled(character.avatar));
// Display inline tags
const tags = getTagsList(character.avatar);
const tagsElement = template.find('.tags');
tags.forEach(tag => appendTagToList(tagsElement, tag, {}));
printTagList(tagsElement, { forEntityOrKey: characters.indexOf(character) });
if (!openGroupId) {
template.find('[data-action="speak"]').hide();
@@ -1263,6 +1261,9 @@ function select_group_chats(groupId, skipAnimation) {
selectRightMenuWithAnimation('rm_group_chats_block');
}
// render tags
printTagList($('#groupTagList'), { forEntityOrKey: groupId, tagOptions: { removable: true } });
// render characters list
printGroupCandidates();
printGroupMembers();