Enhanced ui

This commit is contained in:
Saifeddine ALOUI 2023-12-28 16:57:59 +01:00
parent cfcb925f58
commit 24e56537ff
11 changed files with 322 additions and 246 deletions

View File

@ -1203,7 +1203,7 @@ class LoLLMsAPI(LollmsApplication):
selected_language=personality.split(":")[1] if ":" in personality else None,
run_scripts=True)
mounted_personalities.append(personality)
if self.config.auto_read and len(personality.audio_samples)>0:
if self.config.enable_voice_service and self.config.auto_read and len(personality.audio_samples)>0:
try:
from lollms.audio_gen_modules.lollms_xtts import LollmsXTTS
if self.tts is None:
@ -2073,7 +2073,7 @@ class LoLLMsAPI(LollmsApplication):
client_id=client_id,
callback=partial(self.process_chunk,client_id = client_id)
)
if self.config.auto_read and len(self.personality.audio_samples)>0:
if self.config.enable_voice_service and self.config.auto_read and len(self.personality.audio_samples)>0:
try:
self.process_chunk("Generating voice output",MSG_TYPE.MSG_TYPE_STEP_START,client_id=client_id)
from lollms.audio_gen_modules.lollms_xtts import LollmsXTTS

9
app.py
View File

@ -257,11 +257,9 @@ try:
)
self.add_endpoint("/start_training", "start_training", self.start_training, methods=["POST"])
self.add_endpoint("/get_lollms_version", "get_lollms_version", self.get_lollms_version, methods=["GET"])
self.add_endpoint("/get_lollms_webui_version", "get_lollms_webui_version", self.get_lollms_webui_version, methods=["GET"])
self.add_endpoint("/reload_binding", "reload_binding", self.reload_binding, methods=["POST"])
self.add_endpoint("/restart_program", "restart_program", self.restart_program, methods=["GET"])
self.add_endpoint("/update_software", "update_software", self.update_software, methods=["GET"])
@ -775,6 +773,7 @@ try:
def list_voices(self):
ASCIIColors.yellow("Listing voices")
voices=["main_voice"]
voices_dir:Path=lollms_paths.custom_voices_path
voices += [v.stem for v in voices_dir.iterdir() if v.suffix==".wav"]
@ -782,15 +781,15 @@ try:
def set_voice(self):
data = request.get_json()
self.config.reading_voice=data["voice"]
self.config.current_voice=data["voice"]
if self.config.auto_save:
self.config.save_config()
return jsonify({"status":true})
return jsonify({"status":True})
def read(self):
# Get the JSON data from the POST request.
data = request.get_json()
voice=data.get("voice",self.config.reading_voice)
voice=data.get("voice",self.config.current_voice)
if voice is None:
voice = "main_voice"
self.info("Starting to build voice")

View File

@ -1,5 +1,5 @@
# =================== Lord Of Large Language Models Configuration file ===========================
version: 32
version: 33
binding_name: null
model_name: null
@ -52,10 +52,11 @@ auto_show_browser: true
# Audio
media_on: false
audio_in_language: 'en-US'
audio_out_voice: null
auto_speak: false
auto_read: false
reading_voice: null
enable_voice_service: false
audio_out_voice: null
current_voice: null
audio_pitch: 1
audio_auto_send_input: true
audio_silenceTimer: 5000

@ -1 +1 @@
Subproject commit 91093246d27c4c8ba98a718b8cae6ea0c8af6cfd
Subproject commit 1a49dd9dfc07c42c8329fc637274f7f4fc71dc36

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
View File

@ -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-eb3c4aa9.js"></script>
<link rel="stylesheet" href="/assets/index-00b65516.css">
<script type="module" crossorigin src="/assets/index-dbbd1f94.js"></script>
<link rel="stylesheet" href="/assets/index-a73bb544.css">
</head>
<body>
<div id="app"></div>

View File

@ -133,7 +133,7 @@
<i data-feather="volume-2"></i>
</div>
</div>
<div class="flex flex-row items-center">
<div v-if="enable_voice_service" class="flex flex-row items-center">
<div class="text-lg hover:text-red-600 duration-75 active:scale-90 p-2"
title="read"
@click.stop="read()"
@ -544,6 +544,11 @@ export default {
},
computed: {
enable_voice_service:{
get(){
this.$store.state.config.enable_voice_service
}
},
editMsgMode:{
get(){
if(this.message.hasOwnProperty('open'))

View File

@ -724,6 +724,39 @@
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="enable_voice_service" class="text-sm font-bold" style="margin-right: 1rem;">Enable voice service:</label>
</td>
<td>
<div class="flex flex-row">
<input
type="checkbox"
id="enable_voice_service"
required
v-model="configFile.enable_voice_service"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="current_voice" class="text-sm font-bold" style="margin-right: 1rem;">Current voice:</label>
</td>
<td>
<div class="flex flex-row">
<select v-model="current_voice" @change="settingsChanged=true" :disabled="!enable_voice_service">
<option v-for="voice in voices" :key="voice.id" :value="voice.id">
{{ voice }}
</option>
</select>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="auto_read" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto read:</label>
@ -737,6 +770,7 @@
v-model="configFile.auto_read"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
:disabled="!enable_voice_service"
>
</div>
</td>
@ -1818,6 +1852,7 @@ export default {
data() {
return {
voices: [],
binding_changed:false,
SVGGPU:SVGGPU,
models_zoo:[],
@ -1909,6 +1944,15 @@ export default {
//refreshHardwareUsage()
},
methods: {
getSeviceVoices() {
axios.get('list_voices')
.then(response => {
this.voices = response.data["voices"];
})
.catch(error => {
console.error(error);
});
},
load_more_models(){
if(this.models_zoo_initialLoadCount+10<this.models_zoo.length){
this.models_zoo_initialLoadCount+=10
@ -3723,6 +3767,7 @@ export default {
this.getVoices();
console.log("Constructing")
this.load_everything()
this.getSeviceVoices()
},
activated() {
//this.load_everything()
@ -3922,6 +3967,34 @@ export default {
this.$store.state.config.auto_read = value
},
},
enable_voice_service:{
get() {
return this.$store.state.config.enable_voice_service;
},
set(value) {
// You should not set the value directly here; use the updateSetting method instead
this.$store.state.config.enable_voice_service = value
},
},
current_voice:{
get() {
if (this.$store.state.config.current_voice===null || this.$store.state.config.current_voice===undefined){
console.log("current voice", this.$store.state.config.current_voice)
return "main_voice";
}
return this.$store.state.config.current_voice;
},
set(value) {
// You should not set the value directly here; use the updateSetting method instead
if(value=="main_voice"){
this.$store.state.config.current_voice = null
}
else{
this.$store.state.config.current_voice = value
}
},
},
audio_pitch:{
get() {
return this.$store.state.config.audio_pitch;
@ -4130,11 +4203,9 @@ export default {
},
watch: {
watch: {
extensionsFiltered(newValue, oldValue) {
// Perform any necessary UI updates here
// newValue represents the new value of extensionsFiltered
// oldValue represents the previous value of extensionsFiltered
enable_voice_service(newValue) {
if (!newValue) {
this.configFile.auto_read = false;
}
},
bec_collapsed() {

@ -1 +1 @@
Subproject commit c98cb1098bd3d05049f557563b37fdb1ceebe8cc
Subproject commit 3dcfab2216f386ba558c508fa6f565593b740700

@ -1 +1 @@
Subproject commit 3845762603dd7cabdba5d9b25ccc11b66c991d44
Subproject commit 6fd7581f87cb15ff00345106dca6b8e83e9d0256