This commit is contained in:
Saifeddine ALOUI 2023-04-17 12:54:48 +02:00
parent 71150f1e34
commit 5c34595fb0
2 changed files with 19 additions and 10 deletions

2
app.py
View File

@ -221,7 +221,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
self.full_message_list.append(self.bot_says)
bot_says = markdown.markdown(self.bot_says)
yield bot_says
yield "FINAL:"+bot_says
return bot_says
def bot(self):

View File

@ -71,17 +71,26 @@ function update_main(){
}
else{
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;
txt = hiddenElement.innerHTML;
if (char != '\f') {
txt += char
hiddenElement.innerHTML = txt
messageTextElement.innerHTML = txt
}
// scroll to bottom of chat window
chatWindow.scrollTop = chatWindow.scrollHeight;
}
}
}