pull/73/head
killian 10 months ago
parent 3ff1397078
commit cadbeb751c

@ -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? # 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.kernel import put_kernel_messages_into_queue
from ..server.utils.get_system_info import get_system_info 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.process_utils import kill_process_tree
from ..server.utils.logs import setup_logging from ..server.utils.logs import setup_logging
from ..server.utils.logs import logger from ..server.utils.logs import logger
setup_logging() setup_logging()
os.environ["STT_RUNNER"] = "server"
os.environ["TTS_RUNNER"] = "server"
from ..utils.accumulator import Accumulator from ..utils.accumulator import Accumulator
@ -183,6 +184,10 @@ class Device:
self.queue_all_captured_images() self.queue_all_captured_images()
if os.getenv('STT_RUNNER') == "client": 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 # Run stt then send text
text = stt_wav(wav_path) text = stt_wav(wav_path)
logger.debug(f"STT result: {text}") logger.debug(f"STT result: {text}")

@ -213,6 +213,13 @@ async def listener():
# Format will be bytes.wav or bytes.opus # Format will be bytes.wav or bytes.opus
mime_type = "audio/" + message["format"].split(".")[1] mime_type = "audio/" + message["format"].split(".")[1]
audio_file_path = bytes_to_wav(message["content"], mime_type) 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) text = stt(audio_file_path)
print(text) print(text)
message = {"role": "user", "type": "message", "content": text} message = {"role": "user", "type": "message", "content": text}

@ -45,7 +45,6 @@ def export_audio_to_wav_ffmpeg(audio: bytearray, mime_type: str) -> str:
yield output_path yield output_path
finally: finally:
os.remove(input_path) os.remove(input_path)
os.remove(output_path)
def run_command(command): def run_command(command):
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

@ -4,7 +4,7 @@ packages = [
{include = "01OS"}, {include = "01OS"},
] ]
include = [".env.example", "start.py", "start.sh"] include = [".env.example", "start.py", "start.sh"]
version = "0.0.9" version = "0.0.10"
description = "The open-source language model computer" description = "The open-source language model computer"
authors = ["Killian <killian@openinterpreter.com>"] authors = ["Killian <killian@openinterpreter.com>"]
license = "AGPL" license = "AGPL"
@ -36,7 +36,7 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts] [tool.poetry.scripts]
01 = "01OS.start:app" 01 = "start:app"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^23.10.1" black = "^23.10.1"

@ -5,7 +5,7 @@ import concurrent.futures
import threading import threading
import os import os
import importlib import importlib
from .server.tunnel import create_tunnel create_tunnel = importlib.import_module(".server.tunnel", package="01OS").create_tunnel
import signal import signal
app = typer.Typer() app = typer.Typer()
@ -56,7 +56,7 @@ def run(
signal.signal(signal.SIGINT, handle_exit) signal.signal(signal.SIGINT, handle_exit)
if server: if server:
from .server.server import main main = importlib.import_module(".server.server", package="01OS").main
loop = asyncio.new_event_loop() loop = asyncio.new_event_loop()
asyncio.set_event_loop(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),)) 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),))
Loading…
Cancel
Save