diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 926f88d3e2..187a4522c9 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -215,12 +215,12 @@ class ChatTable: return chat def import_chats( - self, user_id: str, chats: list[ChatImportForm] + self, user_id: str, chat_import_forms: list[ChatImportForm] ) -> list[ChatModel]: with get_db() as db: 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) chats.append(Chat(**chat.model_dump())) diff --git a/backend/open_webui/routers/chats.py b/backend/open_webui/routers/chats.py index ac420d6712..c62afaabec 100644 --- a/backend/open_webui/routers/chats.py +++ b/backend/open_webui/routers/chats.py @@ -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)): try: chats = Chats.import_chats(user.id, form_data.chats) - return [ChatResponse(**chat.model_dump()) for chat in chats] + return chats except Exception as e: log.exception(e) raise HTTPException(