Files
baiyue-logistics-chat/start.bat
T

74 lines
1.8 KiB
Batchfile

@echo off
chcp 936 >nul
title Baiyue Logistics AI Customer Service
cd /d "%~dp0"
echo ============================================
echo Baiyue Logistics AI Customer Service
echo ============================================
echo.
where python >nul 2>nul
if errorlevel 1 (
echo [ERROR] python not found. Install Python and tick "Add to PATH".
echo.
pause
exit /b 1
)
echo [1/3] Checking port 5000 ...
netstat -ano | findstr "LISTENING" | findstr /C:":5000 " >nul
if not errorlevel 1 (
echo.
echo [INFO] Port 5000 is already in use, a server is probably running:
echo.
netstat -ano | findstr "LISTENING" | findstr /C:":5000 "
echo.
echo The last column is the process id. To stop it:
echo taskkill /PID 12345 /F
echo.
start "" http://127.0.0.1:5000
echo Browser opened. Press any key to close this window.
pause
exit /b 0
)
echo OK - port is free.
echo [2/3] Checking DEEPSEEK_API_KEY ...
if "%DEEPSEEK_API_KEY%"=="" (
echo.
echo [WARN] DEEPSEEK_API_KEY is empty in this window.
echo If you just ran setx, reopen this window or restart VS Code.
echo setx DEEPSEEK_API_KEY "sk-xxxxxxxx"
echo.
pause
) else (
echo OK - key detected.
)
echo [3/3] Checking dependencies ...
python -c "import flask, requests" >nul 2>nul
if errorlevel 1 (
echo Missing packages, installing ...
python -m pip install -r requirements.txt
if errorlevel 1 (
echo [ERROR] pip install failed, check network and retry.
pause
exit /b 1
)
)
echo OK - dependencies ready.
echo.
echo ============================================
echo Starting: http://127.0.0.1:5000
echo Close this window or press Ctrl+C to stop
echo ============================================
echo.
start "" http://127.0.0.1:5000
python am.py
echo.
echo Server stopped.
pause