Merge remote-tracking branch 'upstream/main' into u/shivenmian/local

pull/11/head
Shiven Mian 12 months ago
commit 9ce3540672

@ -1 +1 @@
[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}]
[{"role": "user", "type": "message", "content": " Hello, how you doing?\n"}]

@ -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)

@ -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":

@ -4,41 +4,32 @@ Official repository for [The 01 Project](https://twitter.com/hellokillian/status
<br>
## 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
<br>
# For Ubuntu
sudo apt-get install portaudio19-dev libav-tools
```
## Setup
2. **Install Python dependencies.**
```bash
# MacOS
brew install portaudio ffmpeg
```bash
python -m pip install -r requirements.txt
```
# Ubuntu
sudo apt-get install portaudio19-dev libav-tools
```
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
```
<br>
@ -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.
<br>
<br>
> **13** days remaining until launch
> **14** days remaining until launch

Loading…
Cancel
Save