more bugfixes

This commit is contained in:
Saifeddine ALOUI 2023-04-18 00:10:13 +02:00
parent 5e6383fb81
commit 714b4d6bb3
2 changed files with 21 additions and 13 deletions

2
app.py
View File

@ -252,7 +252,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
def run_to(self):
data = request.get_json()
message_id = data["id"]
message_id = int(data["id"])
self.stop = True
# Segmented (the user receives the output as it comes)
# We will first send a json entry that contains the message id and so on, then the text as it goes

View File

@ -146,19 +146,27 @@ function addMessage(sender, message, id, rank = 0, can_edit = false) {
entry_counter++;
}
else {
// For the other enrtries, these are just the text of the chatbot
for (const char of text) {
txt = hiddenElement_.innerHTML;
if (char != '\f') {
txt += char
hiddenElement_.innerHTML = txt
messageTextElement_.innerHTML = txt
}
// scroll to bottom of chat window
chatWindow.scrollTop = chatWindow.scrollHeight;
}
entry_counter++;
prefix = "FINAL:";
if(text.startsWith(prefix)){
text = text.substring(prefix.length);
hiddenElement.innerHTML = text
messageTextElement.innerHTML = text
}
else{
// For the other enrtries, these are just the text of the chatbot
for (const char of text) {
txt = hiddenElement_.innerHTML;
if (char != '\f') {
txt += char
hiddenElement_.innerHTML = txt
messageTextElement_.innerHTML = txt
}
// scroll to bottom of chat window
chatWindow.scrollTop = chatWindow.scrollHeight;
}
}
}
readStream();