chore: Refactor deleteChatHistory method to deleteAllChatHistory
This commit is contained in:
		
							parent
							
								
									182f914275
								
							
						
					
					
						commit
						d6fff4bfa1
					
				| @ -116,7 +116,7 @@ export const SettingOther = () => { | |||||||
| 
 | 
 | ||||||
|               if (confirm) { |               if (confirm) { | ||||||
|                 const db = new PageAssitDatabase() |                 const db = new PageAssitDatabase() | ||||||
|                 await db.deleteChatHistory() |                 await db.deleteAllChatHistory() | ||||||
|                 queryClient.invalidateQueries({ |                 queryClient.invalidateQueries({ | ||||||
|                   queryKey: ["fetchChatHistory"] |                   queryKey: ["fetchChatHistory"] | ||||||
|                 }) |                 }) | ||||||
|  | |||||||
| @ -121,6 +121,14 @@ export class PageAssitDatabase { | |||||||
|     this.db.remove(id) |     this.db.remove(id) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   async deleteAllChatHistory() { | ||||||
|  |     const chatHistories = await this.getChatHistories() | ||||||
|  |     chatHistories.forEach((history) => { | ||||||
|  |       this.db.remove(history.id) | ||||||
|  |     }) | ||||||
|  |     this.db.set({ chatHistories: [] }) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   async deleteMessage(history_id: string) { |   async deleteMessage(history_id: string) { | ||||||
|     await this.db.remove(history_id) |     await this.db.remove(history_id) | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user