mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-05-31 06:41:00 +00:00
Bugfix for localized personas
This commit is contained in:
parent
7d3ee26911
commit
b1d178d0cc
11
app.py
11
app.py
@ -14,7 +14,7 @@ __github__ = "https://github.com/ParisNeo/lollms-webui"
|
||||
__copyright__ = "Copyright 2023, "
|
||||
__license__ = "Apache 2.0"
|
||||
|
||||
__version__ ="6.6"
|
||||
__version__ ="6.7RC1"
|
||||
|
||||
main_repo = "https://github.com/ParisNeo/lollms-webui.git"
|
||||
import os
|
||||
@ -1620,19 +1620,22 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
if config_file.exists():
|
||||
if language:
|
||||
package_path += ":" + language
|
||||
"""
|
||||
if package_path in self.config["personalities"]:
|
||||
ASCIIColors.error("Can't mount exact same personality twice")
|
||||
return jsonify({"status": False,
|
||||
"error":"Can't mount exact same personality twice",
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
})
|
||||
})
|
||||
"""
|
||||
self.config["personalities"].append(package_path)
|
||||
self.mounted_personalities = self.rebuild_personalities()
|
||||
self.config["active_personality_id"]= len(self.config["personalities"])-1
|
||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||
ASCIIColors.success("ok")
|
||||
if self.config["active_personality_id"]<0:
|
||||
ASCIIColors.error("error:active_personality_id<0")
|
||||
return jsonify({"status": False,
|
||||
"error":"active_personality_id<0",
|
||||
"personalities":self.config["personalities"],
|
||||
@ -1642,6 +1645,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
if self.config.auto_save:
|
||||
ASCIIColors.info("Saving configuration")
|
||||
self.config.save_config()
|
||||
ASCIIColors.error("Mounted successfully")
|
||||
return jsonify({"status": True,
|
||||
"personalities":self.config["personalities"],
|
||||
"active_personality_id":self.config["active_personality_id"]
|
||||
@ -1866,7 +1870,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
|
||||
|
||||
def p_select_personality(self):
|
||||
|
||||
data = request.get_json()
|
||||
id = data['id']
|
||||
print(f"- Selecting active personality {id} ...",end="")
|
||||
@ -1874,7 +1877,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
self.config["active_personality_id"]=id
|
||||
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
|
||||
ASCIIColors.success("ok")
|
||||
print(f"Mounted {self.personality.name}")
|
||||
print(f"Selected {self.personality.name}")
|
||||
if self.config.auto_save:
|
||||
ASCIIColors.info("Saving configuration")
|
||||
self.config.save_config()
|
||||
|
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>LoLLMS WebUI - Welcome</title>
|
||||
<script type="module" crossorigin src="/assets/index-5102ec16.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-39f5f538.css">
|
||||
<script type="module" crossorigin src="/assets/index-09b40c8f.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-e027d47c.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -243,7 +243,6 @@ export default {
|
||||
feather.replace()
|
||||
console.log('Selected personality : ', JSON.stringify(pers.personality))
|
||||
if (pers) {
|
||||
|
||||
if (pers.selected) {
|
||||
this.$refs.toast.showToast("Personality already selected", 4, true)
|
||||
return
|
||||
@ -263,9 +262,6 @@ export default {
|
||||
this.onPersonalityMounted(pers)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
@ -388,7 +384,20 @@ export default {
|
||||
},
|
||||
async select_personality(pers) {
|
||||
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
|
||||
const id = this.configFile.personalities.findIndex(item => item === pers.full_path || item.split(':')[0] === pers.full_path)
|
||||
let id = -1
|
||||
console.log("Personality full path : ",pers.full_path)
|
||||
console.log("Personality language : ",pers.personality.language)
|
||||
|
||||
if(pers.personality.language!=null && pers.personality.language!=undefined){
|
||||
console.log('Mounting a localized version of personality')
|
||||
console.log('Mounted personalities :', JSON.stringify(this.configFile.personalities))
|
||||
console.log("Personality to select: ",pers.full_path+':'+pers.personality.language)
|
||||
id = this.configFile.personalities.findIndex(item => item === pers.full_path+':'+pers.personality.language)
|
||||
}
|
||||
else{
|
||||
console.log('Mounted personalities :', JSON.stringify(this.configFile.personalities))
|
||||
id = this.configFile.personalities.findIndex(item => item === pers.full_path)
|
||||
}
|
||||
if(id>-1){
|
||||
console.log('Selecting personality with id:', JSON.stringify(id))
|
||||
const obj = {
|
||||
@ -415,7 +424,7 @@ export default {
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('Personalituy id is wrong')
|
||||
console.log('Personality id is wrong')
|
||||
this.$refs.toast.showToast("Personality id is wrong!", 4, false)
|
||||
return { 'status': false, 'error': 'Personality id is wrong' }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user