mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
Added support for all languages in the universe
This commit is contained in:
parent
abb4c6d495
commit
134f9fceca
@ -25,7 +25,7 @@ from typing import List
|
||||
import socketio
|
||||
import threading
|
||||
import os
|
||||
|
||||
import yaml
|
||||
from lollms.databases.discussions_database import Discussion
|
||||
from lollms.security import forbid_remote_access
|
||||
from datetime import datetime
|
||||
@ -66,8 +66,20 @@ def add_events(sio:socketio):
|
||||
except Exception as ex:
|
||||
pass
|
||||
if lollmsElfServer.config.force_output_language_to_be and lollmsElfServer.config.force_output_language_to_be.lower().strip() !="english":
|
||||
welcome_message = lollmsElfServer.personality.fast_gen(f"!@>instruction: Translate the following text to {lollmsElfServer.config.force_output_language_to_be.lower()}:\n{lollmsElfServer.personality.welcome_message}\n!@>translation:")
|
||||
|
||||
language = lollmsElfServer.config.force_output_language_to_be.lower().strip().split()[0]
|
||||
language_path = lollmsElfServer.lollms_paths.personal_configuration_path/"personalities"/lollmsElfServer.personality.name/f"languages_{language}.yaml"
|
||||
if not language_path.exists():
|
||||
lollmsElfServer.ShowBlockingMessage(f"This is the first time this personality seaks {language}\nLollms is reconditionning the persona in that language.\nThis will be done just once. Next time, the personality will speak {language} out of the box")
|
||||
language_path.parent.mkdir(exist_ok=True, parents=True)
|
||||
conditionning = "!@>system: "+lollmsElfServer.personality.fast_gen(f"!@>instruction: Translate the following text to {language}:\n{lollmsElfServer.personality.personality_conditioning.replace('!@>system:','')}\n!@>translation:\n")
|
||||
welcome_message = lollmsElfServer.personality.fast_gen(f"!@>instruction: Translate the following text to {language}:\n{lollmsElfServer.personality.welcome_message}\n!@>translation:\n")
|
||||
with open(language_path,"w",encoding="utf-8", errors="ignore") as f:
|
||||
yaml.safe_dump({"conditionning":conditionning,"welcome_message":welcome_message}, f)
|
||||
lollmsElfServer.HideBlockingMessage()
|
||||
else:
|
||||
with open(language_path,"r",encoding="utf-8", errors="ignore") as f:
|
||||
language_pack = yaml.safe_load(f)
|
||||
welcome_message = language_pack["welcome_message"]
|
||||
else:
|
||||
welcome_message = lollmsElfServer.personality.welcome_message
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 227df34a42f6cfb73184e50f7a8757d1d67ff60c
|
||||
Subproject commit 6dbcc79b9184df2f1c88675886e3df15b597b5d1
|
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-300e42b3.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-ec529940.css">
|
||||
<script type="module" crossorigin src="/assets/index-f285f2cd.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-7342240e.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -742,7 +742,7 @@ export default {
|
||||
})
|
||||
},
|
||||
clear_files(){
|
||||
axios.get('/clear_personality_files_list').then(res=>{
|
||||
axios.post('/clear_personality_files_list', {"client_id":this.$store.state.client_id}).then(res=>{
|
||||
console.log(res)
|
||||
if(res.data.state){
|
||||
this.$store.state.toast.showToast("File removed successfully",4,true);
|
||||
@ -927,7 +927,7 @@ export default {
|
||||
takePicture(){
|
||||
socket.emit('take_picture')
|
||||
socket.on('picture_taken',()=>{
|
||||
axios.get('/get_current_personality_files_list').then(res=>{
|
||||
axios.post('/get_current_personality_files_list', {"client_id":this.$store.state.client_id}).then(res=>{
|
||||
this.filesList = res.data.files;
|
||||
this.isFileSentList= res.data.files.map(file => {
|
||||
return true;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ef0e79d41487140c9d7c067aa4faf2a4d2baab68
|
||||
Subproject commit e05d61a35a9ce9dd0fcc7fd0a8ac4b16fc59f102
|
Loading…
Reference in New Issue
Block a user