forked from open-webui/open-webui
		
	fix: old chat log import issue
This commit is contained in:
		
							parent
							
								
									4e6207f888
								
							
						
					
					
						commit
						1a06b0cea6
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -142,13 +142,20 @@
 | 
			
		|||
			importChats(chats);
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		reader.readAsText(importFiles[0]);
 | 
			
		||||
		if (importFiles.length > 0) {
 | 
			
		||||
			reader.readAsText(importFiles[0]);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const importChats = async (_chats) => {
 | 
			
		||||
		for (const chat of _chats) {
 | 
			
		||||
			console.log(chat);
 | 
			
		||||
			await createNewChat(localStorage.token, chat.chat);
 | 
			
		||||
 | 
			
		||||
			if (chat.chat) {
 | 
			
		||||
				await createNewChat(localStorage.token, chat.chat);
 | 
			
		||||
			} else {
 | 
			
		||||
				await createNewChat(localStorage.token, chat);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		await chats.set(await getChatList(localStorage.token));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue