fixed encoding issues

This commit is contained in:
ParisNeo 2023-04-08 18:00:02 +02:00
parent 5684ade190
commit fb239bf4e5
3 changed files with 14 additions and 7 deletions

19
app.py
View File

@ -236,7 +236,7 @@ GPT4All:Welcome! I'm here to assist you with anything you need. What can I do fo
top_p=self.args.top_p,
repeat_penalty=self.args.repeat_penalty,
repeat_last_n = self.args.repeat_last_n,
#seed=self.args.seed,
seed=self.args.seed,
n_threads=8
)
print(f"Bot said:{self.bot_says}")
@ -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
if self.current_message in self.full_text:
self.is_bot_text_started = True
yield text
yield text.encode('utf-8').decode('latin-1')
def add_endpoint(
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)
yield self.bot_says
yield self.bot_says.encode('utf-8').decode('latin-1')
# TODO : change this to use the yield version in order to send text word by word
return "\n".join(bot_says)
@ -458,15 +458,20 @@ GPT4All:Welcome! I'm here to assist you with anything you need. What can I do fo
def update_model_params(self):
data = request.get_json()
self.args.model = float(data["model"])
self.args.model = str(data["model"])
self.args.n_predict = int(data["nPredict"])
self.args.seed = int(data["seed"])
self.args.temp = float(data["temp"])
self.args.top_k = float(data["topK"])
self.args.top_k = int(data["topK"])
self.args.top_p = float(data["topP"])
self.args.repeat_penalty = float(data["repeatPenalty"])
self.args.repeat_last_n = float(data["repeatLastN"])
self.args.repeat_penalty = int(data["repeatPenalty"])
self.args.repeat_last_n = int(data["repeatLastN"])
print("Parameters changed to:")
print(f"\tTemperature:{self.args.temp}")
print(f"\tNPredict:{self.args.n_predict}")
print(f"\tSeed:{self.args.seed}")
print(f"\top_k:{self.args.top_k}")
print(f"\top_p:{self.args.top_p}")
print(f"\trepeat_penalty:{self.args.repeat_penalty}")

View File

@ -5,6 +5,7 @@ submitButton.addEventListener('click', (event) => {
event.preventDefault();
modelInput = document.getElementById('model');
seedInput = document.getElementById('seed');
tempInput = document.getElementById('temp');
nPredictInput = document.getElementById('n-predict');

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GPT4All - WEBUI</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/chat.css') }}">
</head>