From faf27c4a90be590bc7a62bb02442624655d219da Mon Sep 17 00:00:00 2001 From: hemant singh <138347941+hemantsingh443@users.noreply.github.com> Date: Mon, 15 Jun 2026 11:41:12 +0530 Subject: [PATCH] feat(chat): confirm before deleting a message Use the existing styledConfirm modal before destructive chat message deletion so accidental clicks can be cancelled. --- static/js/chat.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/js/chat.js b/static/js/chat.js index 4279df570..c510ebf92 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -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);