From e378f70f34c43c7ce5c3f5e0da5d28edc96c8d6e Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 20 Oct 2024 18:04:46 -0700 Subject: [PATCH] refac: tag restoration --- backend/open_webui/apps/webui/routers/chats.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/apps/webui/routers/chats.py b/backend/open_webui/apps/webui/routers/chats.py index 2e1273c1a..a768cd2e2 100644 --- a/backend/open_webui/apps/webui/routers/chats.py +++ b/backend/open_webui/apps/webui/routers/chats.py @@ -114,11 +114,12 @@ async def import_chat(form_data: ChatImportForm, user=Depends(get_verified_user) tags = chat.meta.get("tags", []) for tag_id in tags: tag_id = tag_id.replace(" ", "_").lower() + tag_name = " ".join([word.capitalize() for word in tag_id.split("_")]) if ( tag_id != "none" - and Tags.get_tag_by_name_and_user_id(tag_id, user.id) is None + and Tags.get_tag_by_name_and_user_id(tag_name, user.id) is None ): - Tags.insert_new_tag(tag_id, user.id) + Tags.insert_new_tag(tag_name, user.id) return ChatResponse(**chat.model_dump()) except Exception as e: