fix: tag unarchive/archive issue
This commit is contained in:
@@ -267,7 +267,7 @@ export const getAllUserChats = async (token: string) => {
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getAllChatTags = async (token: string) => {
|
||||
export const getAllTags = async (token: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/chats/all/tags`, {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
addTagById,
|
||||
deleteTagById,
|
||||
getAllChatTags,
|
||||
getAllTags,
|
||||
getChatList,
|
||||
getChatListByTagName,
|
||||
getTagsById,
|
||||
@@ -37,7 +37,7 @@
|
||||
tags: tags
|
||||
});
|
||||
|
||||
await _tags.set(await getAllChatTags(localStorage.token));
|
||||
await _tags.set(await getAllTags(localStorage.token));
|
||||
dispatch('add', {
|
||||
name: tagName
|
||||
});
|
||||
@@ -50,7 +50,7 @@
|
||||
tags: tags
|
||||
});
|
||||
|
||||
await _tags.set(await getAllChatTags(localStorage.token));
|
||||
await _tags.set(await getAllTags(localStorage.token));
|
||||
dispatch('delete', {
|
||||
name: tagName
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
getChatById,
|
||||
getChatListByTagName,
|
||||
updateChatById,
|
||||
getAllChatTags,
|
||||
getAllTags,
|
||||
archiveChatById,
|
||||
cloneChatById,
|
||||
getChatListBySearchText,
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
const initChatList = async () => {
|
||||
// Reset pagination variables
|
||||
tags.set(await getAllTags(localStorage.token));
|
||||
|
||||
currentChatPage.set(1);
|
||||
allChatsLoaded = false;
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
@@ -123,6 +125,10 @@
|
||||
searchDebounceTimeout = setTimeout(async () => {
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatListBySearchText(localStorage.token, search));
|
||||
|
||||
if ($chats.length === 0) {
|
||||
tags.set(await getAllTags(localStorage.token));
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
@@ -134,6 +140,8 @@
|
||||
});
|
||||
|
||||
if (res) {
|
||||
tags.set(await getAllTags(localStorage.token));
|
||||
|
||||
if ($chatId === id) {
|
||||
await chatId.set('');
|
||||
await tick();
|
||||
@@ -143,7 +151,6 @@
|
||||
allChatsLoaded = false;
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
|
||||
await pinnedChats.set(await getPinnedChatList(localStorage.token));
|
||||
}
|
||||
};
|
||||
@@ -324,7 +331,7 @@
|
||||
bind:show={$showArchivedChats}
|
||||
on:change={async () => {
|
||||
await pinnedChats.set(await getPinnedChatList(localStorage.token));
|
||||
await chats.set(await getChatList(localStorage.token));
|
||||
await initChatList();
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
getArchivedChatList
|
||||
} from '$lib/apis/chats';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
export let show = false;
|
||||
@@ -30,7 +29,6 @@
|
||||
});
|
||||
|
||||
chats = await getArchivedChatList(localStorage.token);
|
||||
|
||||
dispatch('change');
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
archiveChatById,
|
||||
cloneChatById,
|
||||
deleteChatById,
|
||||
getAllTags,
|
||||
getChatList,
|
||||
getChatListByTagName,
|
||||
getPinnedChatList,
|
||||
@@ -22,7 +23,8 @@
|
||||
mobile,
|
||||
pinnedChats,
|
||||
showSidebar,
|
||||
currentChatPage
|
||||
currentChatPage,
|
||||
tags
|
||||
} from '$lib/stores';
|
||||
|
||||
import ChatMenu from './ChatMenu.svelte';
|
||||
@@ -77,6 +79,7 @@
|
||||
|
||||
const archiveChatHandler = async (id) => {
|
||||
await archiveChatById(localStorage.token, id);
|
||||
tags.set(await getAllTags(localStorage.token));
|
||||
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
|
||||
@@ -15,13 +15,8 @@
|
||||
import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte';
|
||||
import Bookmark from '$lib/components/icons/Bookmark.svelte';
|
||||
import BookmarkSlash from '$lib/components/icons/BookmarkSlash.svelte';
|
||||
import {
|
||||
addTagById,
|
||||
deleteTagById,
|
||||
getChatPinnedStatusById,
|
||||
getTagsById,
|
||||
toggleChatPinnedStatusById
|
||||
} from '$lib/apis/chats';
|
||||
import { getChatPinnedStatusById, toggleChatPinnedStatusById } from '$lib/apis/chats';
|
||||
import { chats } from '$lib/stores';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -146,6 +141,7 @@
|
||||
type: 'add',
|
||||
name: e.detail.name
|
||||
});
|
||||
|
||||
show = false;
|
||||
}}
|
||||
on:delete={(e) => {
|
||||
@@ -153,6 +149,7 @@
|
||||
type: 'delete',
|
||||
name: e.detail.name
|
||||
});
|
||||
|
||||
show = false;
|
||||
}}
|
||||
on:close={() => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { getKnowledgeItems } from '$lib/apis/knowledge';
|
||||
import { getFunctions } from '$lib/apis/functions';
|
||||
import { getModels as _getModels, getVersionUpdates } from '$lib/apis';
|
||||
import { getAllChatTags } from '$lib/apis/chats';
|
||||
import { getAllTags } from '$lib/apis/chats';
|
||||
import { getPrompts } from '$lib/apis/prompts';
|
||||
import { getTools } from '$lib/apis/tools';
|
||||
import { getBanners } from '$lib/apis/configs';
|
||||
@@ -117,7 +117,7 @@
|
||||
banners.set(await getBanners(localStorage.token));
|
||||
})(),
|
||||
(async () => {
|
||||
tags.set(await getAllChatTags(localStorage.token));
|
||||
tags.set(await getAllTags(localStorage.token));
|
||||
})()
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user