diff --git a/01OS/01OS/clients/base_device.py b/01OS/01OS/clients/base_device.py index 7674d42..f5b329f 100644 --- a/01OS/01OS/clients/base_device.py +++ b/01OS/01OS/clients/base_device.py @@ -28,13 +28,14 @@ from interpreter import interpreter # Just for code execution. Maybe we should l # In the future, I guess kernel watching code should be elsewhere? Somewhere server / client agnostic? from ..server.utils.kernel import put_kernel_messages_into_queue from ..server.utils.get_system_info import get_system_info -from ..server.stt.stt import stt_wav from ..server.utils.process_utils import kill_process_tree from ..server.utils.logs import setup_logging from ..server.utils.logs import logger setup_logging() +os.environ["STT_RUNNER"] = "server" +os.environ["TTS_RUNNER"] = "server" from ..utils.accumulator import Accumulator @@ -183,6 +184,10 @@ class Device: self.queue_all_captured_images() if os.getenv('STT_RUNNER') == "client": + + # THIS DOES NOT WORK. We moved to this very cool stt_service, llm_service + # way of doing things. stt_wav is not a thing anymore. Needs work to work + # Run stt then send text text = stt_wav(wav_path) logger.debug(f"STT result: {text}") diff --git a/01OS/01OS/server/server.py b/01OS/01OS/server/server.py index 6313bc7..9ad7e10 100644 --- a/01OS/01OS/server/server.py +++ b/01OS/01OS/server/server.py @@ -213,6 +213,13 @@ async def listener(): # Format will be bytes.wav or bytes.opus mime_type = "audio/" + message["format"].split(".")[1] audio_file_path = bytes_to_wav(message["content"], mime_type) + + # For microphone debugging: + if False: + os.system(f"open {audio_file_path}") + import time + time.sleep(15) + text = stt(audio_file_path) print(text) message = {"role": "user", "type": "message", "content": text} diff --git a/01OS/01OS/server/utils/bytes_to_wav.py b/01OS/01OS/server/utils/bytes_to_wav.py index fffa411..3d84814 100644 --- a/01OS/01OS/server/utils/bytes_to_wav.py +++ b/01OS/01OS/server/utils/bytes_to_wav.py @@ -45,7 +45,6 @@ def export_audio_to_wav_ffmpeg(audio: bytearray, mime_type: str) -> str: yield output_path finally: os.remove(input_path) - os.remove(output_path) def run_command(command): result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) diff --git a/01OS/pyproject.toml b/01OS/pyproject.toml index 8539dff..6342e02 100644 --- a/01OS/pyproject.toml +++ b/01OS/pyproject.toml @@ -4,7 +4,7 @@ packages = [ {include = "01OS"}, ] include = [".env.example", "start.py", "start.sh"] -version = "0.0.9" +version = "0.0.10" description = "The open-source language model computer" authors = ["Killian "] license = "AGPL" @@ -36,7 +36,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] -01 = "01OS.start:app" +01 = "start:app" [tool.poetry.group.dev.dependencies] black = "^23.10.1" diff --git a/01OS/01OS/start.py b/01OS/start.py similarity index 96% rename from 01OS/01OS/start.py rename to 01OS/start.py index 906c41b..34a0775 100644 --- a/01OS/01OS/start.py +++ b/01OS/start.py @@ -5,7 +5,7 @@ import concurrent.futures import threading import os import importlib -from .server.tunnel import create_tunnel +create_tunnel = importlib.import_module(".server.tunnel", package="01OS").create_tunnel import signal app = typer.Typer() @@ -56,7 +56,7 @@ def run( signal.signal(signal.SIGINT, handle_exit) if server: - from .server.server import main + main = importlib.import_module(".server.server", package="01OS").main loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) server_thread = threading.Thread(target=loop.run_until_complete, args=(main(server_host, server_port, llm_service, model, llm_supports_vision, llm_supports_functions, context_window, max_tokens, temperature, tts_service, stt_service),)) diff --git a/01OS/tunnel.sh b/archive/tunnel.sh similarity index 100% rename from 01OS/tunnel.sh rename to archive/tunnel.sh