Impersonate with `last_input_sequence` (#5456)

af7bd65f427e60b381e0392e9171b6997e94f7a4

CasualAutopsy <107777585+CasualAutopsy@users.noreply.github.com>

Signed
3 files changed, +3 -3Showing whitespace changes
public/index.html+1 -1
@@ -4387,7 +4387,7 @@
4387 <small data-i18n="First User Prefix">First User Prefix</small>4387 <small data-i18n="First User Prefix">First User Prefix</small>
4388 <textarea id="instruct_first_input_sequence" data-macros class="text_pole textarea_compact autoSetHeight"></textarea>4388 <textarea id="instruct_first_input_sequence" data-macros class="text_pole textarea_compact autoSetHeight"></textarea>
4389 </div>4389 </div>
4390 <div class="flexAuto" title="Inserted before the last User's message." data-i18n="[title]instruct_last_input_sequence">4390 <div class="flexAuto" title="Inserted before the last User's message or as a last prompt line when generating an impersonation." data-i18n="[title]instruct_last_input_sequence">
4391 <small data-i18n="Last User Prefix">Last User Prefix</small>4391 <small data-i18n="Last User Prefix">Last User Prefix</small>
4392 <textarea id="instruct_last_input_sequence" data-macros class="text_pole wide100p textarea_compact autoSetHeight"></textarea>4392 <textarea id="instruct_last_input_sequence" data-macros class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
4393 </div>4393 </div>
public/script.js+1 -1
@@ -4718,7 +4718,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
4718 chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.FIRST);4718 chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.FIRST);
4719 }4719 }
47204720
4721 if (lastUserMessageIndex >= 0 && j === lastUserMessageIndex && isInstruct) {4721 if (lastUserMessageIndex >= 0 && j === lastUserMessageIndex && isInstruct && !isImpersonate) {
4722 // Reformat with the last input sequence (if any)4722 // Reformat with the last input sequence (if any)
4723 chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.LAST);4723 chat2[i] = formatMessageHistoryItem(coreChat[j], isInstruct, force_output_sequence.LAST);
4724 }4724 }
public/scripts/instruct-mode.js+1 -1
@@ -597,7 +597,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
597 function getSequence() {597 function getSequence() {
598 // User impersonation prompt598 // User impersonation prompt
599 if (isImpersonate) {599 if (isImpersonate) {
600 return instruct.input_sequence;600 return instruct.last_input_sequence || instruct.input_sequence;
601 }601 }
602602
603 // Neutral / system / quiet prompt603 // Neutral / system / quiet prompt