add /impersonate (aka /imp)

This commit is contained in:
RossAscends
2023-07-13 16:12:49 +09:00
parent be91af30b8
commit ff8c9546ad

View File

@@ -3223,7 +3223,7 @@ function promptItemize(itemizedPrompts, requestedMesId) {
var storyStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].storyString) - worldInfoStringTokens; var storyStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].storyString) - worldInfoStringTokens;
var examplesStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].examplesString); var examplesStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].examplesString);
var mesSendStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].mesSendString) var mesSendStringTokens = getTokenCount(itemizedPrompts[thisPromptSet].mesSendString)
var ActualChatHistoryTokens = mesSendStringTokens - (allAnchorsTokens - afterScenarioAnchorTokens) + power_user.token_padding; var ActualChatHistoryTokens = mesSendStringTokens - (allAnchorsTokens - afterScenarioAnchorTokens) + power_user.token_padding;
var instructionTokens = getTokenCount(itemizedPrompts[thisPromptSet].instruction); var instructionTokens = getTokenCount(itemizedPrompts[thisPromptSet].instruction);
var totalTokensInPrompt = var totalTokensInPrompt =
@@ -6786,6 +6786,11 @@ async function importFromURL(items, files) {
} }
} }
async function doImpersonate() {
$('#send_textarea').val('');
$("#option_impersonate").trigger('click', { fromSlashCommand: true })
}
const isPwaMode = window.navigator.standalone; const isPwaMode = window.navigator.standalone;
if (isPwaMode) { $("body").addClass('PWA') } if (isPwaMode) { $("body").addClass('PWA') }
@@ -6800,6 +6805,8 @@ $(document).ready(function () {
registerSlashCommand('dupe', DupeChar, [], " duplicates the currently selected character", true, true); registerSlashCommand('dupe', DupeChar, [], " duplicates the currently selected character", true, true);
registerSlashCommand('api', connectAPISlash, [], "(kobold, horde, novel, ooba, oai, claude, poe, windowai) connect to an API", true, true); registerSlashCommand('api', connectAPISlash, [], "(kobold, horde, novel, ooba, oai, claude, poe, windowai) connect to an API", true, true);
registerSlashCommand('impersonate', doImpersonate, ['imp'], "- calls an impersonation response", true, true);
setTimeout(function () { setTimeout(function () {
$("#groupControlsToggle").trigger('click'); $("#groupControlsToggle").trigger('click');
@@ -7531,7 +7538,7 @@ $(document).ready(function () {
} }
else if (id == "option_impersonate") { else if (id == "option_impersonate") {
if (is_send_press == false) { if (is_send_press == false || fromSlashCommand) {
is_send_press = true; is_send_press = true;
Generate("impersonate"); Generate("impersonate");
} }