From bf0043881a7e985d90b0c49a5efa7c1f39194f25 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 15 Oct 2024 03:11:03 -0700 Subject: [PATCH] refac --- backend/open_webui/apps/webui/models/chats.py | 4 +++- src/lib/components/layout/Sidebar.svelte | 11 +---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/backend/open_webui/apps/webui/models/chats.py b/backend/open_webui/apps/webui/models/chats.py index 13823e709..12bdd1c38 100644 --- a/backend/open_webui/apps/webui/models/chats.py +++ b/backend/open_webui/apps/webui/models/chats.py @@ -276,7 +276,9 @@ class ChatTable: limit: Optional[int] = None, ) -> list[ChatTitleIdResponse]: with get_db() as db: - query = db.query(Chat).filter_by(user_id=user_id, pinned=False) + query = db.query(Chat).filter_by(user_id=user_id) + query = query.filter(or_(Chat.pinned == False, Chat.pinned == None)) + if not include_archived: query = query.filter_by(archived=False) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 1140c2cbe..95fc4abe6 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -14,25 +14,16 @@ pinnedChats, scrollPaginationEnabled, currentChatPage, - temporaryChatEnabled, - showArtifacts, - showOverview, - showControls + temporaryChatEnabled } from '$lib/stores'; import { onMount, getContext, tick, onDestroy } from 'svelte'; const i18n = getContext('i18n'); - import { updateUserSettings } from '$lib/apis/users'; import { deleteChatById, getChatList, - getChatById, - getChatListByTagName, - updateChatById, getAllTags, - archiveChatById, - cloneChatById, getChatListBySearchText, createNewChat, getPinnedChatList,