mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#778 Slash command to add a persona message without generation
This commit is contained in:
@ -20,6 +20,7 @@ import {
|
|||||||
setCharacterId,
|
setCharacterId,
|
||||||
generateQuietPrompt,
|
generateQuietPrompt,
|
||||||
reloadCurrentChat,
|
reloadCurrentChat,
|
||||||
|
sendMessageAsUser,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { humanizedDateTime } from "./RossAscends-mods.js";
|
import { humanizedDateTime } from "./RossAscends-mods.js";
|
||||||
import { resetSelectedGroup } from "./group-chats.js";
|
import { resetSelectedGroup } from "./group-chats.js";
|
||||||
@ -126,11 +127,23 @@ parser.addCommand('continue', continueChatCallback, ['cont'], ' – continues th
|
|||||||
parser.addCommand('go', goToCharacterCallback, ['char'], '<span class="monospace">(name)</span> – opens up a chat with the character by its name', true, true);
|
parser.addCommand('go', goToCharacterCallback, ['char'], '<span class="monospace">(name)</span> – opens up a chat with the character by its name', true, true);
|
||||||
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('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, ['add'], '<span class="monospace">(text)</span> – adds a user message to the chat log without triggering a generation', true, true);
|
||||||
|
|
||||||
const NARRATOR_NAME_KEY = 'narrator_name';
|
const NARRATOR_NAME_KEY = 'narrator_name';
|
||||||
const NARRATOR_NAME_DEFAULT = 'System';
|
const NARRATOR_NAME_DEFAULT = 'System';
|
||||||
const COMMENT_NAME_DEFAULT = 'Note';
|
const COMMENT_NAME_DEFAULT = 'Note';
|
||||||
|
|
||||||
|
async function sendUserMessageCallback(_, text) {
|
||||||
|
if (!text) {
|
||||||
|
console.warn('WARN: No text provided for /send command');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
text = text.trim();
|
||||||
|
const bias = extractMessageBias(text);
|
||||||
|
sendMessageAsUser(text, bias);
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteMessagesByNameCallback(_, name) {
|
async function deleteMessagesByNameCallback(_, name) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
console.warn('WARN: No name provided for /delname command');
|
console.warn('WARN: No name provided for /delname command');
|
||||||
|
Reference in New Issue
Block a user