Delete vectors on deleting chats

This commit is contained in:
Cohee
2023-09-09 22:15:47 +03:00
parent ed6417ebcd
commit af38971a01
5 changed files with 86 additions and 5 deletions

View File

@ -816,12 +816,20 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
}
async function deleteGroup(id) {
const group = groups.find((x) => x.id === id);
const response = await fetch("/deletegroup", {
method: "POST",
headers: getRequestHeaders(),
body: JSON.stringify({ id: id }),
});
if (group && Array.isArray(group.chats)) {
for (const chatId of group.chats) {
await eventSource.emit(event_types.GROUP_CHAT_DELETED, chatId);
}
}
if (response.ok) {
selected_group = null;
delete tag_map[id];
@ -1493,6 +1501,8 @@ export async function deleteGroupChat(groupId, chatId) {
} else {
await createNewGroupChat(groupId);
}
await eventSource.emit(event_types.GROUP_CHAT_DELETED, chatId);
}
}