-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
136 lines (117 loc) · 3.83 KB
/
start.bat
File metadata and controls
136 lines (117 loc) · 3.83 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
@echo off
setlocal EnableDelayedExpansion
echo ==========================================
echo SpeakEasy Startup Script
echo ==========================================
REM -------------------------------------------------------------------------
REM Pre-flight Checks
REM -------------------------------------------------------------------------
echo [CHECK] Verifying environment...
REM Check Python
python --version >nul 2>&1
if !errorlevel! neq 0 (
echo [ERROR] Python is not installed or not in PATH.
echo [INFO] Please install Python 3.10-3.12 from https://python.org
pause
exit /b 1
)
REM Check Node.js
node --version >nul 2>&1
if !errorlevel! neq 0 (
echo [ERROR] Node.js is not installed or not in PATH.
echo [INFO] Please install Node.js 18+ from https://nodejs.org
pause
exit /b 1
)
REM Check FFmpeg (optional but recommended)
ffmpeg -version >nul 2>&1
if !errorlevel! neq 0 (
echo [WARN] FFmpeg not found. Audio file transcription will not work.
echo [INFO] Install from https://ffmpeg.org
timeout /t 3 >nul
)
REM Check UV package manager
uv --version >nul 2>&1
if !errorlevel! neq 0 (
echo [INFO] Installing UV package manager...
pip install uv
if !errorlevel! neq 0 (
echo [WARN] Failed to install UV. Continuing with pip...
)
)
REM -------------------------------------------------------------------------
REM Setup Backend if needed
REM -------------------------------------------------------------------------
if exist "backend" (
cd backend
REM Check virtual environment - must exist AND be valid
set "VENV_VALID=false"
if exist ".venv" (
if exist ".venv\pyvenv.cfg" (
if exist ".venv\Scripts\python.exe" (
set "VENV_VALID=true"
)
)
)
if "!VENV_VALID!"=="false" (
echo [INFO] Creating Python virtual environment...
if exist ".venv" (
echo [INFO] Removing broken virtual environment...
rmdir /s /q .venv
)
uv venv --python 3.12 2>nul || uv venv --python 3.11 2>nul || uv venv --python 3.10
if !errorlevel! neq 0 (
echo [ERROR] Failed to create virtual environment.
pause
exit /b 1
)
)
REM Use venv Python directly (no need to activate)
set "VENV_PYTHON=.venv\Scripts\python.exe"
REM Check if dependencies are installed using comprehensive check
"!VENV_PYTHON!" check_deps.py >nul 2>&1
if !errorlevel! neq 0 (
echo [INFO] Installing backend dependencies...
"!VENV_PYTHON!" -m pip install -e ".[cuda]" 2>nul || "!VENV_PYTHON!" -m pip install -e .
REM Re-check after install
"!VENV_PYTHON!" check_deps.py >nul 2>&1
if !errorlevel! neq 0 (
echo [ERROR] Failed to install all dependencies.
echo [INFO] Please run reinstall_backend.bat to repair the installation.
pause
exit /b 1
)
)
cd ..
)
REM -------------------------------------------------------------------------
REM 1. Start Frontend (which handles Backend)
REM -------------------------------------------------------------------------
echo [INFO] Starting Application...
cd /d "%~dp0"
if exist "gui" (
cd gui
REM Check if node_modules exists
if not exist "node_modules" (
echo [WARN] node_modules not found in gui.
echo [INFO] Running npm install...
call npm install
if !errorlevel! neq 0 (
echo [ERROR] npm install failed.
pause
exit /b 1
)
)
echo [INFO] Starting Electron App...
REM This will start the electron app, which spawns the backend
npm run dev
cd ..
) else (
echo [ERROR] 'gui' directory not found!
pause
exit /b 1
)
echo.
echo [SUCCESS] Application exited.
timeout /t 3 >nul
exit