From 69f90a0b30d7d2f367113321a7c0f05f5230354a Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 11 Dec 2023 22:51:07 +0000 Subject: [PATCH] add /tokens slash command to call getTokenCount --- public/scripts/slash-commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 24a2382a7..1768762db 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -186,6 +186,7 @@ parser.addCommand('trimend', trimEndCallback, [], '(text parser.addCommand('inject', injectCallback, [], 'id=injectId (position=before/after/chat depth=number [text]) – injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat" (default: after). Depth: injection depth for the prompt (default: 4).', true, true); parser.addCommand('listinjects', listInjectsCallback, [], ' – lists all script injections for the current chat.', true, true); parser.addCommand('flushinjects', flushInjectsCallback, [], ' – removes all script injections for the current chat.', true, true); +parser.addCommand('tokens', (_, text) => getTokenCount(text), [], '(text) – counts the number of tokens in the text.', true, true); registerVariableCommands(); const NARRATOR_NAME_KEY = 'narrator_name';