Added detection for broken/deleted bookmark links, can expand on this to automatically delete broken links, but for now it just hides the icon.
This commit is contained in:
parent
b56fe3e01b
commit
dba685bffb
|
@ -55,6 +55,7 @@ import {
|
|||
renameGroupChat,
|
||||
importGroupChat,
|
||||
getGroupBlock,
|
||||
getGroupChatNames,
|
||||
} from "./scripts/group-chats.js";
|
||||
|
||||
import {
|
||||
|
@ -1604,8 +1605,17 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true
|
|||
mes.is_user,
|
||||
);
|
||||
const bias = messageFormatting(mes.extra?.bias ?? "");
|
||||
const bookmarkLink = mes?.extra?.bookmark_link ?? '';
|
||||
let bookmarkLink = mes?.extra?.bookmark_link ?? '';
|
||||
// Verify bookmarked chat still exists
|
||||
if (bookmarkLink !== '' ) {
|
||||
let chat_names = selected_group
|
||||
? getGroupChatNames(selected_group)
|
||||
: Object.values(getPastCharacterChats()).map(({file_name}) => file_name);
|
||||
|
||||
if (!chat_names.includes(bookmarkLink)) {
|
||||
bookmarkLink = ''
|
||||
}
|
||||
}
|
||||
let params = {
|
||||
mesId: count_view_mes,
|
||||
characterName: characterName,
|
||||
|
|
|
@ -80,6 +80,7 @@ export {
|
|||
regenerateGroup,
|
||||
resetSelectedGroup,
|
||||
select_group_chats,
|
||||
getGroupChatNames,
|
||||
}
|
||||
|
||||
let is_group_generating = false; // Group generation flag
|
||||
|
@ -405,6 +406,19 @@ function getGroupAvatar(group) {
|
|||
return groupAvatar;
|
||||
}
|
||||
|
||||
function getGroupChatNames(groupId) {
|
||||
const group = groups.find(x => x.id === groupId);
|
||||
|
||||
if (!group) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const names = [];
|
||||
for (const chatId of group.chats) {
|
||||
names.push(chatId);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
||||
if (online_status === "no_connection") {
|
||||
|
|
Loading…
Reference in New Issue