diff --git a/OS/01/conversations/user.json b/OS/01/conversations/user.json index 53d74b6..58ee757 100644 --- a/OS/01/conversations/user.json +++ b/OS/01/conversations/user.json @@ -1 +1 @@ -[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}] \ No newline at end of file +[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}] diff --git a/OS/01/device.py b/OS/01/device.py index 176c501..8d675e1 100644 --- a/OS/01/device.py +++ b/OS/01/device.py @@ -177,7 +177,7 @@ async def websocket_communication(WS_URL): send_queue.put(result) except: - traceback.print_exc() + # traceback.print_exc() print(f"Connecting to `{WS_URL}`...") await asyncio.sleep(2) diff --git a/OS/01/server.py b/OS/01/server.py index 48b3582..eaeae28 100644 --- a/OS/01/server.py +++ b/OS/01/server.py @@ -112,10 +112,17 @@ async def send_messages(websocket: WebSocket): print("Sending to the device:", type(message), message) await websocket.send_json(message) -async def user_listener(): +async def listener(): audio_bytes = bytearray() while True: - message = await from_user.get() + while True: + if not from_user.empty(): + message = await from_user.get() + break + elif not from_computer.empty(): + message = from_computer.get() + break + await asyncio.sleep(1) if type(message) == str: message = json.loads(message) @@ -188,9 +195,19 @@ async def user_listener(): with open(conversation_history_path, 'w') as file: json.dump(interpreter.messages, file) - print("New message recieved. Breaking.") + print("New user message recieved. Breaking.") break + # Also check if there's any new computer messages + if not from_computer.empty(): + + with open(conversation_history_path, 'w') as file: + json.dump(interpreter.messages, file) + + print("New computer message recieved. Breaking.") + break + + async def stream_or_play_tts(sentence): if os.getenv('TTS_RUNNER') == "server": @@ -208,8 +225,8 @@ from uvicorn import Config, Server if __name__ == "__main__": async def main(): - # Start listening to the user - asyncio.create_task(user_listener()) + # Start listening + asyncio.create_task(listener()) # Start watching the kernel if it's your job to do that if os.getenv('CODE_RUNNER') == "server": diff --git a/README.md b/README.md index 72d8056..24057cf 100644 --- a/README.md +++ b/README.md @@ -4,41 +4,32 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
-## Installation +### [View task list ↗](https://github.com/KillianLucas/01/blob/main/TASKS.md) -1. **Install PortAudio and FFmpeg.** +
- ```bash - # For macOS - brew install portaudio ffmpeg +## Setup - # For Ubuntu - sudo apt-get install portaudio19-dev libav-tools - ``` +```bash +# MacOS +brew install portaudio ffmpeg -2. **Install Python dependencies.** +# Ubuntu +sudo apt-get install portaudio19-dev libav-tools +``` - ```bash - python -m pip install -r requirements.txt - ``` - -3. **(optional) Download local audio models** +```bash +python -m pip install -r requirements.txt +``` If you want to run local speech-to-text from whisper, download the GGML Whisper model from [Huggingface](https://huggingface.co/ggerganov/whisper.cpp). Then in `OS/01/start.sh`, set `ALL_LOCAL=TRUE` and set `WHISPER_MODEL_PATH` to the path of the model. ## Usage -1. **Navigate to the project directory.** - - ```bash - cd OS/01 - ``` - -2. **Run the start script.** - - ```bash - bash start.sh - ``` +```bash +cd OS/01 +bash start.sh +```
@@ -72,12 +63,7 @@ What the 01 will be able to do. Our master task list. -### [Teams ↗](https://github.com/KillianLucas/01/blob/main/TEAMS.md) - -Our (flexible) teams. -
-
+> **13** days remaining until launch -> **14** days remaining until launch