mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 18:25:26 -04:00
feat(chat): confirm before deleting a message
Use the existing styledConfirm modal before destructive chat message deletion so accidental clicks can be cancelled.
This commit is contained in:
@@ -4481,6 +4481,15 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
* Delete an AI message and its preceding user message from the conversation.
|
||||
*/
|
||||
export async function deleteMessage(msgElement) {
|
||||
if (uiModule && uiModule.styledConfirm) {
|
||||
const ok = await uiModule.styledConfirm('Delete this message?', {
|
||||
confirmText: 'Delete',
|
||||
cancelText: 'Cancel',
|
||||
danger: true,
|
||||
});
|
||||
if (!ok) return;
|
||||
}
|
||||
|
||||
const box = document.getElementById('chat-history');
|
||||
const allMsgs = Array.from(box.querySelectorAll('.msg'));
|
||||
const clickedIndex = allMsgs.indexOf(msgElement);
|
||||
|
||||
Reference in New Issue
Block a user