start.bat 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. @echo off
  2. chcp 65001 >nul
  3. set PYTHONUTF8=1
  4. cd /d "%~dp0"
  5. if not exist ".venv\Scripts\python.exe" (
  6. echo [X] Not installed yet: .venv\Scripts\python.exe not found
  7. echo Run install.bat first. If install printed errors, send that screen back
  8. echo instead of continuing - the server cannot start without .venv.
  9. pause
  10. exit /b 2
  11. )
  12. ".venv\Scripts\python.exe" guanlan.py serve
  13. if errorlevel 1 (
  14. rem serve exits 1 in two different cases: the gateway never came up, or the gateway is
  15. rem up with at least one degraded module, e.g. Ollama not running. Probe healthz to tell
  16. rem them apart, otherwise a working server gets reported as "did not start".
  17. ".venv\Scripts\python.exe" -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:28084/healthz',timeout=6).status==200 else 1)" 2>nul
  18. if errorlevel 1 (
  19. echo.
  20. echo [X] Gateway did not come up ^(reason above^). Not opening the browser -
  21. echo a "site cannot be reached" page would look like a network problem.
  22. echo See logs\gateway.log
  23. pause
  24. exit /b 1
  25. )
  26. echo.
  27. echo [!] Gateway is up, but at least one module is degraded ^(the [DOWN] lines above^).
  28. echo Usual cause: local Ollama is not running or has no models pulled, which only
  29. echo disables the Q^&A / local-review pages. Every other page works.
  30. echo Details: logs\ for the degraded module.
  31. )
  32. start "" http://127.0.0.1:28084/