Bug fixes, CTRL-C fix, relative script fixes, less print statements

pull/39/head
killian 11 months ago
parent f2e51dd14f
commit 3571382a9f

@ -129,7 +129,7 @@ class Device:
self.audiosegments.remove(audio)
await asyncio.sleep(0.1)
except:
traceback.print_exc()
logger.debug(f"Non fatal error, retrying: ", traceback.format_exc())
def record_audio(self):
@ -207,13 +207,10 @@ class Device:
RECORDING = False
def on_press(self, key):
"""Detect spacebar press, ESC key press, and Ctrl+C combination."""
"""Detect spacebar press and Ctrl+C combination."""
self.pressed_keys.add(key) # Add the pressed key to the set
if keyboard.Key.esc in self.pressed_keys:
logger.info("Exiting...")
os._exit(0)
elif keyboard.Key.space in self.pressed_keys:
if keyboard.Key.space in self.pressed_keys:
self.toggle_recording(True)
elif {keyboard.Key.ctrl, keyboard.KeyCode.from_char('c')} <= self.pressed_keys:
logger.info("Ctrl+C pressed. Exiting...")
@ -244,9 +241,9 @@ class Device:
try:
async with websockets.connect(WS_URL) as websocket:
if CAMERA_ENABLED:
logger.info("Press the spacebar to start/stop recording. Press 'c' to capture an image from the camera. Press ESC to exit.")
logger.info("Press the spacebar to start/stop recording. Press 'c' to capture an image from the camera. Press CTRL-C to exit.")
else:
logger.info("Press the spacebar to start/stop recording. Press ESC to exit.")
logger.info("Press the spacebar to start/stop recording. Press CTRL-C to exit.")
asyncio.create_task(self.message_sender(websocket))
@ -285,7 +282,7 @@ class Device:
except:
traceback.print_exc()
logger.debug(f"Non fatal error, retrying: ", traceback.format_exc())
logger.info(f"Connecting to `{WS_URL}`...")
await asyncio.sleep(2)

@ -1,8 +1,6 @@
DEVICE=$(uname -n)
if [[ "$DEVICE" == "rpi" ]]; then
cd 01OS
python -m 01OS.clients.rpi.device
else
cd 01OS
python -m 01OS.clients.macos.device
fi

@ -102,7 +102,7 @@ async def websocket_endpoint(websocket: WebSocket):
try:
await asyncio.gather(receive_task, send_task)
except Exception as e:
traceback.print_exc()
logger.debug(f"Non fatal error, retrying: ", traceback.format_exc())
logger.info(f"Connection lost. Error: {e}")
async def receive_messages(websocket: WebSocket):

@ -4,7 +4,7 @@ class Accumulator:
self.message = self.template
def accumulate(self, chunk):
print(str(chunk)[:100])
#print(str(chunk)[:100])
if type(chunk) == dict:
if "format" in chunk and chunk["format"] == "active_line":

@ -122,7 +122,7 @@ def on_press(key):
toggle_recording(True)
def on_release(key):
"""Detect spacebar release and ESC key press."""
"""Detect spacebar release and CTRL-C key press."""
if key == keyboard.Key.space:
toggle_recording(False)
elif key == keyboard.Key.esc:

@ -4,7 +4,7 @@ packages = [
{include = "01OS"},
]
include = [".env.example", "start.py", "start.sh"]
version = "0.0.2"
version = "0.0.3"
description = "The open-source language model computer"
authors = ["Killian <killian@openinterpreter.com>"]
license = "AGPL"

@ -19,5 +19,8 @@ def main():
command = [os.path.join(dir_path, 'start.sh')] + args
# Start start.sh with the command line arguments
subprocess.run(command, check=True)
try:
subprocess.run(command, check=True)
except KeyboardInterrupt:
print("Exiting...")

@ -124,7 +124,7 @@ fi
start_client() {
echo "Starting client..."
bash 01OS/clients/start.sh &
bash $SCRIPT_DIR/01OS/clients/start.sh &
CLIENT_PID=$!
echo "client started as process $CLIENT_PID"
}

Loading…
Cancel
Save