mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac
This commit is contained in:
parent
a5c359aede
commit
5148970ef5
2 changed files with 3 additions and 3 deletions
|
|
@ -215,12 +215,12 @@ class ChatTable:
|
||||||
return chat
|
return chat
|
||||||
|
|
||||||
def import_chats(
|
def import_chats(
|
||||||
self, user_id: str, chats: list[ChatImportForm]
|
self, user_id: str, chat_import_forms: list[ChatImportForm]
|
||||||
) -> list[ChatModel]:
|
) -> list[ChatModel]:
|
||||||
with get_db() as db:
|
with get_db() as db:
|
||||||
chats = []
|
chats = []
|
||||||
|
|
||||||
for form_data in chats:
|
for form_data in chat_import_forms:
|
||||||
chat = self._chat_import_form_to_chat_model(user_id, form_data)
|
chat = self._chat_import_form_to_chat_model(user_id, form_data)
|
||||||
chats.append(Chat(**chat.model_dump()))
|
chats.append(Chat(**chat.model_dump()))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ async def create_new_chat(form_data: ChatForm, user=Depends(get_verified_user)):
|
||||||
async def import_chats(form_data: ChatsImportForm, user=Depends(get_verified_user)):
|
async def import_chats(form_data: ChatsImportForm, user=Depends(get_verified_user)):
|
||||||
try:
|
try:
|
||||||
chats = Chats.import_chats(user.id, form_data.chats)
|
chats = Chats.import_chats(user.id, form_data.chats)
|
||||||
return [ChatResponse(**chat.model_dump()) for chat in chats]
|
return chats
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue