mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add AN slash command
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import { chat_metadata, saveSettingsDebounced } from "../../../script.js";
|
import { chat_metadata, saveSettingsDebounced } from "../../../script.js";
|
||||||
import { extension_settings, getContext } from "../../extensions.js";
|
import { extension_settings, getContext } from "../../extensions.js";
|
||||||
|
import { registerSlashCommand } from "../../slash-commands.js";
|
||||||
import { debounce } from "../../utils.js";
|
import { debounce } from "../../utils.js";
|
||||||
export { MODULE_NAME };
|
export { MODULE_NAME };
|
||||||
|
|
||||||
@ -19,6 +20,10 @@ const metadata_keys = {
|
|||||||
position: 'note_position',
|
position: 'note_position',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setNoteCommand(_, text) {
|
||||||
|
$('#extension_floating_prompt').val(text).trigger('input');
|
||||||
|
}
|
||||||
|
|
||||||
async function onExtensionFloatingPromptInput() {
|
async function onExtensionFloatingPromptInput() {
|
||||||
chat_metadata[metadata_keys.prompt] = $(this).val();
|
chat_metadata[metadata_keys.prompt] = $(this).val();
|
||||||
saveMetadataDebounced();
|
saveMetadataDebounced();
|
||||||
@ -180,4 +185,5 @@ async function moduleWorker() {
|
|||||||
|
|
||||||
addExtensionsSettings();
|
addExtensionsSettings();
|
||||||
setInterval(moduleWorkerWrapper, UPDATE_INTERVAL);
|
setInterval(moduleWorkerWrapper, UPDATE_INTERVAL);
|
||||||
|
registerSlashCommand('note', setNoteCommand, [], " – sets an author's note for the currently selected chat", true, true);
|
||||||
})();
|
})();
|
@ -97,7 +97,9 @@ function executeSlashCommands(text) {
|
|||||||
return false;
|
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 = [];
|
const linesToRemove = [];
|
||||||
|
|
||||||
let interrupt = false;
|
let interrupt = false;
|
||||||
|
Reference in New Issue
Block a user