Get appropriate tokenizer for WAI and handle streaming rejection properly

This commit is contained in:
Cohee
2023-06-10 18:41:02 +03:00
parent ccefee6cee
commit 46c1fde423
2 changed files with 48 additions and 21 deletions

View File

@ -1775,22 +1775,22 @@ class StreamingProcessor {
await delay(1); // delay for message to be rendered
}
for await (const text of this.generator()) {
if (this.isStopped) {
this.onStopStreaming();
return;
}
try {
for await (const text of this.generator()) {
if (this.isStopped) {
this.onStopStreaming();
return;
}
try {
this.result = text;
this.onProgressStreaming(this.messageId, message_already_generated + text);
}
catch (err) {
console.error(err);
this.onErrorStreaming();
this.isStopped = true;
return;
}
}
catch (err) {
console.error(err);
this.onErrorStreaming();
this.isStopped = true;
return;
}
this.isFinished = true;
@ -6545,7 +6545,7 @@ $(document).ready(function () {
if (this_chid !== undefined || selected_group) {
// Previously system messages we're allowed to be edited
/*const message = $(this).closest(".mes");
if (message.data("isSystem")) {
return;
}*/