This commit is contained in:
Saifeddine ALOUI 2023-06-10 16:04:12 +02:00
parent bdd375cd57
commit 2e4017ed20
2 changed files with 14 additions and 3 deletions

11
app.py
View File

@ -745,7 +745,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
config_file = package_full_path / "config.yaml"
if config_file.exists():
self.config["personalities"].append(package_path)
self.personalities = self.process.rebuild_personalities()
self.mounted_personalities = self.process.rebuild_personalities()
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
self.apply_settings()
return jsonify({"status": True,
@ -788,12 +788,17 @@ class LoLLMsWebUI(LoLLMsAPPI):
return jsonify({"status": False, "error":"Couldn't unmount personality"})
def select_personality(self):
id = request.files['id']
data = request.get_json()
id = data['id']
if id<len(self.config["personalities"]):
self.config["active_personality_id"]=id
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
self.apply_settings()
return jsonify({"status": True})
return jsonify({
"status": True,
"personalities":self.config["personalities"],
"active_personality_id":self.config["active_personality_id"]
})
else:
return jsonify({"status": False, "error":"Invalid ID"})

View File

@ -0,0 +1,6 @@
POST http://localhost:9600/select_personality
Content-Type: application/json
{
"id": 0
}