/stop slash command to stop generation

This commit is contained in:
Wolfsblvt
2024-07-03 14:44:17 +02:00
parent 6e86ab07dd
commit 7de43d3a9c
2 changed files with 42 additions and 9 deletions

View File

@ -33,6 +33,7 @@ import {
setCharacterName,
setExtensionPrompt,
setUserName,
stopGeneration,
substituteParams,
system_avatar,
system_message_types,
@ -898,6 +899,24 @@ export function initDefaultSlashCommands() {
],
helpString: 'Adds a swipe to the last chat message.',
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'stop',
callback: () => {
const stopped = stopGeneration();
return String(stopped);
},
returns: 'true/false, whether the generation was running and got stopped',
helpString: `
<div>
Stops the generation and any streaming if it is currently running.
</div>
<div>
Note: This command cannot be executed from the chat input, as sending any message or script from there is blocked during generation.
But it can be executed via automations or QR scripts/buttons.
</div>
`,
aliases: ['generate-stop'],
}));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'abort',
callback: abortCallback,