diff --git a/configs/config.yaml b/configs/config.yaml index 9f1c950..b0065c2 100644 --- a/configs/config.yaml +++ b/configs/config.yaml @@ -1,5 +1,5 @@ # =================== Lord Of Large Language Models Configuration file =========================== -version: 33 +version: 35 binding_name: null model_name: null @@ -49,14 +49,18 @@ enable_gpu: true # Automatically open the browser auto_show_browser: true +# Voice service +enable_voice_service: false +xtts_base_url: http://127.0.0.1:8020 +auto_read: false +current_voice: null +current_language: en + # Audio media_on: false audio_in_language: 'en-US' auto_speak: false -auto_read: false -enable_voice_service: false audio_out_voice: null -current_voice: null audio_pitch: 1 audio_auto_send_input: true audio_silenceTimer: 5000 diff --git a/lollms/audio_gen_modules/lollms_xtts.py b/lollms/audio_gen_modules/lollms_xtts.py index 5e00497..e2be9ef 100644 --- a/lollms/audio_gen_modules/lollms_xtts.py +++ b/lollms/audio_gen_modules/lollms_xtts.py @@ -72,13 +72,13 @@ class LollmsXTTS: def __init__( self, app:LollmsApplication, - auto_xtts_base_url=None, + xtts_base_url=None, share=False, max_retries=10, voice_samples_path="" ): - if auto_xtts_base_url=="" or auto_xtts_base_url=="http://127.0.0.1:8020": - auto_xtts_base_url = None + if xtts_base_url=="" or xtts_base_url=="http://127.0.0.1:8020": + xtts_base_url = None # Get the current directory lollms_paths = app.lollms_paths self.app = app @@ -86,14 +86,14 @@ class LollmsXTTS: self.voice_samples_path = voice_samples_path # Store the path to the script - if auto_xtts_base_url is None: - self.auto_xtts_base_url = "http://127.0.0.1:8020" + if xtts_base_url is None: + self.xtts_base_url = "http://127.0.0.1:8020" if not verify_xtts(lollms_paths): install_xtts(app.lollms_paths) else: - self.auto_xtts_base_url = auto_xtts_base_url + self.xtts_base_url = xtts_base_url - self.auto_xtts_url = self.auto_xtts_base_url+"/sdapi/v1" + self.auto_xtts_url = self.xtts_base_url+"/sdapi/v1" shared_folder = root_dir/"shared" self.xtts_folder = shared_folder / "xtts" @@ -108,7 +108,7 @@ class LollmsXTTS: ASCIIColors.red(" Forked from daswer123's XTTS server") ASCIIColors.red(" Integration in lollms by ParisNeo using daswer123's webapi ") - if not self.wait_for_service(1,False) and auto_xtts_base_url is None: + if not self.wait_for_service(1,False) and xtts_base_url is None: ASCIIColors.info("Loading lollms_xtts") os.environ['xtts_WEBUI_RESTARTING'] = '1' # To forbid sd webui from showing on the browser automatically # Launch the Flask service using the appropriate script for the platform @@ -122,7 +122,7 @@ class LollmsXTTS: def wait_for_service(self, max_retries = 150, show_warning=True): - url = f"{self.auto_xtts_base_url}/languages" + url = f"{self.xtts_base_url}/languages" # Adjust this value as needed retries = 0 @@ -146,7 +146,7 @@ class LollmsXTTS: return False def set_speaker_folder(self, speaker_folder): - url = f"{self.auto_xtts_base_url}/set_speaker_folder" + url = f"{self.xtts_base_url}/set_speaker_folder" # Define the request body payload = { @@ -166,7 +166,7 @@ class LollmsXTTS: return False def tts_to_file(self, text, speaker_wav, file_name_or_path, language="en"): - url = f"{self.auto_xtts_base_url}/tts_to_file" + url = f"{self.xtts_base_url}/tts_to_file" # Define the request body payload = { diff --git a/lollms/configs/config.yaml b/lollms/configs/config.yaml index 9f1c950..b0065c2 100644 --- a/lollms/configs/config.yaml +++ b/lollms/configs/config.yaml @@ -1,5 +1,5 @@ # =================== Lord Of Large Language Models Configuration file =========================== -version: 33 +version: 35 binding_name: null model_name: null @@ -49,14 +49,18 @@ enable_gpu: true # Automatically open the browser auto_show_browser: true +# Voice service +enable_voice_service: false +xtts_base_url: http://127.0.0.1:8020 +auto_read: false +current_voice: null +current_language: en + # Audio media_on: false audio_in_language: 'en-US' auto_speak: false -auto_read: false -enable_voice_service: false audio_out_voice: null -current_voice: null audio_pitch: 1 audio_auto_send_input: true audio_silenceTimer: 5000 diff --git a/lollms/utilities.py b/lollms/utilities.py index c9d65a9..5df873b 100644 --- a/lollms/utilities.py +++ b/lollms/utilities.py @@ -96,18 +96,13 @@ def find_first_available_file_index(folder_path, prefix, extension=""): available_number = 1 # Iterate through the files - for file in files: - # Extract the number from the file name - file_number = int(file.stem[len(prefix):]) - - # If the file number is equal to the available number, increment the available number - if file_number == available_number: + while True: + f = folder/f"{prefix}{available_number}{extension}" + if f.exists(): available_number += 1 # If the file number is greater than the available number, break the loop - elif file_number > available_number: - break - - return available_number + else: + return available_number @@ -369,7 +364,7 @@ class PackageManager: def install_package(package_name): import subprocess import sys - subprocess.check_call([sys.executable, "-m", "pip", "install", package_name]) + subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", package_name]) @staticmethod def check_package_installed(package_name):