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:
parent
ebbcdc15af
commit
faf27c4a90
1 changed files with 9 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue