Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to schedule function #84

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Change port number to 10001
  • Loading branch information
tyfiero committed Mar 21, 2024
commit 310052d71d5e587750ffddd358ab1509b7e5aaab
4 changes: 2 additions & 2 deletions 01OS/01OS/clients/base_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ async def websocket_communication(self, WS_URL):
try:
async with websockets.connect(WS_URL) as websocket:
if CAMERA_ENABLED:
print("Press the spacebar to start/stop recording. Press 'c' to capture an image from the camera. Press CTRL-C to exit.")
print("\nPress the spacebar to start/stop recording. Press 'c' to capture an image from the camera. Press CTRL-C to exit.")
else:
print("Press the spacebar to start/stop recording. Press CTRL-C to exit.")
print("\nPress the spacebar to start/stop recording. Press CTRL-C to exit.")

asyncio.create_task(self.message_sender(websocket))

Expand Down
2 changes: 1 addition & 1 deletion 01OS/01OS/clients/esp32/src/client/client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <WebSocketsClient.h>

String server_domain = "";
int server_port = 8000;
int server_port = 10001;

// ----------------------- START OF WIFI CAPTIVE PORTAL -------------------

Expand Down
5 changes: 1 addition & 4 deletions 01OS/01OS/server/i.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@ def configure_interpreter(interpreter: OpenInterpreter):
with open(file, "r") as f:
code_to_run += f.read() + "\n"

print("IMPORTING SKILLS:\n", code_to_run)

for line in interpreter.computer.run("python", code_to_run, stream=True):
print(line)
interpreter.computer.run("python", code_to_run)

interpreter.computer.save_skills = True

Expand Down
2 changes: 1 addition & 1 deletion 01OS/01OS/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
app_dir = user_data_dir('01')
conversation_history_path = os.path.join(app_dir, 'conversations', 'user.json')

SERVER_LOCAL_PORT = int(os.getenv('SERVER_LOCAL_PORT', 8000))
SERVER_LOCAL_PORT = int(os.getenv('SERVER_LOCAL_PORT', 10001))


# This is so we only say() full sentences
Expand Down
2 changes: 1 addition & 1 deletion 01OS/01OS/server/skills/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def schedule(message="", start=None, interval=None) -> None:
escaped_question = prefixed_message.replace('"', '\\"')
json_data = f"{{\\\"text\\\": \\\"{escaped_question}\\\"}}"

command = f'''bash -c 'if [ "$(cat "{session_file_path}")" == "{file_session_value}" ]; then /usr/bin/curl -X POST -H "Content-Type: application/json" -d "{json_data}" http://localhost:8000/; fi' '''
command = f'''bash -c 'if [ "$(cat "{session_file_path}")" == "{file_session_value}" ]; then /usr/bin/curl -X POST -H "Content-Type: application/json" -d "{json_data}" http://localhost:10001/; fi' '''

cron = CronTab(user=True)
job = cron.new(command=command)
Expand Down
2 changes: 1 addition & 1 deletion 01OS/01OS/server/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from ..utils.print_markdown import print_markdown

def create_tunnel(tunnel_method='ngrok', server_host='localhost', server_port=8000):
def create_tunnel(tunnel_method='ngrok', server_host='localhost', server_port=10001):
print_markdown(f"Exposing server to the internet...")

if tunnel_method == "bore":
Expand Down
4 changes: 2 additions & 2 deletions 01OS/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def run(
server: bool = typer.Option(False, "--server", help="Run server"),
server_host: str = typer.Option("0.0.0.0", "--server-host", help="Specify the server host where the server will deploy"),
server_port: int = typer.Option(8000, "--server-port", help="Specify the server port where the server will deploy"),
server_port: int = typer.Option(10001, "--server-port", help="Specify the server port where the server will deploy"),

tunnel_service: str = typer.Option("ngrok", "--tunnel-service", help="Specify the tunnel service"),
expose: bool = typer.Option(False, "--expose", help="Expose server to internet"),
Expand Down Expand Up @@ -62,7 +62,7 @@ def run(
def _run(
server: bool = False,
server_host: str = "0.0.0.0",
server_port: int = 8000,
server_port: int = 10001,

tunnel_service: str = "bore",
expose: bool = False,
Expand Down
6 changes: 3 additions & 3 deletions archive/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ PIPER_VOICE_NAME="en_US-lessac-medium.onnx"

# If SERVER_START, this is where we'll serve the server.
# If CLIENT_START, this is where the client expects the server to be.
# SERVER_URL=ws://localhost:8000/
SERVER_URL=ws://0.0.0.0:8000/
# SERVER_URL=ws://localhost:10001/
SERVER_URL=ws://0.0.0.0:10001/
SERVER_START=True
CLIENT_START=True

# The port to start the local server on
SERVER_LOCAL_PORT=8000
SERVER_LOCAL_PORT=10001

# Explicitly set the client type (macos, rpi)
CLIENT_TYPE=auto
Expand Down
4 changes: 2 additions & 2 deletions archive/tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# - ngrok
TUNNEL_METHOD=${TUNNEL_METHOD:-bore}

# Get the SERVER_PORT environment variable, but default to 8000
SERVER_LOCAL_PORT=${SERVER_LOCAL_PORT:-8000}
# Get the SERVER_PORT environment variable, but default to 10001
SERVER_LOCAL_PORT=${SERVER_LOCAL_PORT:-10001}

echo "Using $TUNNEL_METHOD to expose port $SERVER_LOCAL_PORT on localhost..."

Expand Down
2 changes: 1 addition & 1 deletion docs/server/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ For more information, please read about <a href="/services/speech-to-text">speec

- `--server-port INTEGER`
Specify the server port where the server will deploy.
Default: `8000`.
Default: `10001`.

- `--tunnel-service TEXT`
Specify the tunnel service.
Expand Down
Loading