From 2e0d83e5d3e0e424b90ef06be19737dd13aa5224 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 9 Apr 2025 15:39:49 +0200 Subject: [PATCH] enhanced --- lollms/app.py | 40 +++--------------------- lollms/com.py | 2 +- lollms/databases/discussions_database.py | 4 +-- lollms/function_call.py | 3 +- lollms/server/endpoints/lollms_ttm.py | 4 +-- 5 files changed, 12 insertions(+), 41 deletions(-) diff --git a/lollms/app.py b/lollms/app.py index 3162c8c..8b08343 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -653,15 +653,13 @@ class LollmsApplication(LoLLMsCom): if self.config.active_ttm_service: def start_ttm(*args, **kwargs): - self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service) + self.ttm = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service) ASCIIColors.execute_with_animation("Loading loacal TTM services", start_ttm, ASCIIColors.color_blue) - print("OK") if self.config.active_ttv_service: def start_ttv(*args, **kwargs): self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttv", self.config.active_ttv_service) ASCIIColors.execute_with_animation("Loading loacal TTV services", start_ttv, ASCIIColors.color_blue) - print("OK") @@ -687,16 +685,16 @@ class LollmsApplication(LoLLMsCom): self.tts = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"tts", self.config.active_tts_service) ASCIIColors.execute_with_animation("Loading loacal TTS services", start_tts, ASCIIColors.color_blue) + if self.config.active_ttm_service: def start_ttm(*args, **kwargs): - self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service) + self.ttm = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttm", self.config.active_ttm_service) ASCIIColors.execute_with_animation("Loading loacal TTM services", start_ttm, ASCIIColors.color_blue) - + if self.config.active_ttv_service: def start_ttv(*args, **kwargs): self.ttv = self.load_service_from_folder(self.lollms_paths.services_zoo_path/"ttv", self.config.active_ttv_service) ASCIIColors.execute_with_animation("Loading loacal TTV services", start_ttv, ASCIIColors.color_blue) - print("OK") @@ -1915,35 +1913,7 @@ Don't forget encapsulate the code inside a markdown code tag. This is mandatory. mounted_personalities.append(personality) if self.config.auto_read and len(personality.audio_samples) > 0: - try: - from lollms.services.tts.xtts.lollms_xtts import \ - LollmsXTTS - - if self.tts is None: - voice = self.config.xtts_current_voice - if voice != "main_voice": - voices_folder = self.lollms_paths.custom_voices_path - else: - voices_folder = ( - Path(__file__).parent.parent.parent - / "services/xtts/voices" - ) - - self.tts = LollmsXTTS( - self, - voices_folders=[ - voices_folder, - Path(__file__).parent.parent.parent - / "services/xtts/voices", - ], - freq=self.config.xtts_freq, - ) - - except Exception as ex: - trace_exception(ex) - self.warning( - f"Personality {personality.name} request using custom voice but couldn't load XTTS" - ) + pass # self.tts except Exception as ex: trace_exception(ex) ASCIIColors.error( diff --git a/lollms/com.py b/lollms/com.py index 8e24f8a..999ed0e 100644 --- a/lollms/com.py +++ b/lollms/com.py @@ -77,7 +77,7 @@ class LoLLMsCom: verbose=verbose ) ) - async def ShowBlockingMessage(self, content, client_id=None, verbose:bool=None): + def ShowBlockingMessage(self, content, client_id=None, verbose:bool=None): self.schedule_task( self.notify( content, notification_type=NotificationType.NOTIF_SUCCESS, diff --git a/lollms/databases/discussions_database.py b/lollms/databases/discussions_database.py index a3cde11..b653fe0 100644 --- a/lollms/databases/discussions_database.py +++ b/lollms/databases/discussions_database.py @@ -663,7 +663,7 @@ class Message: text, tuple(params) ) - def update_steps(self, steps:list, step_type:str, status:bool): + def update_steps(self, steps:list): self.finished_generating_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S') text = f"UPDATE message SET steps = ?" self.steps = steps @@ -1205,7 +1205,7 @@ class Discussion: message_id (int): The id of the message to be changed new_content (str): The nex message content """ - self.current_message.update_steps(new_content, started_generating_at, nb_tokens) + self.current_message.update_steps(steps) diff --git a/lollms/function_call.py b/lollms/function_call.py index 0e48fc8..01e59c5 100644 --- a/lollms/function_call.py +++ b/lollms/function_call.py @@ -13,12 +13,13 @@ class FunctionType(Enum): # Step 2: Update the FunctionCall base class class FunctionCall: - def __init__(self, name:str, app:LoLLMsCom, function_type: FunctionType, client: Client, static_parameters:TypedConfig=None): + def __init__(self, name:str, app:LoLLMsCom, function_type: FunctionType, client: Client, static_parameters:TypedConfig=None, description=""): self.name = name self.app = app self.personality = app.personality self.function_type = function_type self.client = client + self.description = description if static_parameters is not None: self.static_parameters = static_parameters self.sync_configuration() diff --git a/lollms/server/endpoints/lollms_ttm.py b/lollms/server/endpoints/lollms_ttm.py index 45a5a85..609ad94 100644 --- a/lollms/server/endpoints/lollms_ttm.py +++ b/lollms/server/endpoints/lollms_ttm.py @@ -91,7 +91,7 @@ async def list_ttm_services(request: ServiceListingRequest): return ttm_services -@router.post("/get_active_ttm_settmngs") +@router.post("/get_active_ttm_settings") async def get_active_ttm_settmngs(request: Request): data = await request.json() check_access(lollmsElfServer,data["client_id"]) @@ -104,7 +104,7 @@ async def get_active_ttm_settmngs(request: Request): else: return {} -@router.post("/set_active_ttm_settmngs") +@router.post("/set_active_ttm_settings") async def set_active_ttm_settmngs(request: Request): data = await request.json() check_access(lollmsElfServer,data["client_id"])