start_llm: service-first (port 11434), then kit, then per-user - works under any account when ollama already alive

This commit is contained in:
Sadmin committed 2026-11-05 17:37:30 +03:00
1 parent 7ea639ec1f
commit a7ff042c15
1 file changed
+25 -17
+25 -17
View File
@@ -1,24 +1,32 @@
@echo off
REM Ollama: kit (shared, shift computers) or per-user install (one-user computers)
REM Ollama: check running service first (may run under another account),
REM then kit copy, then per-user install
cd /d %~dp0
set "KIT=%~dp0..\..\kit"
set "OLLEXE="
set "OLLMODELS="
if exist "%KIT%\Ollama\ollama.exe" set "OLLEXE=%KIT%\Ollama\ollama.exe"
if exist "%KIT%\Ollama\ollama.exe" set "OLLMODELS=%KIT%\models"
if not defined OLLEXE set "OLLEXE=%LocalAppData%\Programs\Ollama\ollama.exe"
if not defined OLLEXE if exist "%OLLEXE%" set "OLLMODELS=%UserProfile%\.ollama\models"
if not exist "%OLLEXE%" (
echo Ollama not found: run OllamaSetup.exe from delivery (double-click, Next),
echo then install_ollama_model.bat, then run start_all.bat again
pause
exit /b 1
)
netstat -ano 2>nul | findstr ":11434" | findstr "LISTENING" >nul 2>nul
if %errorlevel%==0 goto :llm_ok
set "OLLAMA_MODELS=%OLLMODELS%"
if defined OLLMODELS set "OLLAMA_MODELS=%OLLMODELS%"
set "KIT=%~dp0..\..\kit"
if not exist "%KIT%\Ollama\ollama.exe" goto :try_local
set "OLLAMA_MODELS=%KIT%\models"
start "Ollama (docchecker)" /MIN "%KIT%\Ollama\ollama.exe" serve
timeout /t 6 /nobreak >nul
goto :verify
:try_local
set "OLLEXE=%LocalAppData%\Programs\Ollama\ollama.exe"
if not exist "%OLLEXE%" goto :not_found
set "OLLAMA_MODELS="
start "Ollama (docchecker)" /MIN "%OLLEXE%" serve
timeout /t 6 /nobreak >nul
goto :verify
:verify
netstat -ano 2>nul | findstr ":11434" | findstr "LISTENING" >nul 2>nul
if %errorlevel%==0 goto :llm_ok
echo Ollama did not start - see its window, or run: "%OLLEXE%" serve
pause
exit /b 1
:not_found
echo Ollama not found: run OllamaSetup.exe from delivery (double-click, Next),
echo then install_ollama_model.bat, then run start_all.bat again
pause
exit /b 1
:llm_ok
echo Ollama: работает
echo Ollama: running