From 08cfa9e52347708a10b84a96b71eb875052b0892 Mon Sep 17 00:00:00 2001
From: killian <63927363+KillianLucas@users.noreply.github.com>
Date: Sat, 10 Feb 2024 03:01:41 -0800
Subject: [PATCH 1/3] Check for computer messages
---
OS/01/conversations/user.json | 2 +-
OS/01/device.py | 2 +-
OS/01/server.py | 27 ++++++++++++++++++++++-----
3 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/OS/01/conversations/user.json b/OS/01/conversations/user.json
index f0d4e3e..88bff71 100644
--- a/OS/01/conversations/user.json
+++ b/OS/01/conversations/user.json
@@ -1 +1 @@
-[{"role": "user", "type": "message", "content": "This is a microphone. I also have an extra microphone.\n"}]
\ No newline at end of file
+[{"role": "user", "type": "message", "content": "There's no fence, but it's like independent units.\n"}]
\ No newline at end of file
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,8 +195,18 @@ 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):
@@ -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":
From d362bcd8a8d709e31bf7db7c1d329bdc4173777b Mon Sep 17 00:00:00 2001
From: killian <63927363+KillianLucas@users.noreply.github.com>
Date: Sat, 10 Feb 2024 03:30:36 -0800
Subject: [PATCH 2/3] 13 Days
---
README.md | 46 ++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index 70e2393..64abca2 100644
--- a/README.md
+++ b/README.md
@@ -4,37 +4,35 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
-## Installation
-
-1. **Install PortAudio and FFmpeg.**
+> **13** days remaining until launch
- ```bash
- # For macOS
- brew install portaudio ffmpeg
+### [Tasks ↗](https://github.com/KillianLucas/01/blob/main/TASKS.md)
- # For Ubuntu
- sudo apt-get install portaudio19-dev libav-tools
- ```
+
-2. **Install Python dependencies.**
+## Installation
- ```bash
- python -m pip install -r requirements.txt
- ```
+```bash
+# MacOS
+brew install portaudio ffmpeg
-## Usage
+# Ubuntu
+sudo apt-get install portaudio19-dev libav-tools
+```
-1. **Navigate to the project directory.**
+```bash
+python -m pip install -r requirements.txt
+```
- ```bash
- cd OS/01
- ```
+## Usage
-2. **Run the start script.**
+```bash
+cd OS/01
+```
- ```bash
- bash start.sh
- ```
+```bash
+bash start.sh
+```
@@ -73,7 +71,3 @@ Our master task list.
Our (flexible) teams.
-
-
-
-> **14** days remaining until launch
From 80ec3f166766d605e5c07341f030264dfb1d5b02 Mon Sep 17 00:00:00 2001
From: killian <63927363+KillianLucas@users.noreply.github.com>
Date: Sat, 10 Feb 2024 03:33:18 -0800
Subject: [PATCH 3/3] Update README.md
---
README.md | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 64abca2..24f0c00 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,11 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
-> **13** days remaining until launch
-
-### [Tasks ↗](https://github.com/KillianLucas/01/blob/main/TASKS.md)
+### [View task list ↗](https://github.com/KillianLucas/01/blob/main/TASKS.md)
-## Installation
+## Setup
```bash
# MacOS
@@ -24,8 +22,6 @@ sudo apt-get install portaudio19-dev libav-tools
python -m pip install -r requirements.txt
```
-## Usage
-
```bash
cd OS/01
```
@@ -66,8 +62,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
-