2026-09-03 00:10:18 +04:00

64 lines
1.9 KiB
Batchfile

@echo off
REM ===========================================================================
REM AGIBOT A3 - Voice Control | Windows launcher
REM Double-click this file, then open http://localhost:8000
REM ===========================================================================
setlocal
cd /d "%~dp0"
echo.
echo AGIBOT A3 - Voice Control
echo ----------------------------------------------
REM --- locate Python ---------------------------------------------------------
set "PY=python"
where python >nul 2>&1
if errorlevel 1 (
where py >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python was not found on this PC.
echo Install Python 3.9+ from https://python.org and tick
echo "Add python.exe to PATH" during setup.
echo.
pause
exit /b 1
)
set "PY=py -3"
)
REM --- first-run config ------------------------------------------------------
if not exist ".env" (
echo Creating .env from .env.example ...
copy /y ".env.example" ".env" >nul
)
REM --- dependencies ----------------------------------------------------------
%PY% -c "import fastapi, uvicorn, dotenv, httpx" >nul 2>&1
if errorlevel 1 (
echo Installing dependencies ^(first run only^) ...
%PY% -m pip install --disable-pip-version-check -q -r requirements.txt
if errorlevel 1 (
echo [ERROR] Dependency installation failed. Run this by hand:
echo %PY% -m pip install -r requirements.txt
echo.
pause
exit /b 1
)
)
REM --- run -------------------------------------------------------------------
echo Starting server ... http://localhost:8000
echo Press Ctrl+C to stop.
echo.
REM Open the browser a few seconds late, so the page loads against a server that
REM is already listening instead of showing a connection error.
start "" /min cmd /c "timeout /t 4 /nobreak >nul & start "" http://localhost:8000"
%PY% backend\main.py
echo.
echo Server stopped.
pause
endlocal