-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.py
More file actions
58 lines (49 loc) · 1.45 KB
/
dev.py
File metadata and controls
58 lines (49 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import subprocess
import time
import os
import signal
import sys
def run_process(command, cwd=None, title=None):
print(f"Starting {title}...")
return subprocess.Popen(
command,
cwd=cwd,
shell=True,
creationflags=subprocess.CREATE_NEW_CONSOLE
)
if __name__ == "__main__":
base_dir = os.path.dirname(os.path.abspath(__file__))
backend_dir = os.path.join(base_dir, "backend")
frontend_dir = os.path.join(base_dir, "frontend")
processes = []
try:
# 1. Start API Server
api_proc = run_process(
f'"{sys.executable}" run_server.py',
cwd=backend_dir,
title="API Server"
)
processes.append(api_proc)
time.sleep(2) # Give API time to start
# 2. Start Agent Worker
agent_proc = run_process(
f'"{sys.executable}" run_agent.py dev',
cwd=backend_dir,
title="Voice Agent Worker"
)
processes.append(agent_proc)
# 3. Start Frontend
frontend_proc = run_process(
"npm run dev",
cwd=frontend_dir,
title="Frontend Vite"
)
processes.append(frontend_proc)
print("\nAll services started. Press Ctrl+C to stop.")
while True:
time.sleep(1)
except KeyboardInterrupt:
print("\nStopping services...")
for p in processes:
p.terminate()
sys.exit(0)