run worker in dev mode

pull/314/head
Ben Xu 4 weeks ago
parent 3f6ba52a0e
commit 7207add614

@ -192,7 +192,7 @@ def run(
try: try:
response = requests.get(url) response = requests.get(url)
if response.status_code == 200: if response.status_code == 200:
print("livekit server is running") continue
else: else:
print("request failed: ", response.status_code) print("request failed: ", response.status_code)
break break
@ -205,7 +205,6 @@ def run(
os.killpg(os.getpgid(process.pid), signal.SIGTERM) os.killpg(os.getpgid(process.pid), signal.SIGTERM)
except ProcessLookupError: except ProcessLookupError:
pass # Process group already terminated pass # Process group already terminated
# Start the livekit server # Start the livekit server
if debug: if debug:
@ -302,8 +301,8 @@ def run(
.with_name("You") \ .with_name("You") \
.with_grants(api.VideoGrants( .with_grants(api.VideoGrants(
room_join=True, room_join=True,
room=ROOM_NAME, room=ROOM_NAME,))
)).to_jwt()) .to_jwt())
### DISPLAY QR CODE ### DISPLAY QR CODE
if qr: if qr:
@ -360,8 +359,7 @@ def run(
spinner.stop() spinner.stop()
print(f"\nOpening meet interface at: {meet_url}") print(f"\nOpening meet interface at: {meet_url}")
webbrowser.open(meet_url) webbrowser.open(meet_url)
print(f"multimodal flag is: {multimodal}")
try: try:
if multimodal: if multimodal:
multimodal_main(url) multimodal_main(url)

@ -2,7 +2,6 @@ import asyncio
import numpy as np import numpy as np
import sys import sys
import os import os
import threading
from datetime import datetime from datetime import datetime
from typing import Literal, Awaitable from typing import Literal, Awaitable
@ -25,11 +24,6 @@ load_dotenv()
_room_lock = threading.Lock()
_connected_rooms = set()
START_MESSAGE = "Hi! You can hold the white circle below to speak to me. Try asking what I can do." START_MESSAGE = "Hi! You can hold the white circle below to speak to me. Try asking what I can do."
# This function is the entrypoint for the agent. # This function is the entrypoint for the agent.
@ -449,14 +443,14 @@ def main(livekit_url: str):
# Modify sys.argv to set the path to this file as the first argument # Modify sys.argv to set the path to this file as the first argument
# and 'dev' as the second argument # and 'dev' as the second argument
sys.argv = [str(__file__), 'start'] sys.argv = [str(__file__), 'dev']
# Initialize the worker with the entrypoint # Initialize the worker with the entrypoint
cli.run_app( cli.run_app(
WorkerOptions( WorkerOptions(
entrypoint_fnc=entrypoint, entrypoint_fnc=entrypoint,
api_key="devkey", api_key="devkey",
api_secret="secret", api_secret="secret",
ws_url=livekit_url ws_url=livekit_url
) )

Loading…
Cancel
Save