Remove unnecessary double popup for replace

748005b903600fab5f7718e77e145781a5044afa

Wolfsblvt <wolfsblvt@gmail.com>

2 files changed, +12 -10Ignore whitespace
public/scripts/bookmarks.js+4 -9
@@ -57,10 +57,10 @@ async function getExistingChatNames() {
5757 }
5858}
5959
6060async function getBookmarkName({ isReplace = false, forceName = null } = {}) {
6161 const chatNames = await getExistingChatNames();
6262
6363 const body = await renderTemplateAsync('createCheckpoint', { isReplace: isReplace });
6464 let name = forceName || await Popup.show.input('Create Checkpoint', body);
6565 if (name === null) {
6666 return null;
@@ -195,14 +195,9 @@ export async function createNewBookmark(mesId, { forceName = null } = {}) {
195195 lastMes.extra = {};
196196 }
197197
198- if (lastMes.extra.bookmark_link && !forceName) {
198+ const isReplace = lastMes.extra.bookmark_link;
199- const confirm = await Popup.show.confirm('Replace Checkpoint', 'Checkpoint for the last message already exists.<br />Would you like to replace it?');
200- if (!confirm) {
201- return null;
202- }
203- }
204199
205200 let name = await getBookmarkName({ isReplace: isReplace, forceName: forceName });
206201 if (!name) {
207202 return null;
208203 }
public/scripts/templates/createCheckpoint.html+8 -1
@@ -1 +1,8 @@
1-<span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>
1 \ No newline at end of file
1+<div>
2+ <span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>
3+</div>
4+{{#if isReplace}}
5+<div class="m-t-1">
6+ <small>The currently existing checkpoint will be unlinked and replaced with the new checkpoint, but can still be found in the Chat Management.</small>
7+</div>
8+{{/if}}