diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 2d1aeddd05..23b5276786 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -305,6 +305,7 @@ class ChatTitleIdResponse(BaseModel): last_read_at: int | None = None snippet: str | None = None active: bool = False + archived: bool = False class SharedChatResponse(BaseModel): diff --git a/backend/open_webui/routers/chats.py b/backend/open_webui/routers/chats.py index 9f7cd98c82..c3eb390a78 100644 --- a/backend/open_webui/routers/chats.py +++ b/backend/open_webui/routers/chats.py @@ -888,6 +888,7 @@ async def search_user_chats( created_at=chat.created_at, last_read_at=chat.last_read_at, snippet=chat_search_snippet(chat.chat, search_text), + archived=chat.archived, ) ) diff --git a/src/lib/components/layout/SearchModal.svelte b/src/lib/components/layout/SearchModal.svelte index c687b9b4bc..a3c0e78be3 100644 --- a/src/lib/components/layout/SearchModal.svelte +++ b/src/lib/components/layout/SearchModal.svelte @@ -101,7 +101,7 @@ const archiveChatHandler = async (id) => { try { - await archiveChatById(localStorage.token, id); + const res = await archiveChatById(localStorage.token, id); chatList = chatList?.filter((c) => c.id !== id) ?? null; @@ -111,7 +111,7 @@ } await refreshSidebar(); - toast.success($i18n.t('Chat archived.')); + toast.success(res?.archived ? $i18n.t('Chat archived.') : $i18n.t('Chat unarchived.')); } catch (error) { toast.error($i18n.t('Failed to archive chat.')); } @@ -816,6 +816,7 @@