Refactor message appending logic in useMessageOption hook
This commit is contained in:
@@ -286,11 +286,10 @@ export const updateHistory = async (id: string, title: string) => {
|
||||
}
|
||||
|
||||
export const removeMessageUsingHistoryId = async (history_id: string) => {
|
||||
// remove the last message
|
||||
const db = new PageAssitDatabase()
|
||||
const chatHistory = await db.getChatHistory(history_id)
|
||||
const newChatHistory = chatHistory.slice(0, -1)
|
||||
await db.db.set({ [history_id]: newChatHistory })
|
||||
chatHistory.shift()
|
||||
await db.db.set({ [history_id]: chatHistory })
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user