From 748005b903600fab5f7718e77e145781a5044afa Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Tue, 10 Sep 2024 21:19:35 +0200 Subject: [PATCH] Remove unnecessary double popup for replace --- public/scripts/bookmarks.js | 13 ++++--------- public/scripts/templates/createCheckpoint.html | 9 ++++++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/public/scripts/bookmarks.js b/public/scripts/bookmarks.js index eb73eb814..fa74e7295 100644 --- a/public/scripts/bookmarks.js +++ b/public/scripts/bookmarks.js @@ -57,10 +57,10 @@ async function getExistingChatNames() { } } -async function getBookmarkName({ forceName = null } = {}) { +async function getBookmarkName({ isReplace = false, forceName = null } = {}) { const chatNames = await getExistingChatNames(); - const body = await renderTemplateAsync('createCheckpoint'); + const body = await renderTemplateAsync('createCheckpoint', { isReplace: isReplace }); let name = forceName || await Popup.show.input('Create Checkpoint', body); if (name === null) { return null; @@ -195,14 +195,9 @@ export async function createNewBookmark(mesId, { forceName = null } = {}) { lastMes.extra = {}; } - if (lastMes.extra.bookmark_link && !forceName) { - const confirm = await Popup.show.confirm('Replace Checkpoint', 'Checkpoint for the last message already exists.
Would you like to replace it?'); - if (!confirm) { - return null; - } - } + const isReplace = lastMes.extra.bookmark_link; - let name = await getBookmarkName({ forceName: forceName }); + let name = await getBookmarkName({ isReplace: isReplace, forceName: forceName }); if (!name) { return null; } diff --git a/public/scripts/templates/createCheckpoint.html b/public/scripts/templates/createCheckpoint.html index 4db900deb..98e9bd08b 100644 --- a/public/scripts/templates/createCheckpoint.html +++ b/public/scripts/templates/createCheckpoint.html @@ -1 +1,8 @@ -Enter Checkpoint Name:(Leave empty to auto-generate) \ No newline at end of file +
+ Enter Checkpoint Name:(Leave empty to auto-generate) +
+{{#if isReplace}} +
+ The currently existing checkpoint will be unlinked and replaced with the new checkpoint, but can still be found in the Chat Management. +
+{{/if}}