mirror of
https://github.com/open-webui/open-webui
synced 2025-01-31 06:49:03 +00:00
refac: tag restoration
This commit is contained in:
parent
d23252b8a9
commit
e378f70f34
@ -114,11 +114,12 @@ async def import_chat(form_data: ChatImportForm, user=Depends(get_verified_user)
|
|||||||
tags = chat.meta.get("tags", [])
|
tags = chat.meta.get("tags", [])
|
||||||
for tag_id in tags:
|
for tag_id in tags:
|
||||||
tag_id = tag_id.replace(" ", "_").lower()
|
tag_id = tag_id.replace(" ", "_").lower()
|
||||||
|
tag_name = " ".join([word.capitalize() for word in tag_id.split("_")])
|
||||||
if (
|
if (
|
||||||
tag_id != "none"
|
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())
|
return ChatResponse(**chat.model_dump())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user