Merge pull request #522 from ollama-webui/import-chat-fix

fix: old chat log import issue
This commit is contained in:
Timothy Jaeryang Baek 2024-01-18 16:39:46 -08:00 committed by GitHub
commit ff33aa37ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,13 +142,20 @@
importChats(chats); importChats(chats);
}; };
if (importFiles.length > 0) {
reader.readAsText(importFiles[0]); reader.readAsText(importFiles[0]);
} }
}
const importChats = async (_chats) => { const importChats = async (_chats) => {
for (const chat of _chats) { for (const chat of _chats) {
console.log(chat); console.log(chat);
if (chat.chat) {
await createNewChat(localStorage.token, chat.chat); await createNewChat(localStorage.token, chat.chat);
} else {
await createNewChat(localStorage.token, chat);
}
} }
await chats.set(await getChatList(localStorage.token)); await chats.set(await getChatList(localStorage.token));