mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
fixed personalities bug
This commit is contained in:
parent
60d8102932
commit
0f8ae835da
26
app.py
26
app.py
@ -122,7 +122,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
"/list_discussions", "list_discussions", self.list_discussions, methods=["GET"]
|
||||
)
|
||||
|
||||
self.add_endpoint("/set_personality", "set_personality", self.set_personality, methods=["GET"])
|
||||
self.add_endpoint("/delete_personality", "delete_personality", self.delete_personality, methods=["GET"])
|
||||
|
||||
|
||||
@ -185,6 +184,10 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
"/get_config", "get_config", self.get_config, methods=["GET"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/get_current_personality_path_infos", "get_current_personality_path_infos", self.get_current_personality_path_infos, methods=["GET"]
|
||||
)
|
||||
|
||||
self.add_endpoint(
|
||||
"/get_available_models", "get_available_models", self.get_available_models, methods=["GET"]
|
||||
)
|
||||
@ -533,13 +536,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
return jsonify(personalities_languages)
|
||||
|
||||
def list_personalities_categories(self):
|
||||
personalities_categories_dir = lollms_path/f'personalities_zoo/{self.config["personalities"][self.config["default_personality_id"]].split("/")[0]}' # replace with the actual path to the models folder
|
||||
personalities_categories_dir = lollms_path/f'personalities_zoo/{self.personality_language}' # replace with the actual path to the models folder
|
||||
personalities_categories = [f.stem for f in personalities_categories_dir.iterdir() if f.is_dir()]
|
||||
return jsonify(personalities_categories)
|
||||
|
||||
def list_personalities(self):
|
||||
try:
|
||||
personalities_dir = lollms_path/f'personalities_zoo/{"/".join(self.config["personalities"][self.config["default_personality_id"]].split("/")[0:2])}' # replace with the actual path to the models folder
|
||||
personalities_dir = lollms_path/f'personalities_zoo/{self.personality_language}/{self.personality_category}' # replace with the actual path to the models folder
|
||||
personalities = [f.stem for f in personalities_dir.iterdir() if f.is_dir()]
|
||||
except Exception as ex:
|
||||
personalities=[]
|
||||
@ -565,16 +568,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
return jsonify(discussions)
|
||||
|
||||
|
||||
def set_personality(self):
|
||||
lang = request.args.get('language')
|
||||
category = request.args.get('category')
|
||||
name = request.args.get('name')
|
||||
self.config['personality_language'] = lang
|
||||
self.config['personality_category'] = category
|
||||
self.config['personality'] = name
|
||||
result = self.process.set_config(self.config)
|
||||
return jsonify(result)
|
||||
|
||||
def delete_personality(self):
|
||||
lang = request.args.get('language')
|
||||
category = request.args.get('category')
|
||||
@ -935,6 +928,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
def get_config(self):
|
||||
return jsonify(self.config.to_dict())
|
||||
|
||||
def get_current_personality_path_infos(self):
|
||||
return jsonify({
|
||||
"personality_language":self.personality_language,
|
||||
"personality_category":self.personality_category,
|
||||
"personality_name":self.personality_name
|
||||
})
|
||||
|
||||
def main(self):
|
||||
return render_template("main.html")
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>GPT4All - WEBUI</title>
|
||||
<script type="module" crossorigin src="/assets/index-8a386bea.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-8f4a78a8.css">
|
||||
<script type="module" crossorigin src="/assets/index-5da07514.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-1a5ce137.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -889,11 +889,6 @@ export default {
|
||||
this.api_get_req("get_config").then(response => {
|
||||
console.log("Received config")
|
||||
this.configFile = response
|
||||
this.extract_personality_parameters()
|
||||
|
||||
// console.log(`p lang = ${this.configFile.personality_language }`)
|
||||
// console.log(`p cat = ${this.configFile.personality_category }`)
|
||||
// console.log(`p name = ${this.configFile.personality_folder }`)
|
||||
|
||||
this.models.forEach(model => {
|
||||
|
||||
@ -906,6 +901,12 @@ export default {
|
||||
}
|
||||
});
|
||||
})
|
||||
this.api_get_req("get_current_personality_path_infos").then(response => {
|
||||
this.configFile.personality_language = response["personality_language"]
|
||||
this.configFile.personality_category = response["personality_category"]
|
||||
this.configFile.personality_folder = response["personality_name"]
|
||||
console.log("received infos")
|
||||
});
|
||||
this.api_get_req("disk_usage").then(response => {
|
||||
this.diskUsage = response
|
||||
})
|
||||
@ -916,22 +917,6 @@ export default {
|
||||
this.getPersonalitiesArr()
|
||||
this.fetchModels();
|
||||
},
|
||||
extract_personality_parameters() {
|
||||
try {
|
||||
let parts = this.configFile.personalities[this.configFile.default_personality_id].split('/')
|
||||
this.configFile.personality_language = parts[0]
|
||||
this.configFile.personality_category = parts[1]
|
||||
this.configFile.personality_folder = parts[2]
|
||||
|
||||
// console.log(`p lang = ${this.configFile.personality_language }`)
|
||||
// console.log(`p cat = ${this.configFile.personality_category }`)
|
||||
// console.log(`p name = ${this.configFile.personality_folder }`)
|
||||
|
||||
} catch (error) {
|
||||
console.log(`Exception : ${error}`)
|
||||
}
|
||||
|
||||
},
|
||||
// Accordeon stuff
|
||||
toggleAccordion() {
|
||||
this.showAccordion = !this.showAccordion;
|
||||
@ -1140,10 +1125,15 @@ export default {
|
||||
|
||||
})
|
||||
this.configFile = await this.api_get_req("get_config")
|
||||
let personality_path_infos = await this.api_get_req("get_current_personality_path_infos")
|
||||
this.configFile.personality_language = personality_path_infos["personality_language"]
|
||||
this.configFile.personality_category = personality_path_infos["personality_category"]
|
||||
this.configFile.personality_folder = personality_path_infos["personality_name"]
|
||||
|
||||
|
||||
if (this.configFile.model_name) {
|
||||
this.isModelSelected = true
|
||||
}
|
||||
this.extract_personality_parameters();
|
||||
|
||||
this.fetchModels();
|
||||
this.bindingsArr = await this.api_get_req("list_bindings")
|
||||
|
Loading…
Reference in New Issue
Block a user