mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-29 15:44:12 +00:00
Tested personalities mounting
This commit is contained in:
parent
e3b1488b9f
commit
6dfd473c44
31
app.py
31
app.py
@ -89,6 +89,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
self.add_endpoint("/add_reference_to_local_model", "add_reference_to_local_model", self.add_reference_to_local_model, methods=["POST"])
|
||||
|
||||
self.add_endpoint("/send_file", "send_file", self.send_file, methods=["POST"])
|
||||
|
||||
self.add_endpoint("/list_mounted_personalities", "list_mounted_personalities", self.list_mounted_personalities, methods=["POST"])
|
||||
self.add_endpoint("/mount_personality", "mount_personality", self.mount_personality, methods=["POST"])
|
||||
self.add_endpoint("/unmount_personality", "unmount_personality", self.unmount_personality, methods=["POST"])
|
||||
self.add_endpoint("/select_personality", "select_personality", self.select_personality, methods=["POST"])
|
||||
@ -674,6 +676,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
else:
|
||||
return jsonify({"status": True})
|
||||
|
||||
def list_mounted_personalities(self):
|
||||
print("- Listing mounted personalities")
|
||||
return jsonify({"status": True,
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
})
|
||||
|
||||
|
||||
def mount_personality(self):
|
||||
print("- Mounting personality")
|
||||
@ -705,10 +714,15 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
|
||||
def unmount_personality(self):
|
||||
print("- Unmounting personality")
|
||||
data = request.get_json()
|
||||
language = data['language']
|
||||
category = data['category']
|
||||
name = data['name']
|
||||
try:
|
||||
data = request.get_json()
|
||||
# Further processing of the data
|
||||
except Exception as e:
|
||||
print(f"Error occurred while parsing JSON: {e}")
|
||||
return
|
||||
language = data['language']
|
||||
category = data['category']
|
||||
name = data['name']
|
||||
try:
|
||||
index = self.config["personalities"].index(f"{language}/{category}/{name}")
|
||||
self.config["personalities"].remove(f"{language}/{category}/{name}")
|
||||
@ -717,10 +731,11 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
self.personalities = self.process.rebuild_personalities()
|
||||
self.personality = self.personalities[self.config["active_personality_id"]]
|
||||
self.apply_settings()
|
||||
return jsonify({"status": True,
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
})
|
||||
return jsonify({
|
||||
"status": True,
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
})
|
||||
except:
|
||||
return jsonify({"status": False, "error":"Couldn't unmount personality"})
|
||||
|
||||
|
5
tests/end_point_tests/list_mounted_personalities.http
Normal file
5
tests/end_point_tests/list_mounted_personalities.http
Normal file
@ -0,0 +1,5 @@
|
||||
POST http://localhost:9600/list_mounted_personalities
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
}
|
8
tests/end_point_tests/mount_personality.http
Normal file
8
tests/end_point_tests/mount_personality.http
Normal file
@ -0,0 +1,8 @@
|
||||
POST http://localhost:9600/mount_personality
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"language": "english",
|
||||
"category": "generic",
|
||||
"name": "gpt4all"
|
||||
}
|
8
tests/end_point_tests/unmount_personality.http
Normal file
8
tests/end_point_tests/unmount_personality.http
Normal file
@ -0,0 +1,8 @@
|
||||
POST http://localhost:9600/unmount_personality
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"language": "english",
|
||||
"category": "generic",
|
||||
"name": "lollms"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user