From 0a2e14c473875440944efaa194e220e9a7c479c2 Mon Sep 17 00:00:00 2001 From: Julie <22972550+Cobular@users.noreply.github.com> Date: Fri, 22 Mar 2024 21:08:17 -0700 Subject: [PATCH 1/6] Fix default websocket port! --- software/source/clients/esp32/src/client/client.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software/source/clients/esp32/src/client/client.ino b/software/source/clients/esp32/src/client/client.ino index ee18163d..ead53ec5 100644 --- a/software/source/clients/esp32/src/client/client.ino +++ b/software/source/clients/esp32/src/client/client.ino @@ -668,7 +668,7 @@ void websocket_setup(String server_domain, int port) return; } Serial.println("connected to WiFi"); - webSocket.begin(server_domain, 80, "/"); + webSocket.begin(server_domain, port, "/"); webSocket.onEvent(webSocketEvent); // webSocket.setAuthorization("user", "Password"); webSocket.setReconnectInterval(5000); @@ -798,4 +798,4 @@ void loop() M5.update(); webSocket.loop(); } -} \ No newline at end of file +} From d5cd89ac5d2c8db04d9eeda83dfbb81f733548bf Mon Sep 17 00:00:00 2001 From: gibru Date: Sun, 24 Mar 2024 12:02:44 +0100 Subject: [PATCH 2/6] fixing typo --- CONTEXT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTEXT.md b/CONTEXT.md index 27dc5e17..7b53070d 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -12,7 +12,7 @@ That should be compatible with other popular systems. For example, I think [LMC We need to pick a niche. I wonder if startups is the right niche for us (use the 01 to build and sell your own Tab, Pin, Rabbit, etc) or if we should go with education, as the Raspberry Pi and Arduino did. Computer science departments is where UNIX took hold. -4. **Be afforable.** +4. **Be affordable.** The most hackable, most basic 01 MUST be under $100, ideally under $70. From 7863497ac8ab66cbb23146a079af61a29efd0653 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sun, 24 Mar 2024 12:08:44 -0500 Subject: [PATCH 3/6] Fix empty message array error when running on Windows --- software/source/server/utils/kernel.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/software/source/server/utils/kernel.py b/software/source/server/utils/kernel.py index b443bbaf..e8ac7fb1 100644 --- a/software/source/server/utils/kernel.py +++ b/software/source/server/utils/kernel.py @@ -45,15 +45,16 @@ def custom_filter(message): def check_filtered_kernel(): messages = get_kernel_messages() - messages.replace(last_messages, "") - messages = messages.split("\n") - - filtered_messages = [] - for message in messages: - if custom_filter(message): - filtered_messages.append(message) - - return "\n".join(filtered_messages) + if messages: + messages.replace(last_messages, "") + messages = messages.split("\n") + + filtered_messages = [] + for message in messages: + if custom_filter(message): + filtered_messages.append(message) + + return "\n".join(filtered_messages) async def put_kernel_messages_into_queue(queue): while True: From 97efc6cd96e702ece717cafb44d75a1050105522 Mon Sep 17 00:00:00 2001 From: Yuan-Man <68322456+Yuan-ManX@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:06:10 +0800 Subject: [PATCH 4/6] Update README_CN.md --- docs/README_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README_CN.md b/docs/README_CN.md index aae66907..ffab9329 100644 --- a/docs/README_CN.md +++ b/docs/README_CN.md @@ -5,7 +5,7 @@

The open-source language model computer.(开源大语言模型计算机)
- +
预订 Light‎‎ ‎ |‎ ‎ 获取更新‎‎ ‎ |‎ ‎ 文档


