mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-20 12:53:07 +00:00
Now the backends are automatically installed when selected
This commit is contained in:
parent
0241d300b8
commit
2137170278
8
app.py
8
app.py
@ -284,6 +284,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
personalities[language_folder.name][category_folder.name].append(personality_info)
|
personalities[language_folder.name][category_folder.name].append(personality_info)
|
||||||
|
|
||||||
return json.dumps(personalities)
|
return json.dumps(personalities)
|
||||||
|
|
||||||
# Settings (data: {"setting_name":<the setting name>,"setting_value":<the setting value>})
|
# Settings (data: {"setting_name":<the setting name>,"setting_value":<the setting value>})
|
||||||
def update_setting(self):
|
def update_setting(self):
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@ -371,10 +372,11 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
|
|
||||||
elif setting_name== "backend":
|
elif setting_name== "backend":
|
||||||
if self.config['backend']!= data['setting_value']:
|
if self.config['backend']!= data['setting_value']:
|
||||||
print("New backend selected")
|
print(f"New backend selected : {data['setting_value']}")
|
||||||
self.config["backend"]=data['setting_value']
|
self.config["backend"]=data['setting_value']
|
||||||
try:
|
try:
|
||||||
self.backend = self.process.load_backend(self.config["backend"])
|
self.backend = self.process.load_backend(self.config["backend"], install=True)
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("Couldn't build backend")
|
print("Couldn't build backend")
|
||||||
return jsonify({'setting_name': data['setting_name'], "status":False, 'error':str(ex)})
|
return jsonify({'setting_name': data['setting_name'], "status":False, 'error':str(ex)})
|
||||||
@ -391,7 +393,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
if self.config["debug"]:
|
if self.config["debug"]:
|
||||||
print(f"Configuration {data['setting_name']} set to {data['setting_value']}")
|
print(f"Configuration {data['setting_name']} set to {data['setting_value']}")
|
||||||
|
|
||||||
print("Configuration updated")
|
print(f"Configuration {data['setting_name']} updated")
|
||||||
# Tell that the setting was changed
|
# Tell that the setting was changed
|
||||||
return jsonify({'setting_name': data['setting_name'], "status":True})
|
return jsonify({'setting_name': data['setting_name'], "status":True})
|
||||||
|
|
||||||
|
@ -108,6 +108,10 @@ class ModelProcess:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def load_backend(self, backend_name:str, install=False):
|
def load_backend(self, backend_name:str, install=False):
|
||||||
|
if install:
|
||||||
|
print(f"Loading backend {backend_name} install ON")
|
||||||
|
else:
|
||||||
|
print(f"Loading backend : {backend_name} install is off")
|
||||||
backend_path = Path("backends")/backend_name
|
backend_path = Path("backends")/backend_name
|
||||||
if install:
|
if install:
|
||||||
# first find out if there is a requirements.txt file
|
# first find out if there is a requirements.txt file
|
||||||
|
Loading…
Reference in New Issue
Block a user