few bugfixes

This commit is contained in:
ParisNeo 2023-05-14 01:27:19 +02:00
parent 9ae625b10d
commit ec61eff14c
3 changed files with 7 additions and 15 deletions

4
app.py
View File

@ -302,7 +302,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
print("New backend selected")
self.config["backend"]=data['setting_value']
backend_, model_ =self.process.rebuild_model(self.config)
backend_ =self.process.rebuild_backend(self.config)
models = backend_.list_models(self.config)
if len(models)>0:
self.backend = backend_
@ -589,7 +589,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
save_config(self.config, self.config_file_path)
self.process.set_config(self.config)
self.backend, self.model = self.process.rebuild_model()
self.backend = self.process.rebuild_backend()
print("==============================================")
print("Parameters changed to:")

View File

@ -84,23 +84,15 @@ class ModelProcess:
def clear_queue(self):
self.clear_queue_queue.put(('clear_queue',))
def rebuild_model(self, config):
def rebuild_backend(self, config):
try:
backend = self.load_backend(Path("backends")/config["backend"])
print("Backend loaded successfully")
try:
model = backend(config)
print("Model created successfully")
except Exception as ex:
print("Couldn't build model")
print(ex)
model = None
except Exception as ex:
print("Couldn't build backend")
print(ex)
backend = None
model = None
return backend, model
return backend
def _rebuild_model(self):
try:
@ -257,7 +249,7 @@ class GPT4AllAPI():
self.process.start()
self.config = config
self.backend, self.model = self.process.rebuild_model(self.config)
self.backend = self.process.rebuild_backend(self.config)
self.personality = self.process.rebuild_personality()
if config["debug"]:
print(print(f"{self.personality}"))
@ -442,7 +434,7 @@ class GPT4AllAPI():
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# Chatbot conditionning
self.condition_chatbot(self.personality.personality_conditioning)
self.condition_chatbot()
return timestamp
def prepare_query(self, message_id=-1):

View File

@ -86,7 +86,7 @@ export default {
handleSelection() {
if (this.isInstalled && !this.selected) {
this.onSelected(this);
this.selected=true;
this.$set(this, 'selected', true);
}
}
}