forked from open-webui/open-webui
		
	fix: db object
This commit is contained in:
		
							parent
							
								
									b7030c00e2
								
							
						
					
					
						commit
						b7f3607f48
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -110,7 +110,7 @@ | ||||||
| 					console.log(chat); | 					console.log(chat); | ||||||
| 					await this.addChat(chat); | 					await this.addChat(chat); | ||||||
| 				} | 				} | ||||||
| 				await chats.set(await this.db.getChats()); | 				await chats.set(await this.getChats()); | ||||||
| 			}, | 			}, | ||||||
| 			addChat: async function (chat) { | 			addChat: async function (chat) { | ||||||
| 				await this.db.put('chats', { | 				await this.db.put('chats', { | ||||||
|  | @ -119,7 +119,7 @@ | ||||||
| 			}, | 			}, | ||||||
| 			createNewChat: async function (chat) { | 			createNewChat: async function (chat) { | ||||||
| 				await this.addChat({ ...chat, timestamp: Date.now() }); | 				await this.addChat({ ...chat, timestamp: Date.now() }); | ||||||
| 				await chats.set(await this.db.getChats()); | 				await chats.set(await this.getChats()); | ||||||
| 			}, | 			}, | ||||||
| 			updateChatById: async function (id, updated) { | 			updateChatById: async function (id, updated) { | ||||||
| 				const chat = await this.getChatById(id); | 				const chat = await this.getChatById(id); | ||||||
|  | @ -130,17 +130,17 @@ | ||||||
| 					timestamp: Date.now() | 					timestamp: Date.now() | ||||||
| 				}); | 				}); | ||||||
| 
 | 
 | ||||||
| 				await chats.set(await this.db.getChats()); | 				await chats.set(await this.getChats()); | ||||||
| 			}, | 			}, | ||||||
| 			deleteChatById: async function (id) { | 			deleteChatById: async function (id) { | ||||||
| 				await this.db.delete('chats', id); | 				await this.db.delete('chats', id); | ||||||
| 				await chats.set(await this.db.getChats()); | 				await chats.set(await this.getChats()); | ||||||
| 			}, | 			}, | ||||||
| 			deleteAllChat: async function () { | 			deleteAllChat: async function () { | ||||||
| 				const tx = this.db.transaction('chats', 'readwrite'); | 				const tx = this.db.transaction('chats', 'readwrite'); | ||||||
| 				await Promise.all([tx.store.clear(), tx.done]); | 				await Promise.all([tx.store.clear(), tx.done]); | ||||||
| 
 | 
 | ||||||
| 				await chats.set(await this.db.getChats()); | 				await chats.set(await this.getChats()); | ||||||
| 			} | 			} | ||||||
| 		}; | 		}; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek