mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Multigen Psuedo streaming
This commit is contained in:
committed by
GitHub
parent
58d4752609
commit
95969f5d99
@@ -2020,6 +2020,20 @@ async function Generate(type, automatic_trigger, force_name2) {
|
|||||||
message_already_generated += getMessage;
|
message_already_generated += getMessage;
|
||||||
promptBias = '';
|
promptBias = '';
|
||||||
if (shouldContinueMultigen(getMessage)) {
|
if (shouldContinueMultigen(getMessage)) {
|
||||||
|
let this_mes_is_name;
|
||||||
|
({ this_mes_is_name, getMessage } = extractNameFromMessage(getMessage, force_name2, isImpersonate));
|
||||||
|
if (generate_loop_counter == 0)
|
||||||
|
{
|
||||||
|
console.log("New message");
|
||||||
|
({ type, getMessage } = saveReply(type, getMessage, this_mes_is_name));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log("Should append message");
|
||||||
|
({ type, getMessage } = saveReply('append', getMessage, this_mes_is_name));
|
||||||
|
}
|
||||||
|
generate_loop_counter++;
|
||||||
|
getMessage = message_already_generated;
|
||||||
runGenerate(getMessage);
|
runGenerate(getMessage);
|
||||||
console.log('returning to make generate again');
|
console.log('returning to make generate again');
|
||||||
return;
|
return;
|
||||||
@@ -2039,8 +2053,15 @@ async function Generate(type, automatic_trigger, force_name2) {
|
|||||||
$('#send_textarea').val(getMessage).trigger('input');
|
$('#send_textarea').val(getMessage).trigger('input');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!isMultigenEnabled())
|
||||||
|
{
|
||||||
({ type, getMessage } = saveReply(type, getMessage, this_mes_is_name));
|
({ type, getMessage } = saveReply(type, getMessage, this_mes_is_name));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
({ type, getMessage } = saveReply('appendFinal', getMessage, this_mes_is_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
activateSendButtons();
|
activateSendButtons();
|
||||||
playMessageSound();
|
playMessageSound();
|
||||||
generate_loop_counter = 0;
|
generate_loop_counter = 0;
|
||||||
@@ -2211,7 +2232,7 @@ function cleanUpMessage(getMessage, isImpersonate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveReply(type, getMessage, this_mes_is_name) {
|
function saveReply(type, getMessage, this_mes_is_name) {
|
||||||
if (chat.length && (chat[chat.length - 1]['swipe_id'] === undefined ||
|
if (type != 'append' && type != 'appendFinal' && chat.length && (chat[chat.length - 1]['swipe_id'] === undefined ||
|
||||||
chat[chat.length - 1]['is_user'])) {
|
chat[chat.length - 1]['is_user'])) {
|
||||||
type = 'normal';
|
type = 'normal';
|
||||||
}
|
}
|
||||||
@@ -2229,6 +2250,15 @@ function saveReply(type, getMessage, this_mes_is_name) {
|
|||||||
} else {
|
} else {
|
||||||
chat[chat.length - 1]['mes'] = getMessage;
|
chat[chat.length - 1]['mes'] = getMessage;
|
||||||
}
|
}
|
||||||
|
} else if (type === 'append') {
|
||||||
|
console.log("Trying to append.")
|
||||||
|
chat[chat.length - 1]['mes'] += getMessage;
|
||||||
|
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
|
||||||
|
} else if (type === 'appendFinal') {
|
||||||
|
console.log("Trying to append.")
|
||||||
|
chat[chat.length - 1]['mes'] = getMessage;
|
||||||
|
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('entering chat update routine for non-swipe post');
|
console.log('entering chat update routine for non-swipe post');
|
||||||
chat[chat.length] = {};
|
chat[chat.length] = {};
|
||||||
|
Reference in New Issue
Block a user