Auto-commit: OCR workflow improvements, performance optimizations, and bug fixes
This commit is contained in:
105
zrun_final.bat
Normal file
105
zrun_final.bat
Normal file
@@ -0,0 +1,105 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
echo ========================================
|
||||
echo LightRAG Server Startup - Final Fix
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
echo [1/4] Killing processes on port 3015...
|
||||
echo Killing any process using port 3015...
|
||||
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :3015') do (
|
||||
echo Found process %%a using port 3015
|
||||
taskkill /F /PID %%a >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Failed to kill process %%a
|
||||
) else (
|
||||
echo Killed process %%a
|
||||
)
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [2/4] Checking environment variables...
|
||||
if exist ".env" (
|
||||
echo Found .env file in current directory
|
||||
for /f "usebackq tokens=1,2 delims==" %%a in (".env") do (
|
||||
set "%%a=%%b"
|
||||
)
|
||||
)
|
||||
|
||||
if exist "LightRAG-main\.env" (
|
||||
echo Found .env file in LightRAG-main directory
|
||||
for /f "usebackq tokens=1,2 delims==" %%a in ("LightRAG-main\.env") do (
|
||||
set "%%a=%%b"
|
||||
)
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [3/4] Setting required environment variables...
|
||||
if not "%OPENAI_API_KEY%"=="" (
|
||||
echo OPENAI_API_KEY is set
|
||||
set LLM_BINDING_API_KEY=%OPENAI_API_KEY%
|
||||
echo Set LLM_BINDING_API_KEY from OPENAI_API_KEY
|
||||
) else (
|
||||
echo ERROR: OPENAI_API_KEY is not set!
|
||||
echo Please set OPENAI_API_KEY in .env file
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%JINA_API_KEY%"=="" (
|
||||
echo WARNING: JINA_API_KEY is not set
|
||||
echo Using Ollama as fallback for embeddings
|
||||
set EMBEDDING_BINDING=ollama
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [4/4] Recompiling web UI...
|
||||
echo Checking web UI source...
|
||||
if exist "LightRAG-main\lightrag_webui\package.json" (
|
||||
echo Found web UI source. Building...
|
||||
REM Ensure Node version 22.17.1
|
||||
where nvm >nul 2>&1
|
||||
if not errorlevel 1 (
|
||||
echo Using nvm to switch to Node 22.17.1...
|
||||
call nvm use 22.17.1
|
||||
) else (
|
||||
echo nvm not found, using system Node.
|
||||
)
|
||||
cd LightRAG-main\lightrag_webui
|
||||
REM Check if bun is available
|
||||
where bun >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo bun not found, using npm...
|
||||
call npm run build-no-bun
|
||||
) else (
|
||||
echo Using bun...
|
||||
call bun run build
|
||||
)
|
||||
cd ..\..
|
||||
echo Web UI build completed.
|
||||
) else (
|
||||
echo Web UI source not found, using pre-built assets.
|
||||
)
|
||||
|
||||
echo.
|
||||
echo [5/5] Starting LightRAG server...
|
||||
echo Changing to LightRAG-main directory...
|
||||
cd LightRAG-main
|
||||
|
||||
echo Starting server on port 3015...
|
||||
echo Command: python -m lightrag.api.lightrag_server --port 3015 --host 0.0.0.0 --working-dir rag_storage --input-dir ../inputs --key jleu1212 --auto-scan-at-startup --llm-binding openai --embedding-binding ollama --rerank-binding jina
|
||||
|
||||
python -m lightrag.api.lightrag_server --port 3015 --host 0.0.0.0 --working-dir rag_storage --input-dir ../inputs --key jleu1212 --auto-scan-at-startup --llm-binding openai --embedding-binding ollama --rerank-binding jina
|
||||
|
||||
echo.
|
||||
echo ========================================
|
||||
if errorlevel 1 (
|
||||
echo Server failed to start (error code: %errorlevel%)
|
||||
echo.
|
||||
echo Troubleshooting:
|
||||
echo 1. Check if port 3015 is already in use
|
||||
echo 2. Verify OPENAI_API_KEY is set in .env
|
||||
echo 3. Check Python and dependencies are installed
|
||||
) else (
|
||||
echo Server stopped normally
|
||||
)
|
||||
Reference in New Issue
Block a user