mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Confirm custom PM prompt deletion
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
import { callPopup, event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js';
|
||||
import { event_types, eventSource, is_send_press, main_api, substituteParams } from '../script.js';
|
||||
import { is_group_generating } from './group-chats.js';
|
||||
import { Message, TokenHandler } from './openai.js';
|
||||
import { power_user } from './power-user.js';
|
||||
import { debounce, waitUntilCondition, escapeHtml } from './utils.js';
|
||||
import { debounce_timeout } from './constants.js';
|
||||
import { renderTemplateAsync } from './templates.js';
|
||||
import { Popup } from './popup.js';
|
||||
|
||||
function debouncePromise(func, delay) {
|
||||
let timeoutId;
|
||||
@ -453,7 +454,9 @@ class PromptManager {
|
||||
};
|
||||
|
||||
// Delete selected prompt from list form and close edit form
|
||||
this.handleDeletePrompt = (event) => {
|
||||
this.handleDeletePrompt = async (event) => {
|
||||
Popup.show.confirm('Are you sure you want to delete this prompt?', null).then((userChoice) => {
|
||||
if (!userChoice) return;
|
||||
const promptID = document.getElementById(this.configuration.prefix + 'prompt_manager_footer_append_prompt').value;
|
||||
const prompt = this.getPromptById(promptID);
|
||||
|
||||
@ -468,6 +471,7 @@ class PromptManager {
|
||||
this.render();
|
||||
this.saveServiceSettings();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Create new prompt, then save it to settings and close form.
|
||||
@ -527,9 +531,9 @@ class PromptManager {
|
||||
|
||||
// Import prompts for the selected character
|
||||
this.handleImport = () => {
|
||||
callPopup('Existing prompts with the same ID will be overridden. Do you want to proceed?', 'confirm')
|
||||
Popup.show.confirm('Existing prompts with the same ID will be overridden. Do you want to proceed?', null)
|
||||
.then(userChoice => {
|
||||
if (false === userChoice) return;
|
||||
if (!userChoice) return;
|
||||
|
||||
const fileOpener = document.createElement('input');
|
||||
fileOpener.type = 'file';
|
||||
@ -563,9 +567,9 @@ class PromptManager {
|
||||
|
||||
// Restore default state of a characters prompt order
|
||||
this.handleCharacterReset = () => {
|
||||
callPopup('This will reset the prompt order for this character. You will not lose any prompts.', 'confirm')
|
||||
Popup.show.confirm('This will reset the prompt order for this character. You will not lose any prompts.', null)
|
||||
.then(userChoice => {
|
||||
if (false === userChoice) return;
|
||||
if (!userChoice) return;
|
||||
|
||||
this.removePromptOrderForCharacter(this.activeCharacter);
|
||||
this.addPromptOrderForCharacter(this.activeCharacter, promptManagerDefaultPromptOrder);
|
||||
|
Reference in New Issue
Block a user