mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-29 15:44:12 +00:00
upgraded code
This commit is contained in:
parent
fc7c87c376
commit
08b8221e7e
16
app.py
16
app.py
@ -69,6 +69,7 @@ class Gpt4AllWebUI:
|
||||
"/new_discussion", "new_discussion", self.new_discussion, methods=["GET"]
|
||||
)
|
||||
self.add_endpoint("/bot", "bot", self.bot, methods=["POST"])
|
||||
self.add_endpoint("/run_to", "run_to", self.run_to, methods=["POST"])
|
||||
self.add_endpoint("/rename", "rename", self.rename, methods=["POST"])
|
||||
self.add_endpoint(
|
||||
"/load_discussion", "load_discussion", self.load_discussion, methods=["POST"]
|
||||
@ -311,6 +312,21 @@ class Gpt4AllWebUI:
|
||||
self.parse_to_prompt_stream(message, message_id)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def run_to(self):
|
||||
data = request.get_json()
|
||||
message_id = 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
|
||||
return Response(
|
||||
stream_with_context(
|
||||
self.parse_to_prompt_stream(message, message_id)
|
||||
)
|
||||
)
|
||||
|
||||
def rename(self):
|
||||
data = request.get_json()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 30 KiB |
@ -37,7 +37,27 @@ function addMessage(sender, message, id, rank=0, can_edit=false) {
|
||||
// Set the width and height of the container to 100%
|
||||
buttonsContainer.style.width = '100%';
|
||||
buttonsContainer.style.height = '100%';
|
||||
|
||||
|
||||
const resendButton = document.createElement('button');
|
||||
resendButton.classList.add('bg-green-500', 'hover:bg-green-700', 'text-white', 'font-bold', 'py-0', 'px-0', 'rounded',"w-10","h-10");
|
||||
resendButton.style.float = 'right'; // set the float property to right
|
||||
resendButton.style.display='inline-block'
|
||||
resendButton.innerHTML = '';
|
||||
const resendImg = document.createElement('img');
|
||||
resendImg.src = "/static/images/refresh.png";
|
||||
resendImg.classList.add('py-1', 'px-1', 'rounded', 'w-10', 'h-10');
|
||||
resendButton.appendChild(resendImg)
|
||||
rank_up.addEventListener('click', () => {
|
||||
const url = `/message_rank_up?id=${id}`;
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem updating the message:', error);
|
||||
});
|
||||
});
|
||||
|
||||
const editButton = document.createElement('button');
|
||||
editButton.classList.add('bg-green-500', 'hover:bg-green-700', 'text-white', 'font-bold', 'py-0', 'px-0', 'rounded',"w-10","h-10");
|
||||
editButton.style.float = 'right'; // set the float property to right
|
||||
@ -195,8 +215,8 @@ function addMessage(sender, message, id, rank=0, can_edit=false) {
|
||||
console.error('There was a problem updating the message:', error);
|
||||
});
|
||||
});
|
||||
|
||||
buttonsContainer.appendChild(editButton);
|
||||
buttonsContainer.appendChild(resendButton);
|
||||
buttonsContainer.appendChild(deleteButton);
|
||||
|
||||
buttonsContainer.appendChild(rank_up);
|
||||
|
Loading…
x
Reference in New Issue
Block a user