mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Translate impersonate and streaming responses. 4-state auto-mode for translation
This commit is contained in:
@ -4,6 +4,8 @@ import {
|
||||
chat,
|
||||
chat_metadata,
|
||||
default_avatar,
|
||||
eventSource,
|
||||
event_types,
|
||||
extractMessageBias,
|
||||
getThumbnailUrl,
|
||||
replaceBiasMarkup,
|
||||
@ -31,7 +33,7 @@ class SlashCommandParser {
|
||||
if ([command, ...aliases].some(x => this.commands.hasOwnProperty(x))) {
|
||||
console.trace('WARN: Duplicate slash command registered!');
|
||||
}
|
||||
|
||||
|
||||
this.commands[command] = fnObj;
|
||||
|
||||
if (Array.isArray(aliases)) {
|
||||
@ -105,7 +107,7 @@ function setNarratorName(_, text) {
|
||||
saveChatConditional();
|
||||
}
|
||||
|
||||
function sendMessageAs(_, text) {
|
||||
async function sendMessageAs(_, text) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
@ -151,10 +153,11 @@ function sendMessageAs(_, text) {
|
||||
|
||||
chat.push(message);
|
||||
addOneMessage(message);
|
||||
await eventSource.emit(event_types.MESSAGE_SENT, (chat.length - 1));
|
||||
saveChatConditional();
|
||||
}
|
||||
|
||||
function sendNarratorMessage(_, text) {
|
||||
async function sendNarratorMessage(_, text) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
@ -180,6 +183,7 @@ function sendNarratorMessage(_, text) {
|
||||
|
||||
chat.push(message);
|
||||
addOneMessage(message);
|
||||
await eventSource.emit(event_types.MESSAGE_SENT, (chat.length - 1));
|
||||
saveChatConditional();
|
||||
}
|
||||
|
||||
@ -238,4 +242,4 @@ function executeSlashCommands(text) {
|
||||
const newText = lines.filter(x => linesToRemove.indexOf(x) === -1).join('\n');
|
||||
|
||||
return { interrupt, newText };
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user