Add AN slash command

This commit is contained in:
SillyLossy
2023-05-16 17:32:24 +03:00
parent 211ad9172d
commit a9037560dc
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { chat_metadata, saveSettingsDebounced } from "../../../script.js";
import { extension_settings, getContext } from "../../extensions.js";
import { registerSlashCommand } from "../../slash-commands.js";
import { debounce } from "../../utils.js";
export { MODULE_NAME };
@ -19,6 +20,10 @@ const metadata_keys = {
position: 'note_position',
}
function setNoteCommand(_, text) {
$('#extension_floating_prompt').val(text).trigger('input');
}
async function onExtensionFloatingPromptInput() {
chat_metadata[metadata_keys.prompt] = $(this).val();
saveMetadataDebounced();
@ -180,4 +185,5 @@ async function moduleWorker() {
addExtensionsSettings();
setInterval(moduleWorkerWrapper, UPDATE_INTERVAL);
registerSlashCommand('note', setNoteCommand, [], " sets an author's note for the currently selected chat", true, true);
})();

View File

@ -97,7 +97,9 @@ function executeSlashCommands(text) {
return false;
}
const lines = text.split('\n');
// Hack to allow multi-line slash commands
// All slash command messages should begin with a slash
const lines = [text];
const linesToRemove = [];
let interrupt = false;