mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'main' into dev
This commit is contained in:
@ -1230,6 +1230,7 @@ class StreamingProcessor {
|
|||||||
let formattedText = messageFormating(processedText, chat[messageId].name, chat[messageId].is_system, chat[messageId].force_avatar);
|
let formattedText = messageFormating(processedText, chat[messageId].name, chat[messageId].is_system, chat[messageId].force_avatar);
|
||||||
const mesText = $(`#chat .mes[mesid="${messageId}"] .mes_text`);
|
const mesText = $(`#chat .mes[mesid="${messageId}"] .mes_text`);
|
||||||
mesText.html(formattedText);
|
mesText.html(formattedText);
|
||||||
|
this.setFirstSwipe(messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollChatToBottom();
|
scrollChatToBottom();
|
||||||
@ -1256,6 +1257,14 @@ class StreamingProcessor {
|
|||||||
showSwipeButtons();
|
showSwipeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFirstSwipe(messageId) {
|
||||||
|
if (this.type !== 'swipe' && this.type !== 'impersonate') {
|
||||||
|
if (chat[messageId]['swipes'].length === 1 && chat[messageId]['swipe_id'] === 0) {
|
||||||
|
chat[messageId]['swipes'][0] = chat[messageId]['mes'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onStopStreaming() {
|
onStopStreaming() {
|
||||||
this.onErrorStreaming();
|
this.onErrorStreaming();
|
||||||
}
|
}
|
||||||
@ -1273,11 +1282,12 @@ class StreamingProcessor {
|
|||||||
this.isFinished = false;
|
this.isFinished = false;
|
||||||
this.generator = this.nullStreamingGeneration;
|
this.generator = this.nullStreamingGeneration;
|
||||||
this.abortController = new AbortController();
|
this.abortController = new AbortController();
|
||||||
|
this.firstMessageText = '...';
|
||||||
}
|
}
|
||||||
|
|
||||||
async generate() {
|
async generate() {
|
||||||
if (this.messageId == -1) {
|
if (this.messageId == -1) {
|
||||||
this.messageId = this.onStartStreaming('...');
|
this.messageId = this.onStartStreaming(this.firstMessageText);
|
||||||
await delay(1); // delay for message to be rendered
|
await delay(1); // delay for message to be rendered
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,6 +1336,7 @@ async function Generate(type, automatic_trigger, force_name2) {
|
|||||||
|
|
||||||
if (isStreamingEnabled()) {
|
if (isStreamingEnabled()) {
|
||||||
streamingProcessor = new StreamingProcessor(type, force_name2);
|
streamingProcessor = new StreamingProcessor(type, force_name2);
|
||||||
|
hideSwipeButtons();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
streamingProcessor = false;
|
streamingProcessor = false;
|
||||||
|
Reference in New Issue
Block a user