From a9e074dae1bd86572a50d7a8c2823a77c3bc45fa Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 24 Dec 2023 02:47:00 +0200 Subject: [PATCH] Don't recreate first message if generation was run at least once --- public/script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 5cae61df4..23be30980 100644 --- a/public/script.js +++ b/public/script.js @@ -2974,9 +2974,11 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu return Promise.resolve(); } - // Hide swipes if not in a dry run. if (!dryRun) { + // Hide swipes if not in a dry run. hideSwipeButtons(); + // If generated any message, set the flag to indicate it can't be recreated again. + chat_metadata['tainted'] = true; } if (selected_group && !is_group_generating && !dryRun) { @@ -7105,7 +7107,8 @@ async function createOrEditCharacter(e) { crop_data = undefined; eventSource.emit(event_types.CHARACTER_EDITED, { detail: { id: this_chid, character: characters[this_chid] } }); - if (chat.length === 1 && !selected_group) { + // Recreate the chat if it hasn't been used at least once (i.e. with continue). + if (chat.length === 1 && !selected_group && !chat_metadata['tainted']) { const firstMessage = getFirstMessage(); chat[0] = firstMessage;