(improvement) simplify build and start script (#81)

This commit is contained in:
LXW
2023-09-13 11:31:07 +08:00
committed by GitHub
parent f00da45824
commit 12417c66cd
22 changed files with 251 additions and 440 deletions

View File

@@ -1,6 +0,0 @@
@echo off
set "python_path=python"
set "pip_path=pip3.9"
set "llm_host=127.0.0.1"
set "llm_port=9092"
set "start_name=api_service"

View File

@@ -1,22 +0,0 @@
@echo off
setlocal
set "binDir=%~dp0"
cd /d "%binDir%.."
set "baseDir=%cd%"
echo %binDir%
call "%binDir%\env.bat"
"%pip_path%" install -r "%baseDir%\requirements.txt"
"%python_path%" -c "import langchain,fastapi,chromadb,tiktoken,uvicorn" >nul 2>&1
if "%errorlevel%" equ 0 (
echo install ok, will pass
) else (
if "%errorlevel%" equ 1 (
echo install ok
) else (
echo install fail, but if it can be started normally, it will not affect
)
)

View File

@@ -1,23 +0,0 @@
@echo off
setlocal
set "binDir=%~dp0"
cd /d "%binDir%.."
set "baseDir=%cd%"
call "%binDir%\env.bat"
echo "%binDir%"
if "%llm_host%"=="" (
echo llm_host llm_port is not set
exit /b 1
)
if "%python_path%"=="" (
echo please set env value python_path, pip_path to python, pip path by export cmd
exit /b 1
)
call "%binDir%\install.bat"
cd "%baseDir%\llm"
start "" /B uvicorn %start_name%:app --port %llm_port% --host %llm_host% > "%baseDir%\llm.log" 2>&1

View File

@@ -1,44 +0,0 @@
@echo off
setlocal
set "binDir=%~dp0"
cd /d "%binDir%.."
set "baseDir=%cd%"
call "%baseDir%\bin\env.bat"
set "command=%~1"
if "%command%"=="start" (
for /f "tokens=2" %%i in ('tasklist ^| findstr /i "Python"') do (
taskkill /PID %%i /F
echo "Process (PID = %%i) is running."
goto :EOF
)
"%baseDir%\bin\run.bat"
echo "llm service started, see logs/error with logs/error command"
goto :EOF
)
if "%command%"=="stop" (
for /f "tokens=2" %%i in ('tasklist ^| findstr /i "Python"') do (
taskkill /PID %%i /F
echo "Process (PID = %%i) is killed."
goto :EOF
)
echo "Process is not running."
goto :EOF
)
if "%command%"=="restart" (
for /f "tokens=2" %%i in ('tasklist ^| findstr /i "Python"') do (
taskkill /PID %%i /F
echo "Process (PID = %%i) is killed."
)
"%baseDir%\bin\run.bat"
echo "Process started, see logs/error with logs/error command"
goto :EOF
)