diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index ba8a315b1..9bef091a1 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -24,6 +24,7 @@ import { Generate, this_chid, setCharacterName, + generateRaw, } from "../script.js"; import { getMessageTimeStamp } from "./RossAscends-mods.js"; import { findGroupMemberId, groups, is_group_generating, resetSelectedGroup, saveGroupChat, selected_group } from "./group-chats.js"; @@ -160,6 +161,7 @@ parser.addCommand('peek', peekCallback, [], '(message in parser.addCommand('delswipe', deleteSwipeCallback, ['swipedel'], '(optional 1-based id) – deletes a swipe from the last chat message. If swipe id not provided - deletes the current swipe.', true, true); parser.addCommand('echo', echoCallback, [], '(text) – echoes the text to toast message. Useful for pipes debugging.', true, true); parser.addCommand('gen', generateCallback, [], '(prompt) – generates text using the provided prompt and passes it to the next command through the pipe.', true, true); +parser.addCommand('genraw', generateRawCallback, [], '(prompt) – generates text using the provided prompt and passes it to the next command through the pipe. Does not include chat history or character card.', true, true); parser.addCommand('addswipe', addSwipeCallback, ['swipeadd'], '(text) – adds a swipe to the last chat message.', true, true); registerVariableCommands(); @@ -167,6 +169,19 @@ const NARRATOR_NAME_KEY = 'narrator_name'; const NARRATOR_NAME_DEFAULT = 'System'; export const COMMENT_NAME_DEFAULT = 'Note'; +async function generateRawCallback(_, arg) { + if (!arg) { + console.warn('WARN: No argument provided for /genraw command'); + return; + } + + // Prevent generate recursion + $('#send_textarea').val(''); + + const result = await generateRaw(arg, ''); + return result; +} + async function generateCallback(_, arg) { if (!arg) { console.warn('WARN: No argument provided for /gen command');