run worker in dev mode
This commit is contained in:
		
							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
 | 
				
			||||||
| 
						 | 
					@ -206,7 +206,6 @@ def run(
 | 
				
			||||||
                    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:
 | 
				
			||||||
                command = f'livekit-server --dev --bind "{server_host}" --port {server_port}'
 | 
					                command = f'livekit-server --dev --bind "{server_host}" --port {server_port}'
 | 
				
			||||||
| 
						 | 
					@ -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:
 | 
				
			||||||
| 
						 | 
					@ -361,7 +360,6 @@ def run(
 | 
				
			||||||
                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,7 +443,7 @@ 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(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue