mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
pyllamacpp version 2.1.1
This commit is contained in:
parent
221f270763
commit
42da16a0ca
5
.gitignore
vendored
5
.gitignore
vendored
@ -158,3 +158,8 @@ databases/*
|
|||||||
# extensions
|
# extensions
|
||||||
extensions/
|
extensions/
|
||||||
!extensions/.keep
|
!extensions/.keep
|
||||||
|
|
||||||
|
# backends
|
||||||
|
backends/
|
||||||
|
!backends/llama_cpp
|
||||||
|
!backends/__init__.py
|
1
app.py
1
app.py
@ -337,6 +337,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
print()
|
print()
|
||||||
print("## Done ##")
|
print("## Done ##")
|
||||||
print()
|
print()
|
||||||
|
self.cancel_gen = False
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ personality_description: |
|
|||||||
|
|
||||||
# The conditionning instructions sent to eh model at the start of the discussion
|
# The conditionning instructions sent to eh model at the start of the discussion
|
||||||
personality_conditioning: |
|
personality_conditioning: |
|
||||||
##Instructions:GPT4All is a smart and helpful Assistant built by Nomic-AI. It can discuss with humans and assist them.
|
##Instructions:\nGPT4All is a smart and helpful Assistant built by Nomic-AI. It can discuss with humans and assist them.
|
||||||
|
|
||||||
#Welcome message to be sent to the user when a new discussion is started
|
#Welcome message to be sent to the user when a new discussion is started
|
||||||
welcome_message: "Welcome! I am GPT4All A free and open assistant. What can I do for you today?"
|
welcome_message: "Welcome! I am GPT4All A free and open assistant. What can I do for you today?"
|
||||||
|
|
||||||
# This prefix is added at the beginning of any message input by the user
|
# This prefix is added at the beginning of any message input by the user
|
||||||
user_message_prefix: "##Human:"
|
user_message_prefix: "##Human:\n"
|
||||||
|
|
||||||
# A text to put between user and chatbot messages
|
# A text to put between user and chatbot messages
|
||||||
link_text: "\n"
|
link_text: "\n"
|
||||||
|
|
||||||
# This prefix is added at the beginning of any message output by the ai
|
# This prefix is added at the beginning of any message output by the ai
|
||||||
ai_message_prefix: "##Assistant:"
|
ai_message_prefix: "##Assistant:\n"
|
||||||
|
|
||||||
# Here is the list of extensions this personality requires
|
# Here is the list of extensions this personality requires
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
@ -181,6 +181,7 @@ class GPT4AllAPI():
|
|||||||
self.socketio.emit('message', {'data': self.bot_says});
|
self.socketio.emit('message', {'data': self.bot_says});
|
||||||
if self.cancel_gen:
|
if self.cancel_gen:
|
||||||
print("Generation canceled")
|
print("Generation canceled")
|
||||||
|
self.cancel_gen = False
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
@ -90,9 +90,7 @@ function addMessage(sender, message, id, rank = 0, can_edit = false) {
|
|||||||
globals.user_msg = undefined
|
globals.user_msg = undefined
|
||||||
// scroll to bottom of chat window
|
// scroll to bottom of chat window
|
||||||
chatWindow.scrollTop = chatWindow.scrollHeight;
|
chatWindow.scrollTop = chatWindow.scrollHeight;
|
||||||
send_message('generate_msg_from',{prompt: message, id: messageElement.id})
|
send_message('generate_msg_from',{prompt: message, id: messageElement.id})
|
||||||
entry_counter = 0;
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,71 +1,3 @@
|
|||||||
var globals={
|
|
||||||
is_generating:false,
|
|
||||||
chatWindow:undefined,
|
|
||||||
chatForm:undefined,
|
|
||||||
userInput:undefined,
|
|
||||||
stopGeneration:undefined,
|
|
||||||
sendbtn:undefined,
|
|
||||||
waitAnimation:undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
function send_message(service_name, parameters){
|
|
||||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
|
||||||
globals.socket = socket
|
|
||||||
globals.is_generating = false
|
|
||||||
socket.on('connect', function() {
|
|
||||||
entry_counter = 0;
|
|
||||||
if(globals.is_generating){
|
|
||||||
globals.socket.disconnect()
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
globals.socket.emit(service_name, parameters);
|
|
||||||
globals.is_generating = true
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
socket.on('disconnect', function() {
|
|
||||||
console.log("disconnected")
|
|
||||||
entry_counter = 0;
|
|
||||||
console.log("Disconnected")
|
|
||||||
globals.sendbtn.style.display="block";
|
|
||||||
globals.waitAnimation.style.display="none";
|
|
||||||
globals.stopGeneration.style.display = "none";
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
socket.on('infos', function(msg) {
|
|
||||||
if(globals.user_msg){
|
|
||||||
globals.user_msg.setSender(msg.user);
|
|
||||||
globals.user_msg.setMessage(msg.message);
|
|
||||||
globals.user_msg.setID(msg.id);
|
|
||||||
}
|
|
||||||
globals.bot_msg.setSender(msg.bot);
|
|
||||||
globals.bot_msg.setID(msg.response_id);
|
|
||||||
globals.bot_msg.messageTextElement.innerHTML = `Generating answer. Please stand by...`;
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('waiter', function(msg) {
|
|
||||||
globals.bot_msg.messageTextElement.innerHTML = `Generating answer. Please stand by...`;
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('message', function(msg) {
|
|
||||||
text = msg.data;
|
|
||||||
// For the other enrtries, these are just the text of the chatbot
|
|
||||||
|
|
||||||
globals.bot_msg.messageTextElement.innerHTML = marked.marked(text);
|
|
||||||
// scroll to bottom of chat window
|
|
||||||
globals.chatWindow.scrollTop = globals.chatWindow.scrollHeight;
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('final',function(msg){
|
|
||||||
text = msg.data;
|
|
||||||
globals.bot_msg.hiddenElement.innerHTML = text
|
|
||||||
globals.bot_msg.messageTextElement.innerHTML = marked.marked(text)
|
|
||||||
socket.disconnect()
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_main(){
|
function update_main(){
|
||||||
globals.chatWindow = document.getElementById('chat-window');
|
globals.chatWindow = document.getElementById('chat-window');
|
||||||
globals.chatForm = document.getElementById('chat-form');
|
globals.chatForm = document.getElementById('chat-form');
|
||||||
@ -81,7 +13,7 @@ function update_main(){
|
|||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
socket.disconnect()
|
globals.is_generating = true
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -103,7 +35,6 @@ function update_main(){
|
|||||||
// scroll to bottom of chat window
|
// scroll to bottom of chat window
|
||||||
globals.chatWindow.scrollTop = globals.chatWindow.scrollHeight;
|
globals.chatWindow.scrollTop = globals.chatWindow.scrollHeight;
|
||||||
|
|
||||||
entry_counter = 0;
|
|
||||||
send_message('generate_msg',{prompt: message})
|
send_message('generate_msg',{prompt: message})
|
||||||
|
|
||||||
|
|
||||||
|
66
static/js/websocket.js
Normal file
66
static/js/websocket.js
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Project : GPT4ALL-ui
|
||||||
|
// Author : ParisNeo
|
||||||
|
// Description :
|
||||||
|
// All websocket stuff can be found here.
|
||||||
|
|
||||||
|
|
||||||
|
var globals={
|
||||||
|
is_generating:false,
|
||||||
|
chatWindow:undefined,
|
||||||
|
chatForm:undefined,
|
||||||
|
userInput:undefined,
|
||||||
|
stopGeneration:undefined,
|
||||||
|
sendbtn:undefined,
|
||||||
|
waitAnimation:undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||||
|
|
||||||
|
socket.on('connect', function() {
|
||||||
|
});
|
||||||
|
socket.on('disconnect', function() {
|
||||||
|
console.log("Disconnected")
|
||||||
|
});
|
||||||
|
socket.on('infos', function(msg) {
|
||||||
|
if(globals.user_msg){
|
||||||
|
globals.user_msg.setSender(msg.user);
|
||||||
|
globals.user_msg.setMessage(msg.message);
|
||||||
|
globals.user_msg.setID(msg.id);
|
||||||
|
}
|
||||||
|
globals.bot_msg.setSender(msg.bot);
|
||||||
|
globals.bot_msg.setID(msg.response_id);
|
||||||
|
globals.bot_msg.messageTextElement.innerHTML = `Generating answer. Please stand by...`;
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('waiter', function(msg) {
|
||||||
|
globals.bot_msg.messageTextElement.innerHTML = `Generating answer. Please stand by...`;
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('message', function(msg) {
|
||||||
|
text = msg.data;
|
||||||
|
// For the other enrtries, these are just the text of the chatbot
|
||||||
|
|
||||||
|
globals.bot_msg.messageTextElement.innerHTML = marked.marked(text);
|
||||||
|
// scroll to bottom of chat window
|
||||||
|
globals.chatWindow.scrollTop = globals.chatWindow.scrollHeight;
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('final',function(msg){
|
||||||
|
text = msg.data;
|
||||||
|
globals.bot_msg.hiddenElement.innerHTML = text
|
||||||
|
globals.bot_msg.messageTextElement.innerHTML = marked.marked(text)
|
||||||
|
globals.sendbtn.style.display="block";
|
||||||
|
globals.waitAnimation.style.display="none";
|
||||||
|
globals.stopGeneration.style.display = "none";
|
||||||
|
globals.is_generating = false
|
||||||
|
});
|
||||||
|
|
||||||
|
globals.socket = socket
|
||||||
|
globals.is_generating = false
|
||||||
|
|
||||||
|
function send_message(service_name, parameters){
|
||||||
|
if(!globals.is_generating){
|
||||||
|
globals.socket.emit(service_name, parameters);
|
||||||
|
globals.is_generating = true
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@
|
|||||||
<footer class="border-t border-accent flex">
|
<footer class="border-t border-accent flex">
|
||||||
</footer>
|
</footer>
|
||||||
<script src="{{ url_for('static', filename='js/socket.io.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/socket.io.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/websocket.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/chat.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/chat.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/marked.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/marked.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/discussions.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/discussions.js') }}"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user