mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
bugfix: the wait animation is back
This commit is contained in:
parent
452b8d909c
commit
96bae50151
10
.gitignore
vendored
10
.gitignore
vendored
@ -142,5 +142,11 @@ models/
|
||||
# Temporary files
|
||||
tmp/
|
||||
|
||||
#
|
||||
llama.cpp
|
||||
# configurations other than the default one
|
||||
configs/*
|
||||
!configs/default.yaml
|
||||
|
||||
# personalities other than the default one
|
||||
personalities/*
|
||||
!personalities/gpt4all_chatbot.yaml
|
||||
|
||||
|
13
app.py
13
app.py
@ -40,6 +40,7 @@ class Gpt4AllWebUI:
|
||||
self.config = config
|
||||
self.personality = personality
|
||||
self.current_discussion = None
|
||||
self.current_message_id = 0
|
||||
self.app = _app
|
||||
self.db_path = config["db_path"]
|
||||
self.db = DiscussionsDB(self.db_path)
|
||||
@ -152,8 +153,13 @@ class Gpt4AllWebUI:
|
||||
self.current_discussion = self.db.load_last_discussion()
|
||||
|
||||
message_id = self.current_discussion.add_message(
|
||||
"conditionner", conditionning_message, DiscussionsDB.MSG_TYPE_CONDITIONNING,0
|
||||
"conditionner", conditionning_message, DiscussionsDB.MSG_TYPE_CONDITIONNING,0,self.current_message_id
|
||||
)
|
||||
if self.personality["welcome_message"]!="":
|
||||
message_id = self.current_discussion.add_message(
|
||||
"gpt4all", self.personality["welcome_message"], DiscussionsDB.MSG_TYPE_CONDITIONNING,0,self.current_message_id
|
||||
)
|
||||
|
||||
return message_id
|
||||
|
||||
def prepare_query(self):
|
||||
@ -255,7 +261,7 @@ class Gpt4AllWebUI:
|
||||
self.full_message_list.append(self.current_message)
|
||||
|
||||
if len(self.full_message_list) > self.config["nb_messages_to_remember"]:
|
||||
self.prompt_message = [self.config["personality_conditionning"]]+ '\n'.join(self.full_message_list[-self.config["nb_messages_to_remember"]:])
|
||||
self.prompt_message = [self.personality["personality_conditionning"]]+ '\n'.join(self.full_message_list[-self.config["nb_messages_to_remember"]:])
|
||||
else:
|
||||
self.prompt_message = self.full_message
|
||||
self.prepare_query()
|
||||
@ -340,6 +346,7 @@ class Gpt4AllWebUI:
|
||||
for message in messages:
|
||||
self.full_message += message['sender'] + ": " + message['content'] + "\n"
|
||||
self.full_message_list.append(message['sender'] + ": " + message['content'])
|
||||
self.current_message_id=message['id']
|
||||
app.config['executor'].submit(self.restore_discussion, self.full_message)
|
||||
|
||||
return jsonify(messages)
|
||||
@ -385,7 +392,7 @@ class Gpt4AllWebUI:
|
||||
self.full_message =""
|
||||
|
||||
# Return a success response
|
||||
return json.dumps({"id": self.current_discussion.discussion_id, "time": timestamp})
|
||||
return json.dumps({"id": self.current_discussion.discussion_id, "time": timestamp, "welcome_message":self.personality["welcome_message"]})
|
||||
|
||||
def update_model_params(self):
|
||||
data = request.get_json()
|
||||
|
1
db.py
1
db.py
@ -155,6 +155,7 @@ class DiscussionsDB:
|
||||
last_discussion_id = self.create_discussion()
|
||||
else:
|
||||
last_discussion_id=last_discussion_id[0]
|
||||
self.current_message_id = self.select("SELECT id FROM message WHERE discussion_id=? ORDER BY id DESC LIMIT 1", (last_discussion_id,), fetch_all=False)
|
||||
return Discussion(last_discussion_id, self)
|
||||
|
||||
def create_discussion(self, title="untitled"):
|
||||
|
@ -4,14 +4,17 @@
|
||||
# An NLP needs conditionning to instruct it to be whatever we want it to be.
|
||||
# This file is used by the GPT4All web ui to condition the personality of the model you are
|
||||
# talking to.
|
||||
|
||||
# Language (see the list of supported languages here : https://github.com/ParisNeo/GPT4All_Personalities/blob/main/README.md)
|
||||
language: "en_XX"
|
||||
# Category
|
||||
category: "General"
|
||||
# Personality description:
|
||||
personality_description: |
|
||||
This personality is a helpful and Kind AI ready to help you solve your problems
|
||||
# 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.
|
||||
gpt4all:Welcome! I'm here to assist you with anything you need. What can I do for you today?
|
||||
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: "\nuser:"
|
||||
# This suffix is added at the end of any message input by the user
|
||||
|
@ -1,3 +1,41 @@
|
||||
/* Wait animation */
|
||||
.lds-facebook {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
.lds-facebook div {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
width: 8px;
|
||||
background: #fff;
|
||||
animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
|
||||
}
|
||||
.lds-facebook div:nth-child(1) {
|
||||
left: 4px;
|
||||
animation-delay: -0.24s;
|
||||
}
|
||||
.lds-facebook div:nth-child(2) {
|
||||
left: 16px;
|
||||
animation-delay: -0.12s;
|
||||
}
|
||||
.lds-facebook div:nth-child(3) {
|
||||
left: 28px;
|
||||
animation-delay: 0;
|
||||
}
|
||||
@keyframes lds-facebook {
|
||||
0% {
|
||||
top: 8px;
|
||||
height: 34px;
|
||||
}
|
||||
50%, 100% {
|
||||
top: 12px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
:root {
|
||||
--color-primary-light: #ffffff;
|
||||
--color-secondary-light: #f2f2f2;
|
||||
|
@ -215,11 +215,12 @@ newDiscussionBtn.addEventListener('click', () => {
|
||||
fetch(`/new_discussion?title=${discussionName}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(`New chat ${data}`)
|
||||
console.log(`New chat ${data.welcome_message}`)
|
||||
// Select the new discussion
|
||||
//selectDiscussion(discussionId);
|
||||
chatWindow.innerHTML=""
|
||||
addMessage("GPT4ALL", welcome_message,0);
|
||||
addMessage("GPT4ALL", data.welcome_message,0);
|
||||
|
||||
populate_discussions_list()
|
||||
sendbtn.style.display="block";
|
||||
waitAnimation.style.display="none";
|
||||
|
Loading…
Reference in New Issue
Block a user