fix: archived chats

This commit is contained in:
Timothy J. Baek 2024-10-14 15:29:43 -07:00
parent 466eea1a4c
commit 0b2c7046cd
2 changed files with 4 additions and 1 deletions

View File

@ -61,10 +61,12 @@ class ChatModel(BaseModel):
class ChatForm(BaseModel):
chat: dict
class ChatTitleMessagesForm(BaseModel):
title: str
messages: list[dict]
class ChatTitleForm(BaseModel):
title: str
@ -361,7 +363,7 @@ class ChatTable:
with get_db() as db:
all_chats = (
db.query(Chat)
.filter_by(user_id=user_id, pinned=True)
.filter_by(user_id=user_id, pinned=True, archived=False)
.order_by(Chat.updated_at.desc())
)
return [ChatModel.model_validate(chat) for chat in all_chats]

View File

@ -311,6 +311,7 @@
<ArchivedChatsModal
bind:show={$showArchivedChats}
on:change={async () => {
await pinnedChats.set(await getPinnedChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token));
}}
/>