Merge branch 'staging' into parser-v2
This commit is contained in:
commit
2b5eadfbec
|
@ -4178,9 +4178,10 @@ export function removeMacros(str) {
|
||||||
* @param {string} messageText Message text.
|
* @param {string} messageText Message text.
|
||||||
* @param {string} messageBias Message bias.
|
* @param {string} messageBias Message bias.
|
||||||
* @param {number} [insertAt] Optional index to insert the message at.
|
* @param {number} [insertAt] Optional index to insert the message at.
|
||||||
|
* @params {boolean} [compact] Send as a compact display message.
|
||||||
* @returns {Promise<void>} A promise that resolves when the message is inserted.
|
* @returns {Promise<void>} A promise that resolves when the message is inserted.
|
||||||
*/
|
*/
|
||||||
export async function sendMessageAsUser(messageText, messageBias, insertAt = null) {
|
export async function sendMessageAsUser(messageText, messageBias, insertAt = null, compact = false) {
|
||||||
messageText = getRegexedString(messageText, regex_placement.USER_INPUT);
|
messageText = getRegexedString(messageText, regex_placement.USER_INPUT);
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
|
@ -4189,7 +4190,9 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
|
||||||
is_system: false,
|
is_system: false,
|
||||||
send_date: getMessageTimeStamp(),
|
send_date: getMessageTimeStamp(),
|
||||||
mes: substituteParams(messageText),
|
mes: substituteParams(messageText),
|
||||||
extra: {},
|
extra: {
|
||||||
|
isSmallSys: compact,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (power_user.message_token_count_enabled) {
|
if (power_user.message_token_count_enabled) {
|
||||||
|
|
|
@ -207,10 +207,10 @@ parser.addCommand('name', setNameCallback, ['persona'], '<span class="monospace"
|
||||||
parser.addCommand('sync', syncCallback, [], ' – syncs the user persona in user-attributed messages in the current chat', true, true);
|
parser.addCommand('sync', syncCallback, [], ' – syncs the user persona in user-attributed messages in the current chat', true, true);
|
||||||
parser.addCommand('lock', bindCallback, ['bind'], ' – locks/unlocks a persona (name and avatar) to the current chat', true, true);
|
parser.addCommand('lock', bindCallback, ['bind'], ' – locks/unlocks a persona (name and avatar) to the current chat', true, true);
|
||||||
parser.addCommand('bg', setBackgroundCallback, ['background'], '<span class="monospace">(filename)</span> – sets a background according to filename, partial names allowed', false, true);
|
parser.addCommand('bg', setBackgroundCallback, ['background'], '<span class="monospace">(filename)</span> – sets a background according to filename, partial names allowed', false, true);
|
||||||
parser.addCommand('sendas', sendMessageAs, [], ' – sends message as a specific character. Uses character avatar if it exists in the characters list. Example that will send "Hello, guys!" from "Chloe": <tt>/sendas name="Chloe" Hello, guys!</tt>', true, true);
|
parser.addCommand('sendas', sendMessageAs, [], '<span class="monospace">[name=CharName compact=true/false (text)] – sends message as a specific character. Uses character avatar if it exists in the characters list. Example that will send "Hello, guys!" from "Chloe": <tt>/sendas name="Chloe" Hello, guys!</tt>. If "compact" is set to true, the message is sent using a compact layout.', true, true);
|
||||||
parser.addCommand('sys', sendNarratorMessage, ['nar'], '<span class="monospace">(text)</span> – sends message as a system narrator', false, true);
|
parser.addCommand('sys', sendNarratorMessage, ['nar'], '<span class="monospace">[compact=true/false (text)]</span> – sends message as a system narrator. If "compact" is set to true, the message is sent using a compact layout.', false, true);
|
||||||
parser.addCommand('sysname', setNarratorName, [], '<span class="monospace">(name)</span> – sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.', true, true);
|
parser.addCommand('sysname', setNarratorName, [], '<span class="monospace">(name)</span> – sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.', true, true);
|
||||||
parser.addCommand('comment', sendCommentMessage, [], '<span class="monospace">(text)</span> – adds a note/comment message not part of the chat', false, true);
|
parser.addCommand('comment', sendCommentMessage, [], '<span class="monospace">[compact=true/false (text)]</span> – adds a note/comment message not part of the chat. If "compact" is set to true, the message is sent using a compact layout.', false, true);
|
||||||
parser.addCommand('single', setStoryModeCallback, ['story'], ' – sets the message style to single document mode without names or avatars visible', true, true);
|
parser.addCommand('single', setStoryModeCallback, ['story'], ' – sets the message style to single document mode without names or avatars visible', true, true);
|
||||||
parser.addCommand('bubble', setBubbleModeCallback, ['bubbles'], ' – sets the message style to bubble chat mode', true, true);
|
parser.addCommand('bubble', setBubbleModeCallback, ['bubbles'], ' – sets the message style to bubble chat mode', true, true);
|
||||||
parser.addCommand('flat', setFlatModeCallback, ['default'], ' – sets the message style to flat chat mode', true, true);
|
parser.addCommand('flat', setFlatModeCallback, ['default'], ' – sets the message style to flat chat mode', true, true);
|
||||||
|
@ -219,7 +219,7 @@ parser.addCommand('go', goToCharacterCallback, ['char'], '<span class="monospace
|
||||||
parser.addCommand('sysgen', generateSystemMessage, [], '<span class="monospace">(prompt)</span> – generates a system message using a specified prompt', true, true);
|
parser.addCommand('sysgen', generateSystemMessage, [], '<span class="monospace">(prompt)</span> – generates a system message using a specified prompt', true, true);
|
||||||
parser.addCommand('ask', askCharacter, [], '<span class="monospace">(prompt)</span> – asks a specified character card a prompt', true, true);
|
parser.addCommand('ask', askCharacter, [], '<span class="monospace">(prompt)</span> – asks a specified character card a prompt', true, true);
|
||||||
parser.addCommand('delname', deleteMessagesByNameCallback, ['cancel'], '<span class="monospace">(name)</span> – deletes all messages attributed to a specified name', true, true);
|
parser.addCommand('delname', deleteMessagesByNameCallback, ['cancel'], '<span class="monospace">(name)</span> – deletes all messages attributed to a specified name', true, true);
|
||||||
parser.addCommand('send', sendUserMessageCallback, [], '<span class="monospace">(text)</span> – adds a user message to the chat log without triggering a generation', true, true);
|
parser.addCommand('send', sendUserMessageCallback, [], '<span class="monospace">[compact=true/false (text)]</span> – adds a user message to the chat log without triggering a generation. If "compact" is set to true, the message is sent using a compact layout.', true, true);
|
||||||
parser.addCommand('trigger', triggerGenerationCallback, [], ' <span class="monospace">await=true/false</span> – triggers a message generation. If in group, can trigger a message for the specified group member index or name. If <code>await=true</code> named argument passed, the command will await for the triggered generation before continuing.', true, true);
|
parser.addCommand('trigger', triggerGenerationCallback, [], ' <span class="monospace">await=true/false</span> – triggers a message generation. If in group, can trigger a message for the specified group member index or name. If <code>await=true</code> named argument passed, the command will await for the triggered generation before continuing.', true, true);
|
||||||
parser.addCommand('hide', hideMessageCallback, [], '<span class="monospace">(message index or range)</span> – hides a chat message from the prompt', true, true);
|
parser.addCommand('hide', hideMessageCallback, [], '<span class="monospace">(message index or range)</span> – hides a chat message from the prompt', true, true);
|
||||||
parser.addCommand('unhide', unhideMessageCallback, [], '<span class="monospace">(message index or range)</span> – unhides a message from the prompt', true, true);
|
parser.addCommand('unhide', unhideMessageCallback, [], '<span class="monospace">(message index or range)</span> – unhides a message from the prompt', true, true);
|
||||||
|
@ -1179,9 +1179,10 @@ async function sendUserMessageCallback(args, text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
|
const compact = isTrueBoolean(args?.compact);
|
||||||
const bias = extractMessageBias(text);
|
const bias = extractMessageBias(text);
|
||||||
const insertAt = Number(resolveVariable(args?.at));
|
const insertAt = Number(resolveVariable(args?.at));
|
||||||
await sendMessageAsUser(text, bias, insertAt);
|
await sendMessageAsUser(text, bias, insertAt, compact);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1394,6 +1395,7 @@ export async function sendMessageAs(args, text) {
|
||||||
// Messages that do nothing but set bias will be hidden from the context
|
// Messages that do nothing but set bias will be hidden from the context
|
||||||
const bias = extractMessageBias(mesText);
|
const bias = extractMessageBias(mesText);
|
||||||
const isSystem = bias && !removeMacros(mesText).length;
|
const isSystem = bias && !removeMacros(mesText).length;
|
||||||
|
const compact = isTrueBoolean(args?.compact);
|
||||||
|
|
||||||
const character = characters.find(x => x.name === name);
|
const character = characters.find(x => x.name === name);
|
||||||
let force_avatar, original_avatar;
|
let force_avatar, original_avatar;
|
||||||
|
@ -1418,6 +1420,7 @@ export async function sendMessageAs(args, text) {
|
||||||
extra: {
|
extra: {
|
||||||
bias: bias.trim().length ? bias : null,
|
bias: bias.trim().length ? bias : null,
|
||||||
gen_id: Date.now(),
|
gen_id: Date.now(),
|
||||||
|
isSmallSys: compact,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1447,6 +1450,7 @@ export async function sendNarratorMessage(args, text) {
|
||||||
// Messages that do nothing but set bias will be hidden from the context
|
// Messages that do nothing but set bias will be hidden from the context
|
||||||
const bias = extractMessageBias(text);
|
const bias = extractMessageBias(text);
|
||||||
const isSystem = bias && !removeMacros(text).length;
|
const isSystem = bias && !removeMacros(text).length;
|
||||||
|
const compact = isTrueBoolean(args?.compact);
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -1459,6 +1463,7 @@ export async function sendNarratorMessage(args, text) {
|
||||||
type: system_message_types.NARRATOR,
|
type: system_message_types.NARRATOR,
|
||||||
bias: bias.trim().length ? bias : null,
|
bias: bias.trim().length ? bias : null,
|
||||||
gen_id: Date.now(),
|
gen_id: Date.now(),
|
||||||
|
isSmallSys: compact,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1523,6 +1528,7 @@ async function sendCommentMessage(args, text) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const compact = isTrueBoolean(args?.compact);
|
||||||
const message = {
|
const message = {
|
||||||
name: COMMENT_NAME_DEFAULT,
|
name: COMMENT_NAME_DEFAULT,
|
||||||
is_user: false,
|
is_user: false,
|
||||||
|
@ -1533,6 +1539,7 @@ async function sendCommentMessage(args, text) {
|
||||||
extra: {
|
extra: {
|
||||||
type: system_message_types.COMMENT,
|
type: system_message_types.COMMENT,
|
||||||
gen_id: Date.now(),
|
gen_id: Date.now(),
|
||||||
|
isSmallSys: compact,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -382,6 +382,15 @@ small {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mes.smallSysMes .mes_text p:last-child {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mes.smallSysMes .swipe_right,
|
||||||
|
.mes.smallSysMes .swipe_left {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.mes.smallSysMes .mes_text {
|
.mes.smallSysMes .mes_text {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
Loading…
Reference in New Issue