Remove unnecessary double popup for replace

This commit is contained in:
Wolfsblvt 2024-09-10 21:19:35 +02:00
parent 27e0905a1b
commit 748005b903
2 changed files with 12 additions and 10 deletions

View File

@ -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.<br />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;
}

View File

@ -1 +1,8 @@
<span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>
<div>
<span class="margin-right-10px">Enter Checkpoint Name:</span><small>(Leave empty to auto-generate)</small>
</div>
{{#if isReplace}}
<div class="m-t-1">
<small>The currently existing checkpoint will be unlinked and replaced with the new checkpoint, but can still be found in the Chat Management.</small>
</div>
{{/if}}