repared encoding issue fix 2

This commit is contained in:
ParisNeo 2023-04-08 18:24:43 +02:00
parent fb239bf4e5
commit 19c584010f
2 changed files with 5 additions and 2 deletions

4
app.py
View File

@ -267,7 +267,7 @@ GPT4All:Welcome! I'm here to assist you with anything you need. What can I do fo
self.bot_says += text self.bot_says += text
if self.current_message in self.full_text: if self.current_message in self.full_text:
self.is_bot_text_started = True self.is_bot_text_started = True
yield text.encode('utf-8').decode('latin-1') yield text# .encode('utf-8').decode('utf-8')
def add_endpoint( def add_endpoint(
self, self,
@ -339,7 +339,7 @@ GPT4All:Welcome! I'm here to assist you with anything you need. What can I do fo
) )
self.current_discussion.update_message(response_id, self.bot_says) self.current_discussion.update_message(response_id, self.bot_says)
yield self.bot_says.encode('utf-8').decode('latin-1') yield self.bot_says# .encode('utf-8').decode('utf-8')
# TODO : change this to use the yield version in order to send text word by word # TODO : change this to use the yield version in order to send text word by word
return "\n".join(bot_says) return "\n".join(bot_says)

View File

@ -118,6 +118,8 @@ function addMessage(sender, message, id, can_edit=false) {
inputField.classList.add('font-medium', 'text-md', 'border', 'border-gray-300', 'p-1'); inputField.classList.add('font-medium', 'text-md', 'border', 'border-gray-300', 'p-1');
inputField.value = messageTextElement.innerHTML; inputField.value = messageTextElement.innerHTML;
editButton.style.display="none"
const saveButton = document.createElement('button'); const saveButton = document.createElement('button');
saveButton.classList.add('bg-green-500', 'hover:bg-green-700', 'text-white', 'font-bold', 'py-2', 'px-4', 'rounded', 'my-2', 'ml-2'); saveButton.classList.add('bg-green-500', 'hover:bg-green-700', 'text-white', 'font-bold', 'py-2', 'px-4', 'rounded', 'my-2', 'ml-2');
saveButton.innerHTML = 'Save'; saveButton.innerHTML = 'Save';
@ -138,6 +140,7 @@ function addMessage(sender, message, id, can_edit=false) {
.catch(error => { .catch(error => {
console.error('There was a problem updating the message:', error); console.error('There was a problem updating the message:', error);
}); });
editButton.style.display="block"
messageElement.replaceChild(messageTextElement, inputField); messageElement.replaceChild(messageTextElement, inputField);
//messageElement.removeChild(inputField); //messageElement.removeChild(inputField);
messageElement.removeChild(saveButton); messageElement.removeChild(saveButton);