mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-24 06:36:37 +00:00
commit
66e5a7ade0
13
app.py
13
app.py
@ -741,11 +741,11 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
name = data['name']
|
||||
|
||||
package_path = f"{language}/{category}/{name}"
|
||||
package_full_path = self.lollms_paths.lollms_path/"personalities_zoo"/package_path
|
||||
package_full_path = self.lollms_paths.personalities_zoo_path/package_path
|
||||
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"})
|
||||
|
||||
|
6
tests/end_point_tests/select_personality.http
Normal file
6
tests/end_point_tests/select_personality.http
Normal file
@ -0,0 +1,6 @@
|
||||
POST http://localhost:9600/select_personality
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id": 0
|
||||
}
|
Loading…
Reference in New Issue
Block a user