From d81f5bf28e7e34446ac7ad4dbe97baa15582b46b Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 19 May 2024 13:13:20 +0200 Subject: [PATCH] addded some texts --- lollms/app.py | 2 +- lollms/media.py | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lollms/app.py b/lollms/app.py index ecb064e..b64dfed 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -71,7 +71,7 @@ class LollmsApplication(LoLLMsCom): self.generate_msg_with_internet: Callable[[str, Dict], None] = None self.handle_continue_generate_msg_from: Callable[[str, Dict], None] = None - + self.rt_com = None if not free_mode: try: if config.auto_update: diff --git a/lollms/media.py b/lollms/media.py index b37377a..36e91b8 100644 --- a/lollms/media.py +++ b/lollms/media.py @@ -94,14 +94,27 @@ from datetime import datetime import math -class AudioRecorder: +class RTCom: def __init__( self, lc:LollmsApplication, sio:socketio.Client, personality:AIPersonality, client:Client, - threshold=1000, silence_duration=2, sound_threshold_percentage=10, gain=1.0, rate=44100, channels=1, buffer_size=10, model="small.en", snd_device=None, logs_folder="logs", voice=None, block_while_talking=True, context_size=4096): + threshold=1000, + silence_duration=2, + sound_threshold_percentage=10, + gain=1.0, + rate=44100, + channels=1, + buffer_size=10, + model="small.en", + snd_device=None, + logs_folder="logs", + voice=None, + block_while_talking=True, + context_size=4096 + ): self.sio = sio self.lc = lc self.client = client @@ -353,6 +366,7 @@ class AudioRecorder: user_description = "\n!@>user information:" + self.lc.config.user_description if self.lc.config.use_user_informations_in_discussion else "" # TODO: send signal # self.transcription_signal.update_status.emit("Transcribing") + self.lc.info("Transcribing") ASCIIColors.green("<>") result = self.whisper.transcribe(str(Path(self.logs_folder)/filename)) transcription_fn = str(Path(self.logs_folder)/filename) + ".txt" @@ -369,6 +383,7 @@ class AudioRecorder: # TODO : send the output # self.transcription_signal.update_status.emit("Generating answer") ASCIIColors.green("<>") + self.lc.info("Responding") self.lc.handle_generate_msg(self.client.client_id, {"prompt": current_prompt}) while self.lc.busy: time.sleep(0.01) @@ -383,6 +398,7 @@ class AudioRecorder: trace_exception(ex) self.block_listening = False ASCIIColors.green("<>") + self.lc.info("Listening") # TODO : send the output #self.transcription_signal.update_status.emit("Listening")