upgraded settings saving

This commit is contained in:
Saifeddine ALOUI 2023-04-14 10:48:14 +02:00
parent 5bdb171d3a
commit 20f50d5632
5 changed files with 18 additions and 8 deletions

7
app.py
View File

@ -466,6 +466,9 @@ class Gpt4AllWebUI:
self.config['n_predict'] = int(data["nPredict"])
self.config['seed'] = int(data["seed"])
self.config['model'] = str(data["model"])
self.config['voice'] = str(data["voice"])
self.config['language'] = str(data["language"])
self.config['temp'] = float(data["temp"])
self.config['top_k'] = int(data["topK"])
@ -474,6 +477,10 @@ class Gpt4AllWebUI:
self.config['repeat_last_n'] = int(data["repeatLastN"])
print("Parameters changed to:")
print(f"\tModel:{self.config['model']}")
print(f"\tPersonality:{self.config['personality']}")
print(f"\tLanguage:{self.config['language']}")
print(f"\tVoice:{self.config['voice']}")
print(f"\tTemperature:{self.config['temp']}")
print(f"\tNPredict:{self.config['n_predict']}")
print(f"\tSeed:{self.config['seed']}")

View File

@ -14,3 +14,4 @@ db_path: "database.db"
nb_messages_to_remember: 5
personality: "gpt4all_chatbot"
language: "en_XX"
voice: ""

View File

@ -65,7 +65,7 @@ function populate_discussions_list()
//renameButton.style.backgroundImage = "/rename_discussion.svg"; //.textContent = 'Rename';
renameButton.addEventListener('click', () => {
const dialog = document.createElement('dialog');
dialog.classList.add('bg-white', 'rounded', 'p-4');
dialog.classList.add('bg-gray-500 text-white', 'rounded', 'p-4');
const inputLabel = document.createElement('label');
inputLabel.textContent = 'New name: ';

View File

@ -7,6 +7,7 @@ fetch('/settings')
modelInput = document.getElementById('model');
personalityInput = document.getElementById('personalities');
languageInput = document.getElementById('language');
voiceInput = document.getElementById('voice');
seedInput = document.getElementById('seed');
tempInput = document.getElementById('temp');
nPredictInput = document.getElementById('n-predict');
@ -56,6 +57,7 @@ fetch('/settings')
modelInput.value = data["model"]
personalityInput.value = data["personality"]
languageInput.value = data["language"]
voiceInput.value = data["voice"]
seedInput.value = data["seed"]
tempInput.value = data["temp"]
nPredictInput.value = data["n_predict"]
@ -86,8 +88,11 @@ fetch('/settings')
// Get form values and put them in an object
const formValues = {
model: modelInput.value,
seed: seedInput.value,
model: modelInput.value,
personality: personalityInput.value,
language: languageInput.value,
voice: voiceInput.value,
temp: tempInput.value,
nPredict: nPredictInput.value,
topK: topKInput.value,
@ -130,7 +135,6 @@ function populate_models(){
.then(data => {
if (Array.isArray(data)) {
// data is an array
const selectElement = document.getElementById('model');
data.forEach(filename => {
const optionElement = document.createElement('option');
optionElement.value = filename;
@ -197,6 +201,3 @@ function populate_models(){
});
}
populate_models()

View File

@ -35,6 +35,7 @@ fetch('/main')
prepre_audio();
add_audio_in_ui();
populateVoicesList();
populate_models()
})
.catch(error => {