mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
bugfixed
This commit is contained in:
parent
d5d9a0f01e
commit
2dd7793394
10
app.py
10
app.py
@ -25,7 +25,6 @@ from flask import (
|
||||
stream_with_context,
|
||||
send_from_directory
|
||||
)
|
||||
from queue import Queue
|
||||
from pathlib import Path
|
||||
import gc
|
||||
app = Flask("GPT4All-WebUI", static_url_path="/static", static_folder="static")
|
||||
@ -209,12 +208,13 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
||||
self.prepare_reception()
|
||||
self.generating = True
|
||||
app.config['executor'].submit(self.generate_message)
|
||||
while self.generating or not self.text_queue.empty():
|
||||
while self.generating:
|
||||
try:
|
||||
value = self.text_queue.get(False)
|
||||
yield value
|
||||
while not self.text_queue.empty():
|
||||
value = self.text_queue.get(False)
|
||||
yield value
|
||||
except :
|
||||
time.sleep(1)
|
||||
time.sleep(0.1)
|
||||
|
||||
self.current_discussion.update_message(response_id, self.bot_says)
|
||||
self.full_message_list.append(self.bot_says)
|
||||
|
@ -21,16 +21,19 @@ personality_description: |
|
||||
|
||||
# The conditionning instructions sent to eh model at the start of the discussion
|
||||
personality_conditionning: |
|
||||
Instruction: Act as gpt4all. A kind and helpful AI bot built to help users solve problems.
|
||||
The following is a discussion between a very advanced chatbot AI and a user. The AI is called GPT4All. It is a kind and helpful AI bot built by Nomic-AI to help users perform tasks.
|
||||
|
||||
#Welcome message to be sent to the user when a new discussion is started
|
||||
welcome_message: "Welcome! I am GPT4All A free and open discussion AI. What can I do for you today?"
|
||||
|
||||
# This prefix is added at the beginning of any message input by the user
|
||||
message_prefix: "user: "
|
||||
user_message_prefix: "user: "
|
||||
|
||||
# This suffix is added at the end of any message input by the user
|
||||
message_suffix: "\ngpt4all: "
|
||||
# Should be true for discussion mode
|
||||
add_automatic_return: true
|
||||
|
||||
# This prefix is added at the beginning of any message output by the ai
|
||||
ai_message_prefix: "gpt4all: "
|
||||
|
||||
# Here is the list of extensions this personality requires
|
||||
dependencies: []
|
||||
|
@ -122,8 +122,11 @@ class GPT4AllAPI():
|
||||
if message["sender"]==self.personality["name"]:
|
||||
self.full_message_list.append(message["content"])
|
||||
else:
|
||||
self.full_message_list.append(self.personality["message_prefix"] + message["content"] + self.personality["message_suffix"])
|
||||
|
||||
if self.personality["add_automatic_return"]:
|
||||
self.full_message_list.append(self.personality["user_message_prefix"] + message["content"] + "\n" + self.personality["ai_message_prefix"])
|
||||
else:
|
||||
self.full_message_list.append(self.personality["user_message_prefix"] + message["content"] + self.personality["ai_message_prefix"])
|
||||
|
||||
if len(self.full_message_list) > self.config["nb_messages_to_remember"]:
|
||||
discussion_messages = self.personality["personality_conditionning"]+ '\n'.join(self.full_message_list[-self.config["nb_messages_to_remember"]:])
|
||||
else:
|
||||
|
@ -17,6 +17,10 @@ function update_main(){
|
||||
sendbtn.style.display="none";
|
||||
waitAnimation.style.display="block";
|
||||
console.log("Sending message to bot")
|
||||
|
||||
let hiddenElement = undefined
|
||||
let messageTextElement = undefined
|
||||
|
||||
fetch('/bot', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -66,9 +70,11 @@ function update_main(){
|
||||
entry_counter ++;
|
||||
}
|
||||
else{
|
||||
entry_counter ++;
|
||||
// For the other enrtries, these are just the text of the chatbot
|
||||
for (const char of text) {
|
||||
txt = hiddenElement.innerHTML;
|
||||
console.log(txt)
|
||||
if (char != '\f') {
|
||||
txt += char
|
||||
hiddenElement.innerHTML = txt
|
||||
@ -78,7 +84,6 @@ function update_main(){
|
||||
// scroll to bottom of chat window
|
||||
chatWindow.scrollTop = chatWindow.scrollHeight;
|
||||
}
|
||||
entry_counter ++;
|
||||
}
|
||||
|
||||
readStream();
|
||||
|
Loading…
Reference in New Issue
Block a user