mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
sync and new language ui
This commit is contained in:
parent
84292603a8
commit
e49f65529e
@ -1,5 +1,5 @@
|
||||
# =================== Lord Of Large Language Multimodal Systems Configuration file ===========================
|
||||
version: 84
|
||||
version: 85
|
||||
binding_name: null
|
||||
model_name: null
|
||||
model_variant: null
|
||||
@ -173,7 +173,7 @@ pdf_latex_path: null
|
||||
# boosting information
|
||||
positive_boost: null
|
||||
negative_boost: null
|
||||
force_output_language_to_be: null
|
||||
current_language: null
|
||||
fun_mode: false
|
||||
|
||||
|
||||
|
@ -65,8 +65,8 @@ def add_events(sio:socketio):
|
||||
pygame.mixer.music.play()
|
||||
except Exception as ex:
|
||||
pass
|
||||
if lollmsElfServer.config.force_output_language_to_be and lollmsElfServer.config.force_output_language_to_be.lower().strip() !="english":
|
||||
language = lollmsElfServer.config.force_output_language_to_be.lower().strip().split()[0]
|
||||
if lollmsElfServer.config.current_language and lollmsElfServer.config.current_language.lower().strip() !="english":
|
||||
language = lollmsElfServer.config.current_language.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")
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f8720878dd3533c1f17ec34e3b7682c4069d4087
|
||||
Subproject commit cb17c8b917dbe35071cf71cd86f8e6f67d4d02d1
|
8
web/dist/assets/index-bf86dc9a.css
vendored
8
web/dist/assets/index-bf86dc9a.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
8
web/dist/assets/index-d8634d95.css
vendored
Normal file
8
web/dist/assets/index-d8634d95.css
vendored
Normal file
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-47354bcb.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-bf86dc9a.css">
|
||||
<script type="module" crossorigin src="/assets/index-d35f36a9.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index-d8634d95.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -97,7 +97,26 @@
|
||||
@click="showNews()">
|
||||
<img :src="static_info">
|
||||
</div>
|
||||
|
||||
<div class="language-selector relative" style="position: relative;">
|
||||
<button @click="toggleLanguageMenu" class="bg-transparent text-black dark:text-white py-1 px-1 rounded font-bold uppercase transition-colors duration-300 hover:bg-blue-500">
|
||||
{{ $store.state.language.slice(0, 2) }}
|
||||
</button>
|
||||
<div v-if="isLanguageMenuVisible" class="container language-menu absolute left-0 mt-1 bg-white rounded shadow-lg z-10" style="position: absolute; top: 100%; width: 200px;"> <!-- Adjusted width for a larger menu -->
|
||||
<ul style="list-style-type: none;"> <!-- Removed bullets -->
|
||||
<li v-for="language in languages" :key="language" @click="selectLanguage(language)" class="cursor-pointer hover:bg-blue-500 hover:text-white py-2 px-4 block whitespace-no-wrap">
|
||||
{{ language }}
|
||||
</li>
|
||||
<li class="cursor-pointer hover:text-white py-0 px-0 block whitespace-no-wrap">
|
||||
<input type="text" v-model="customLanguage" @keyup.enter.prevent="addCustomLanguage" placeholder="Enter language..." class="bg-transparent border border-gray-300 rounded py-0 px-0 mx-0 my-1 w-full">
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -144,12 +163,25 @@ import static_info from "../assets/static_info.svg"
|
||||
import animated_info from "../assets/animated_info.svg"
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import axios from 'axios';
|
||||
</script>
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'TopBar',
|
||||
computed:{
|
||||
languages: {
|
||||
get(){
|
||||
console.log("searching languages", this.$store.state.languages)
|
||||
return this.$store.state.languages
|
||||
}
|
||||
},
|
||||
language: {
|
||||
get(){
|
||||
console.log("searching language", this.$store.state.language)
|
||||
return this.$store.state.language
|
||||
}
|
||||
},
|
||||
currentPersonConfig (){
|
||||
try{
|
||||
return this.$store.state.currentPersonConfig
|
||||
@ -220,6 +252,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customLanguage: '', // Holds the value of the custom language input
|
||||
selectedLanguage: '',
|
||||
isLanguageMenuVisible: false,
|
||||
static_info: static_info,
|
||||
animated_info: animated_info,
|
||||
|
||||
@ -239,7 +274,7 @@ export default {
|
||||
systemTheme: window.matchMedia("prefers-color-scheme: dark").matches,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
this.$store.state.toast = this.$refs.toast
|
||||
this.$store.state.news = this.$refs.news
|
||||
this.$store.state.messageBox = this.$refs.messageBox
|
||||
@ -267,6 +302,21 @@ export default {
|
||||
this.systemTheme = window.matchMedia("prefers-color-scheme: dark").matches;
|
||||
},
|
||||
methods: {
|
||||
addCustomLanguage() {
|
||||
if (this.customLanguage.trim() !== '') {
|
||||
this.selectLanguage(this.customLanguage);
|
||||
this.customLanguage = ''; // Reset the input field after adding
|
||||
}
|
||||
},
|
||||
async selectLanguage(language) {
|
||||
await this.$store.dispatch('changeLanguage', language);
|
||||
this.toggleLanguageMenu(); // Fermer le menu après le changement de langue
|
||||
this.language = language
|
||||
},
|
||||
toggleLanguageMenu() {
|
||||
console.log("Toggling language ",this.isLanguageMenuVisible)
|
||||
this.isLanguageMenuVisible = !this.isLanguageMenuVisible;
|
||||
},
|
||||
restartProgram(event) {
|
||||
event.preventDefault();
|
||||
this.$store.state.api_get_req('restart_program')
|
||||
@ -374,4 +424,6 @@ export default {
|
||||
.dot-red {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
@ -24,6 +24,8 @@ function copyObject(obj) {
|
||||
export const store = createStore({
|
||||
state () {
|
||||
return {
|
||||
language: "english",
|
||||
languages: [],
|
||||
currentTheme: '',
|
||||
personality_editor:null,
|
||||
showPersonalityEditor: false,
|
||||
@ -37,7 +39,11 @@ export const store = createStore({
|
||||
ai_conditionning: '',
|
||||
ai_disclaimer: '',
|
||||
ai_icon: null,
|
||||
},
|
||||
},
|
||||
posts_headers : {
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
client_id:"",
|
||||
// count: 0,
|
||||
yesNoDialog:null,
|
||||
@ -75,7 +81,15 @@ export const store = createStore({
|
||||
databases:[],
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
mutations: {
|
||||
setLanguages(state, languages) {
|
||||
state.languages = languages;
|
||||
},
|
||||
setLanguage(state, language) {
|
||||
state.language = language;
|
||||
},
|
||||
|
||||
|
||||
setIsReady(state, ready) {
|
||||
state.ready = ready;
|
||||
},
|
||||
@ -147,6 +161,12 @@ export const store = createStore({
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
getLanguages(state) {
|
||||
return state.languages;
|
||||
},
|
||||
getLanguage(state) {
|
||||
return state.language;
|
||||
},
|
||||
getIsConnected(state) {
|
||||
return state.isConnected
|
||||
},
|
||||
@ -255,7 +275,58 @@ export const store = createStore({
|
||||
commit('setDatabases', databases);
|
||||
},
|
||||
|
||||
async fetchLanguages({ commit }) {
|
||||
console.log("get_personality_languages_list", this.state.client_id)
|
||||
const response = await axios.post(
|
||||
'/get_personality_languages_list',
|
||||
{client_id: this.state.client_id}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const languages = response.data;
|
||||
console.log("languages", languages)
|
||||
commit('setLanguages', languages);
|
||||
},
|
||||
async fetchLanguage({ commit }) {
|
||||
console.log("get_personality_language", this.state.client_id)
|
||||
const response = await axios.post(
|
||||
'/get_personality_language',
|
||||
{client_id: this.state.client_id}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const language = response.data;
|
||||
console.log("language", language)
|
||||
commit('setLanguage', language);
|
||||
},
|
||||
async changeLanguage({ commit }, new_language) {
|
||||
console.log("Changing language to ", new_language)
|
||||
let response = await axios.post('/set_personality_language', {
|
||||
client_id: this.state.client_id,
|
||||
language: new_language,
|
||||
})
|
||||
console.log("get_personality_languages_list", this.state.client_id)
|
||||
response = await axios.post(
|
||||
'/get_personality_languages_list',
|
||||
{client_id: this.state.client_id}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const languages = response.data;
|
||||
console.log("languages", languages)
|
||||
commit('setLanguages', languages);
|
||||
response = await axios.post(
|
||||
'/get_personality_language',
|
||||
{client_id: this.state.client_id}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const language = response.data;
|
||||
console.log("language", language)
|
||||
commit('setLanguage', language);
|
||||
|
||||
console.log('Language changed successfully:', response.data.message);
|
||||
},
|
||||
async refreshPersonalitiesZoo({ commit }) {
|
||||
let personalities = []
|
||||
const catdictionary = await api_get_req("get_all_personalities")
|
||||
@ -644,7 +715,14 @@ app.mixin({
|
||||
console.log("Error cought:", ex)
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
await this.$store.dispatch('fetchLanguages');
|
||||
await this.$store.dispatch('fetchLanguage');
|
||||
}
|
||||
catch (ex){
|
||||
console.log("Error cought:", ex)
|
||||
}
|
||||
|
||||
this.$store.state.ready = true;
|
||||
}
|
||||
|
||||
|
@ -1990,7 +1990,6 @@ export default {
|
||||
console.log("Waiting to be ready")
|
||||
while (this.$store.state.ready === false) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100)); // Wait for 100ms
|
||||
console.log(this.$store.state.ready)
|
||||
}
|
||||
console.log("Ready")
|
||||
// Constructor
|
||||
|
@ -841,15 +841,15 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="min-width: 200px;">
|
||||
<label for="force_output_language_to_be" class="text-sm font-bold" style="margin-right: 1rem;">Force AI to answer in this language:</label>
|
||||
<label for="current_language" class="text-sm font-bold" style="margin-right: 1rem;">Force AI to answer in this language:</label>
|
||||
</td>
|
||||
<td>
|
||||
<div class="flex flex-row">
|
||||
<input
|
||||
type="text"
|
||||
id="force_output_language_to_be"
|
||||
id="current_language"
|
||||
required
|
||||
v-model="configFile.force_output_language_to_be"
|
||||
v-model="configFile.current_language"
|
||||
@change="settingsChanged=true"
|
||||
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
|
||||
>
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 9024de8263ea93b139d7ed2f87e0aeee2372c8e0
|
||||
Subproject commit 2e71c99a9d5007e9666fd26a9ddc75fcbd59e654
|
@ -1 +1 @@
|
||||
Subproject commit 37413fc1d127771cc924a308f8cef1d5740eaa1e
|
||||
Subproject commit e74bdd27b5983b60ea3b70b2dd79fce1297d5b74
|
@ -1 +1 @@
|
||||
Subproject commit 1fcf57b4731a914c3ec2ab996e8abcc2a9435819
|
||||
Subproject commit 198e45cb1cc99ca20e6fae4c0d1db0857f7dc172
|
Loading…
Reference in New Issue
Block a user