Files
baiyue-logistics-chat/start.bat
T
ouyangxq 805675f8db 重构物流客服模块并完善会话接待工作台
- 拆分应用工厂、业务服务与路由,保留原有 HTTP/SSE 和存储入口
- 分离页面资源,重排客服工作台并完善响应式导航、草稿和附件交互
- 整理维护脚本、请求示例和贡献指南,移除启动脚本中的密钥配置
- 上传文件改为仅本地保留,补充隔离的后端与前端回归验证

验证:46 项 Python 测试通过,含 14 个已有子测试;12 个 Node 前端场景通过。
2026-10-29 10:59:29 +08:00

108 lines
2.8 KiB
Batchfile

@echo off
setlocal DisableDelayedExpansion
cd /d "%~dp0"
set "PYTHON_ARGS="
if defined VIRTUAL_ENV (
set "PYTHON_EXE=%VIRTUAL_ENV%\Scripts\python.exe"
call :probe_python
if not errorlevel 1 goto python_ready
)
set "PYTHON_EXE=%~dp0.venv\Scripts\python.exe"
call :probe_python
if not errorlevel 1 goto python_ready
set "PYTHON_EXE=py.exe"
set "PYTHON_ARGS=-3"
call :probe_python
if not errorlevel 1 goto python_ready
set "PYTHON_EXE=python.exe"
set "PYTHON_ARGS="
call :probe_python
if not errorlevel 1 goto python_ready
echo [ERROR] No working Python 3 interpreter found. Install Python or recreate .venv.
if /i "%~1"=="--check-python" exit /b 1
pause
exit /b 1
:python_ready
if /i "%~1"=="--check-python" (
"%PYTHON_EXE%" %PYTHON_ARGS% -c "import sys; print(sys.executable)"
exit /b
)
chcp 936 >nul
title Baiyue Logistics AI Customer Service
echo ============================================
echo Baiyue Logistics AI Customer Service
echo ============================================
echo.
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 not defined DEEPSEEK_API_KEY (
echo.
echo [WARN] DEEPSEEK_API_KEY is empty in this window.
echo .env files are not loaded automatically.
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_EXE%" %PYTHON_ARGS% -c "import flask, requests, waitress" >nul 2>nul
if errorlevel 1 (
echo Missing packages, installing ...
"%PYTHON_EXE%" %PYTHON_ARGS% -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_EXE%" %PYTHON_ARGS% am.py
set "APP_EXIT_CODE=%ERRORLEVEL%"
echo.
echo Server stopped.
pause
exit /b %APP_EXIT_CODE%
:probe_python
"%PYTHON_EXE%" %PYTHON_ARGS% -c "import sys; sys.exit(0 if sys.version_info.major == 3 else 1)" >nul 2>nul
if "%ERRORLEVEL%"=="0" exit /b 0
exit /b 1