| 12345678910111213141516171819202122232425262728293031323334353637 |
- @echo off
- chcp 65001 >nul
- set PYTHONUTF8=1
- cd /d "%~dp0"
- if not exist ".venv\Scripts\python.exe" (
- echo [X] Not installed yet: .venv\Scripts\python.exe not found
- echo Run install.bat first. If install printed errors, send that screen back
- echo instead of continuing - the server cannot start without .venv.
- pause
- exit /b 2
- )
- ".venv\Scripts\python.exe" guanlan.py serve
- if errorlevel 1 (
- rem serve exits 1 in two different cases: the gateway never came up, or the gateway is
- rem up with at least one degraded module, e.g. Ollama not running. Probe healthz to tell
- rem them apart, otherwise a working server gets reported as "did not start".
- ".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
- if errorlevel 1 (
- echo.
- echo [X] Gateway did not come up ^(reason above^). Not opening the browser -
- echo a "site cannot be reached" page would look like a network problem.
- echo See logs\gateway.log
- pause
- exit /b 1
- )
- echo.
- echo [!] Gateway is up, but at least one module is degraded ^(the [DOWN] lines above^).
- echo Usual cause: local Ollama is not running or has no models pulled, which only
- echo disables the Q^&A / local-review pages. Every other page works.
- echo Details: logs\ for the degraded module.
- )
- start "" http://127.0.0.1:28084/
- echo.
- echo [i] Ops console - stop/start services, rebuild, clear products:
- echo http://127.0.0.1:28084/ops
- echo It stays available while component services are stopped (only the gateway must be up);
- echo buttons follow real state and the backend refuses impossible actions (HTTP 409).
|