partially fix quietPrompts (/sysgen) for Instruct

This commit is contained in:
RossAscends 2023-09-16 12:48:14 +09:00
parent 1fed8ba4f7
commit e162df67fa
1 changed files with 15 additions and 5 deletions

View File

@ -287,7 +287,7 @@ export const event_types = {
USER_MESSAGE_RENDERED: 'user_message_rendered', USER_MESSAGE_RENDERED: 'user_message_rendered',
CHARACTER_MESSAGE_RENDERED: 'character_message_rendered', CHARACTER_MESSAGE_RENDERED: 'character_message_rendered',
FORCE_SET_BACKGROUND: 'force_set_background', FORCE_SET_BACKGROUND: 'force_set_background',
CHAT_DELETED : 'chat_deleted', CHAT_DELETED: 'chat_deleted',
GROUP_CHAT_DELETED: 'group_chat_deleted', GROUP_CHAT_DELETED: 'group_chat_deleted',
} }
@ -1158,7 +1158,7 @@ function showMoreMessages() {
console.debug('Inserting messages before', messageId, 'count', count, 'chat length', chat.length); console.debug('Inserting messages before', messageId, 'count', count, 'chat length', chat.length);
const prevHeight = $('#chat').prop('scrollHeight'); const prevHeight = $('#chat').prop('scrollHeight');
while(messageId > 0 && count > 0) { while (messageId > 0 && count > 0) {
count--; count--;
messageId--; messageId--;
addOneMessage(chat[messageId], { insertBefore: messageId + 1, scroll: false, forceId: messageId }); addOneMessage(chat[messageId], { insertBefore: messageId + 1, scroll: false, forceId: messageId });
@ -2755,7 +2755,17 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
if (quiet_prompt && quiet_prompt.length) { if (quiet_prompt && quiet_prompt.length) {
const name = name1; const name = name1;
const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, '', name1, name2, false) : `\n${quiet_prompt}`; const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, '', name1, name2, false) : `\n${quiet_prompt}`;
//This begins to fix quietPrompts (particularly /sysgen) for instruct
//previously instruct input sequence was being appended to the last chat message w/o '\n'
//and no output sequence was added after the input's content.
//TODO: respect output_sequence vs last_output_sequence settings
//TODO: decide how to prompt this to clarify who is talking 'Narrator', 'System', etc.
if (isInstruct) {
lastMesString += '\n' + quietAppend + power_user.instruct.output_sequence + '\n';
} else {
lastMesString += quietAppend; lastMesString += quietAppend;
}
// Bail out early // Bail out early
return lastMesString; return lastMesString;
} }