From b435f749b8f95e1017e275593097dd93136bf739 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Tue, 26 Mar 2024 00:36:44 +0900 Subject: [PATCH 5/6] Update TASKS.md Seperate -> Separate --- TASKS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TASKS.md b/TASKS.md index 4f6e4e03..8197dd65 100644 --- a/TASKS.md +++ b/TASKS.md @@ -55,7 +55,7 @@ - [ ] Can tapping the mic twice = trigger pressing the "button"? Simple sensing, just based on volume spikes? - [ ] Update Architecture - [ ] Base Devise Class - - [ ] Seperate folders for Rasberry Pi, Desktop, Droid, App, Web + - [ ] Separate folders for Rasberry Pi, Desktop, Droid, App, Web - [ ] device.py for each folder has input logic for that device - [ ] Add basic TUI to device.py. Just renders messages and lets you add messages. Can easily copy OI's TUI. - [ ] index.html for each folder has user interface for that device From f7a2f0317cd7c0ed876551c8d0c5b4f018da06c6 Mon Sep 17 00:00:00 2001 From: Tasha Upchurch Date: Tue, 26 Mar 2024 17:18:40 -0400 Subject: [PATCH 6/6] Implement cross-platform compatibility in stt.py by replacing system-specific commands with Python's built-in functions --- .../server/services/stt/local-whisper/stt.py | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/software/source/server/services/stt/local-whisper/stt.py b/software/source/server/services/stt/local-whisper/stt.py index b318e8e8..727154da 100644 --- a/software/source/server/services/stt/local-whisper/stt.py +++ b/software/source/server/services/stt/local-whisper/stt.py @@ -12,6 +12,8 @@ import os import subprocess +import platform +import urllib.request class Stt: @@ -23,7 +25,6 @@ def stt(self, audio_file_path): return stt(self.service_directory, audio_file_path) - def install(service_dir): ### INSTALL @@ -42,27 +43,29 @@ def install(service_dir): # Check if whisper-rust executable exists before attempting to build if not os.path.isfile(os.path.join(WHISPER_RUST_PATH, "target/release/whisper-rust")): # Check if Rust is installed. Needed to build whisper executable - rust_check = subprocess.call('command -v rustc', shell=True) - if rust_check != 0: + rustc_path = shutil.which('rustc') + if rustc_path is None: print("Rust is not installed or is not in system PATH. Please install Rust before proceeding.") exit(1) - + # Build Whisper Rust executable if not found - subprocess.call('cargo build --release', shell=True) + subprocess.run(['cargo', 'build', '--release'], check=True) else: print("Whisper Rust executable already exists. Skipping build.") WHISPER_MODEL_PATH = os.path.join(service_dir, "model") - + WHISPER_MODEL_NAME = os.getenv('WHISPER_MODEL_NAME', 'ggml-tiny.en.bin') WHISPER_MODEL_URL = os.getenv('WHISPER_MODEL_URL', 'https://huggingface.co/ggerganov/whisper.cpp/resolve/main/') - + if not os.path.isfile(os.path.join(WHISPER_MODEL_PATH, WHISPER_MODEL_NAME)): os.makedirs(WHISPER_MODEL_PATH, exist_ok=True) - subprocess.call(f'curl -L "{WHISPER_MODEL_URL}{WHISPER_MODEL_NAME}" -o "{os.path.join(WHISPER_MODEL_PATH, WHISPER_MODEL_NAME)}"', shell=True) + urllib.request.urlretrieve(f"{WHISPER_MODEL_URL}{WHISPER_MODEL_NAME}", + os.path.join(WHISPER_MODEL_PATH, WHISPER_MODEL_NAME)) else: print("Whisper model already exists. Skipping download.") + def convert_mime_type_to_format(mime_type: str) -> str: if mime_type == "audio/x-wav" or mime_type == "audio/wav": return "wav" @@ -73,6 +76,7 @@ def convert_mime_type_to_format(mime_type: str) -> str: return mime_type + @contextlib.contextmanager def export_audio_to_wav_ffmpeg(audio: bytearray, mime_type: str) -> str: temp_dir = tempfile.gettempdir() @@ -105,10 +109,12 @@ def export_audio_to_wav_ffmpeg(audio: bytearray, mime_type: str) -> str: os.remove(input_path) os.remove(output_path) + def run_command(command): result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) return result.stdout, result.stderr + def get_transcription_file(service_directory, wav_file_path: str): local_path = os.path.join(service_directory, 'model') whisper_rust_path = os.path.join(service_directory, 'whisper-rust', 'target', 'release') @@ -124,14 +130,15 @@ def get_transcription_file(service_directory, wav_file_path: str): def stt_wav(service_directory, wav_file_path: str): - temp_dir = tempfile.gettempdir() - output_path = os.path.join(temp_dir, f"output_stt_{datetime.now().strftime('%Y%m%d%H%M%S%f')}.wav") - ffmpeg.input(wav_file_path).output(output_path, acodec='pcm_s16le', ac=1, ar='16k').run() - try: - transcript = get_transcription_file(service_directory, output_path) - finally: - os.remove(output_path) - return transcript + temp_dir = tempfile.gettempdir() + output_path = os.path.join(temp_dir, f"output_stt_{datetime.now().strftime('%Y%m%d%H%M%S%f')}.wav") + ffmpeg.input(wav_file_path).output(output_path, acodec='pcm_s16le', ac=1, ar='16k').run() + try: + transcript = get_transcription_file(service_directory, output_path) + finally: + os.remove(output_path) + return transcript + def stt(service_directory, input_data): - return stt_wav(service_directory, input_data) \ No newline at end of file + return stt_wav(service_directory, input_data)