From 9d2d53bfb5e4054605fe27d15535486a019a105c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 14 Oct 2024 22:59:17 -0700 Subject: [PATCH] fix --- backend/open_webui/apps/webui/routers/chats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/apps/webui/routers/chats.py b/backend/open_webui/apps/webui/routers/chats.py index a91d1e11d..2e3afcdfe 100644 --- a/backend/open_webui/apps/webui/routers/chats.py +++ b/backend/open_webui/apps/webui/routers/chats.py @@ -328,7 +328,7 @@ async def delete_chat_by_id(request: Request, id: str, user=Depends(get_verified if user.role == "admin": chat = Chats.get_chat_by_id(id) for tag in chat.meta.get("tags", []): - if Chats.count_chats_by_tag_name_and_user_id(tag, user.id) == 0: + if Chats.count_chats_by_tag_name_and_user_id(tag, user.id) == 1: Tags.delete_tag_by_name_and_user_id(tag, user.id) result = Chats.delete_chat_by_id(id) @@ -345,7 +345,7 @@ async def delete_chat_by_id(request: Request, id: str, user=Depends(get_verified chat = Chats.get_chat_by_id(id) for tag in chat.meta.get("tags", []): - if Chats.count_chats_by_tag_name_and_user_id(tag, user.id) == 0: + if Chats.count_chats_by_tag_name_and_user_id(tag, user.id) == 1: Tags.delete_tag_by_name_and_user_id(tag, user.id) result = Chats.delete_chat_by_id_and_user_id(id, user.id)