diff --git a/assembly/bin/build-chat.bat b/assembly/bin/build-chat.bat deleted file mode 100644 index 43b34cc3b..000000000 --- a/assembly/bin/build-chat.bat +++ /dev/null @@ -1,15 +0,0 @@ -@echo off - -setlocal - -set "sbinDir=%~dp0" -set "baseDir=%~dp0.." -set "runtimeDir=%baseDir%\runtime" -set "buildDir=%baseDir%\build" - -cd "%baseDir%" - -rem 1. move package to build -copy "%baseDir%\..\launchers\chat\target\*.tar.gz" "%buildDir%\supersonic-chat.tar.gz" - -endlocal \ No newline at end of file diff --git a/assembly/bin/build-chat.sh b/assembly/bin/build-chat.sh deleted file mode 100755 index 6305f9d8a..000000000 --- a/assembly/bin/build-chat.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/runtime -buildDir=$baseDir/build - -cd $baseDir - -#1. move package to build -cp $baseDir/../launchers/chat/target/*.tar.gz ${buildDir}/supersonic-chat.tar.gz - diff --git a/assembly/bin/build-ide.bat b/assembly/bin/build-ide.bat deleted file mode 100644 index effae9024..000000000 --- a/assembly/bin/build-ide.bat +++ /dev/null @@ -1,16 +0,0 @@ - -setlocal - -set "sbinDir=%~dp0" -set "baseDir=%~dp0.." -set "buildDir=%baseDir%\build" - -cd /d "%baseDir%\bin" -call build-standalone.bat - -cd "%buildDir%" -tar -zxvf supersonic-webapp.tar.gz -move supersonic-webapp webapp -move webapp ..\..\launchers\standalone\target\classes - -endlocal \ No newline at end of file diff --git a/assembly/bin/build-ide.sh b/assembly/bin/build-ide.sh deleted file mode 100755 index 87bfda75e..000000000 --- a/assembly/bin/build-ide.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -buildDir=$baseDir/build - -cd $baseDir/bin -sh build-standalone.sh - -cd $buildDir -tar xvf supersonic-webapp.tar.gz -mv supersonic-webapp webapp -mv webapp ../../launchers/standalone/target/classes \ No newline at end of file diff --git a/assembly/bin/build-semantic.bat b/assembly/bin/build-semantic.bat deleted file mode 100644 index 833d04271..000000000 --- a/assembly/bin/build-semantic.bat +++ /dev/null @@ -1,32 +0,0 @@ -@echo off - -setlocal - -set "sbinDir=%~dp0" -set "baseDir=%~dp0.." -set "runtimeDir=%baseDir%\runtime" -set "buildDir=%baseDir%\build" - -echo '%baseDir%' -echo '%buildDir%' - - -cd "%baseDir%" - -rem 1. build semantic service -del /q "%buildDir%\*.tar.gz" -rd /s /q dist - -call mvn -f "%baseDir%\..\pom.xml" clean package -DskipTests - -rem 2. move package to build -echo "%baseDir%\..\launchers\semantic\target\*.tar.gz" -echo "%buildDir%\supersonic-semantic.tar.gz" -copy "%baseDir%\..\launchers\semantic\target\*.tar.gz" "%buildDir%\supersonic-semantic.tar.gz" - -rem 3. build webapp -cd "%baseDir%\..\webapp" -start-fe-prod.bat -copy /y "supersonic-webapp.tar.gz" "%buildDir%\" - -endlocal diff --git a/assembly/bin/build-semantic.sh b/assembly/bin/build-semantic.sh deleted file mode 100755 index 1c969081b..000000000 --- a/assembly/bin/build-semantic.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/runtime -buildDir=$baseDir/build - -cd $baseDir - -#1. build semantic service -rm -fr ${buildDir}/*.tar.gz -rm -fr dist - -mvn -f $baseDir/../ clean package -DskipTests - -#2. move package to build -cp $baseDir/../launchers/semantic/target/*.tar.gz ${buildDir}/supersonic-semantic.tar.gz - -#3. build webapp -chmod +x $baseDir/../webapp/start-fe-prod.sh -cd ../webapp -sh ./start-fe-prod.sh -cp -fr ./supersonic-webapp.tar.gz ${buildDir}/ diff --git a/assembly/bin/start-chat.sh b/assembly/bin/start-chat.sh deleted file mode 100755 index 0ee1435fe..000000000 --- a/assembly/bin/start-chat.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/../runtime -buildDir=$baseDir/build - -cd $baseDir - -#2. package lib - -tar -zxvf ${buildDir}/supersonic-chat.tar.gz -C ${runtimeDir} - -mv ${runtimeDir}/launchers-chat-* ${runtimeDir}/supersonic-chat - -tar -zxvf ${buildDir}/supersonic-webapp.tar.gz -C ${buildDir} - -mkdir -p ${runtimeDir}/supersonic-chat/webapp - -cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-chat/webapp - -rm -fr ${buildDir}/supersonic-webapp - -json=$(cat ${runtimeDir}/supersonic-chat/webapp/supersonic.config.json) -json=$(echo $json | jq '.env="chat"') -echo $json > ${runtimeDir}/supersonic-chat/webapp/supersonic.config.json - -#3. start service -#3.1 start chat service -echo ${runtimeDir} -sh ${runtimeDir}/supersonic-chat/bin/service.sh restart - -#3.2 start llm service -sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh restart - diff --git a/assembly/bin/start-semantic.sh b/assembly/bin/start-semantic.sh deleted file mode 100755 index 0175de675..000000000 --- a/assembly/bin/start-semantic.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/../runtime -buildDir=$baseDir/build - -cd $baseDir - -#1. clear file -mkdir -p ${runtimeDir} -rm -fr ${runtimeDir}/* - -#2. package lib - -tar -zxvf ${buildDir}/supersonic-semantic.tar.gz -C ${runtimeDir} - -mv ${runtimeDir}/launchers-semantic-* ${runtimeDir}/supersonic-semantic - -tar -zxvf ${buildDir}/supersonic-webapp.tar.gz -C ${buildDir} - -mkdir -p ${runtimeDir}/supersonic-semantic/webapp - -cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-semantic/webapp - -rm -fr ${buildDir}/supersonic-webapp - - -json=$(cat ${runtimeDir}/supersonic-semantic/webapp/supersonic.config.json) -json=$(echo $json | jq '.env="semantic"') -echo $json > ${runtimeDir}/supersonic-semantic/webapp/supersonic.config.json - -#3. start service -sh ${runtimeDir}/supersonic-semantic/bin/service.sh restart - - diff --git a/assembly/bin/start-standalone.bat b/assembly/bin/start-standalone.bat deleted file mode 100644 index d9b29627b..000000000 --- a/assembly/bin/start-standalone.bat +++ /dev/null @@ -1,39 +0,0 @@ -@echo off -setlocal - -set "sbinDir=%~dp0" -set "baseDir=%~dp0.." -set "runtimeDir=%baseDir%\..\runtime" -set "buildDir=%baseDir%\build" - -cd /d %baseDir% - -::1. clear file -rd /s /q "%runtimeDir%" -mkdir "%runtimeDir%" - - -::2. package lib -:: Assuming you have tar utility installed in Windows -tar -zxvf "%buildDir%\supersonic.tar.gz" -C "%runtimeDir%" - -for /d %%f in ("%runtimeDir%\launchers-standalone-*") do ( - move "%%f" "%runtimeDir%\supersonic-standalone" -) - -tar -zxvf "%buildDir%\supersonic-webapp.tar.gz" -C "%buildDir%" - -if not exist "%runtimeDir%\supersonic-standalone\webapp" mkdir "%runtimeDir%\supersonic-standalone\webapp" - -xcopy /s /e /h /y "%buildDir%\supersonic-webapp\*" "%runtimeDir%\supersonic-standalone\webapp" - -if not exist "%runtimeDir%\supersonic-standalone\conf\webapp" mkdir "%runtimeDir%\supersonic-standalone\conf\webapp" -xcopy /s /e /h /y "%runtimeDir%\supersonic-standalone\webapp\*" "%runtimeDir%\supersonic-standalone\conf\webapp" - -rd /s /q "%buildDir%\supersonic-webapp" - - -::3. start service -::start standalone service -call "%runtimeDir%\supersonic-standalone\bin\service.bat" restart -call "%runtimeDir%\supersonic-standalone\llm\bin\service.bat" restart diff --git a/assembly/bin/start-standalone.sh b/assembly/bin/start-standalone.sh deleted file mode 100755 index 3cb9aff0f..000000000 --- a/assembly/bin/start-standalone.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -sbinDir=$(cd "$(dirname "$0")"; pwd) -baseDir=$(cd "$sbinDir/.." && pwd -P) -runtimeDir=$baseDir/../runtime -buildDir=$baseDir/build - -cd $baseDir - -#1. clear file -mkdir -p ${runtimeDir} -rm -fr ${runtimeDir}/* - -#2. package lib - -tar -zxvf ${buildDir}/supersonic.tar.gz -C ${runtimeDir} - -mv ${runtimeDir}/launchers-standalone-* ${runtimeDir}/supersonic-standalone - -tar -zxvf ${buildDir}/supersonic-webapp.tar.gz -C ${buildDir} - -mkdir -p ${runtimeDir}/supersonic-standalone/webapp - -cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-standalone/webapp - -rm -fr ${buildDir}/supersonic-webapp - -#3. start service -#start standalone service -sh ${runtimeDir}/supersonic-standalone/bin/service.sh restart -#start llm service -sh ${runtimeDir}/supersonic-standalone/llm/bin/service.sh restart diff --git a/assembly/bin/stop-standalone.bat b/assembly/bin/stop-standalone.bat deleted file mode 100644 index e23017254..000000000 --- a/assembly/bin/stop-standalone.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -setlocal - -set "sbinDir=%~dp0" -set "baseDir=%~dp0.." -set "runtimeDir=%baseDir%\..\runtime" -set "buildDir=%baseDir%\build" - -::3. start service -::start standalone service -call "%runtimeDir%\supersonic-standalone\bin\service.bat" stop -call "%runtimeDir%\supersonic-standalone\llm\bin\service.bat" stop diff --git a/assembly/bin/build-standalone.bat b/assembly/bin/supersonic-build.bat similarity index 54% rename from assembly/bin/build-standalone.bat rename to assembly/bin/supersonic-build.bat index 1fa89e2af..a16558257 100644 --- a/assembly/bin/build-standalone.bat +++ b/assembly/bin/supersonic-build.bat @@ -1,13 +1,10 @@ @echo off - setlocal set "sbinDir=%~dp0" set "baseDir=%~dp0.." -set "runtimeDir=%baseDir%\runtime" set "buildDir=%baseDir%\build" -cd "%baseDir%" rem 1. build semantic chat service del /q "%buildDir%\*.tar.gz" 2>NUL @@ -15,11 +12,19 @@ del /q "%buildDir%\*.tar.gz" 2>NUL call mvn -f "%baseDir%\..\pom.xml" clean package -DskipTests rem 2. move package to build -echo f|xcopy "%baseDir%\..\launchers\standalone\target\*.tar.gz" "%buildDir%\supersonic.tar.gz" +echo f|xcopy "%baseDir%\..\launchers\standalone\target\*.tar.gz" "%buildDir%\supersonic-standalone.tar.gz" +echo f|xcopy "%baseDir%\..\launchers\semantic\target\*.tar.gz" "%buildDir%\supersonic-semantic.tar.gz" +echo f|xcopy "%baseDir%\..\launchers\chat\target\*.tar.gz" "%buildDir%\supersonic-chat.tar.gz" rem 3. build webapp cd "%baseDir%\..\webapp" call start-fe-prod.bat copy /y "%baseDir%\..\webapp\supersonic-webapp.tar.gz" "%buildDir%\" -endlocal + +cd "%buildDir%" +tar -zxvf supersonic-webapp.tar.gz +move supersonic-webapp webapp +move webapp ..\..\launchers\standalone\target\classes + +endlocal \ No newline at end of file diff --git a/assembly/bin/build-standalone.sh b/assembly/bin/supersonic-build.sh old mode 100755 new mode 100644 similarity index 64% rename from assembly/bin/build-standalone.sh rename to assembly/bin/supersonic-build.sh index b14435eca..bb3a7529d --- a/assembly/bin/build-standalone.sh +++ b/assembly/bin/supersonic-build.sh @@ -15,9 +15,18 @@ mvn -f $baseDir/../ clean package -DskipTests #2. move package to build cp $baseDir/../launchers/standalone/target/*.tar.gz ${buildDir}/supersonic.tar.gz +cp $baseDir/../launchers/semantic/target/*.tar.gz ${buildDir}/supersonic-semantic.tar.gz +cp $baseDir/../launchers/chat/target/*.tar.gz ${buildDir}/supersonic-chat.tar.gz + #3. build webapp chmod +x $baseDir/../webapp/start-fe-prod.sh cd ../webapp sh ./start-fe-prod.sh cp -fr ./supersonic-webapp.tar.gz ${buildDir}/ + + +cd $buildDir +tar xvf supersonic-webapp.tar.gz +mv supersonic-webapp webapp +mv webapp ../../launchers/standalone/target/classes diff --git a/assembly/bin/supersonic-daemon.bat b/assembly/bin/supersonic-daemon.bat new file mode 100644 index 000000000..d2615a215 --- /dev/null +++ b/assembly/bin/supersonic-daemon.bat @@ -0,0 +1,120 @@ +@echo off +setlocal + +set "sbinDir=%~dp0" +set "baseDir=%~dp0.." +set "runtimeDir=%baseDir%\..\runtime" +set "buildDir=%baseDir%\build" + +set "command=%~1" +set "module=%~2" + +set "APP_NAME=standalone-service" +set "MAIN_CLASS=com.tencent.supersonic.StandaloneLauncher" + +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" + +set "llm_path=%baseDir%\..\chat\core\src\main\python" + +if "%module%"=="" ( + set "module=standalone" +) else if "%module%"=="semantic" ( + set "APP_NAME=semantic-service" + set "MAIN_CLASS=com.tencent.supersonic.SemanticLauncher" +) else if "%module%"=="chat" ( + set "APP_NAME=chat-service" + set "MAIN_CLASS=com.tencent.supersonic.ChatLauncher" +) + +if "%command%"=="" ( + set "command=restart" +) + +set "libDir=%runtimeDir%\supersonic-%module%\lib" +set "confDir=%runtimeDir%\supersonic-%module%\conf" +set "webDir=%runtimeDir%\supersonic-%module%\webapp" +set "CLASSPATH=%confDir%;%webDir%;%libDir%\*" +set "java-command=-Dfile.encoding=UTF-8 -Duser.language=Zh -Duser.region=CN -Duser.timezone=GMT+08 -Xms1024m -Xmx2048m -cp %CLASSPATH% %MAIN_CLASS%" + + +if "%command%"=="stop" ( + call:STOP + goto :EOF +) + +if "%command%"=="restart" ( + call:STOP +) + +::1. clear file +rd /s /q "%runtimeDir%" +mkdir "%runtimeDir%" + +if "%module%"=="llmparser" ( + tar -zxvf "%buildDir%\supersonic-standalone.tar.gz" -C "%runtimeDir%" + for /d %%f in ("%runtimeDir%\launchers-standalone-*") do ( + move "%%f" "%runtimeDir%\supersonic-standalone" + ) + cd "%runtimeDir%" + "%pip_path%" install -r "%llm_path%\requirements.txt" + "%python_path%" -c "import langchain,fastapi,chromadb,tiktoken,uvicorn" >nul 2>&1 + cd "%runtimeDir%\supersonic-standalone\llm\llm" + start "" /B uvicorn %start_name%:app --port %llm_port% --host %llm_host% > "%runtimeDir%\supersonic-standalone\llm\llm.log" 2>&1 + echo "llm service started, see logs/error with logs/error command" + goto :EOF +) + +tar -zxvf "%buildDir%\supersonic-%module%.tar.gz" -C "%runtimeDir%" +for /d %%f in ("%runtimeDir%\launchers-%module%-*") do ( + move "%%f" "%runtimeDir%\supersonic-%module%" +) + +if not exist "%runtimeDir%\supersonic-%module%\logs" mkdir "%runtimeDir%\supersonic-%module%\logs" + +tar -zxvf "%buildDir%\supersonic-webapp.tar.gz" -C "%buildDir%" +if not exist "%runtimeDir%\supersonic-%module%\webapp" mkdir "%runtimeDir%\supersonic-%module%\webapp" +xcopy /s /e /h /y "%buildDir%\supersonic-webapp\*" "%runtimeDir%\supersonic-%module%\webapp" +if not exist "%runtimeDir%\supersonic-%module%\conf\webapp" mkdir "%runtimeDir%\supersonic-%module%\conf\webapp" +xcopy /s /e /h /y "%runtimeDir%\supersonic-%module%\webapp\*" "%runtimeDir%\supersonic-%module%\conf\webapp" +rd /s /q "%buildDir%\supersonic-webapp" + +::3. start service +::start standalone service +if "%command%"=="start" ( + call:START + goto :EOF +) + +if "%command%"=="restart" ( + call:START + goto :EOF +) + +:START + if "%module%"=="standalone" ( + cd "%runtimeDir%" + "%pip_path%" install -r "%llm_path%\requirements.txt" + "%python_path%" -c "import langchain,fastapi,chromadb,tiktoken,uvicorn" >nul 2>&1 + cd "%runtimeDir%\supersonic-standalone\llm\llm" + start "" /B uvicorn %start_name%:app --port %llm_port% --host %llm_host% > "%runtimeDir%\supersonic-standalone\llm\llm.log" 2>&1 + echo "llm service started, see logs/error with logs/error command" + ) + start "supersonic" /B java %java-command%>"%runtimeDir%\supersonic-%module%\logs\info-%module%.log" 2>&1 + echo "%module% service started, see logs/error with logs/error command" + goto :EOF + + +:STOP + for /f "tokens=2" %%i in ('tasklist ^| findstr /i "python"') do ( + taskkill /PID %%i /F + echo "llm Process (PID = %%i) is killed." + ) + for /f "tokens=2" %%i in ('tasklist ^| findstr /i "java"') do ( + taskkill /PID %%i /F + echo "%module% Process (PID = %%i) is killed." + ) + goto :EOF \ No newline at end of file diff --git a/assembly/bin/supersonic-daemon.sh b/assembly/bin/supersonic-daemon.sh new file mode 100644 index 000000000..f94cd3574 --- /dev/null +++ b/assembly/bin/supersonic-daemon.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash + +sbinDir=$(cd "$(dirname "$0")"; pwd) +baseDir=$(cd "$sbinDir/.." && pwd -P) +runtimeDir=$baseDir/../runtime +buildDir=$baseDir/build + +command=$1 +service=$2 + +cd $baseDir +if [[ "$service" == "semantic" || -z "$service" ]] && [ "$command" != "stop" ]; then + #1. clear file + mkdir -p ${runtimeDir} + rm -fr ${runtimeDir}/* + + #2. package lib + + tar -zxvf ${buildDir}/supersonic.tar.gz -C ${runtimeDir} + tar -zxvf ${buildDir}/supersonic-chat.tar.gz -C ${runtimeDir} + tar -zxvf ${buildDir}/supersonic-semantic.tar.gz -C ${runtimeDir} + + mv ${runtimeDir}/launchers-standalone-* ${runtimeDir}/supersonic-standalone + mv ${runtimeDir}/launchers-chat-* ${runtimeDir}/supersonic-chat + mv ${runtimeDir}/launchers-semantic-* ${runtimeDir}/supersonic-semantic + + tar -zxvf ${buildDir}/supersonic-webapp.tar.gz -C ${buildDir} + + mkdir -p ${runtimeDir}/supersonic-semantic/webapp + mkdir -p ${runtimeDir}/supersonic-chat/webapp + mkdir -p ${runtimeDir}/supersonic-standalone/webapp + + cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-semantic/webapp + cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-chat/webapp + cp -fr ${buildDir}/supersonic-webapp/* ${runtimeDir}/supersonic-standalone/webapp + + rm -fr ${buildDir}/supersonic-webapp +fi +if [[ "$service" == "semantic" ]]; then + json=$(cat ${runtimeDir}/supersonic-semantic/webapp/supersonic.config.json) + json=$(echo $json | jq '.env="semantic"') + echo $json > ${runtimeDir}/supersonic-semantic/webapp/supersonic.config.json +fi + +if [[ "$service" == "chat" ]]; then + json=$(cat ${runtimeDir}/supersonic-chat/webapp/supersonic.config.json) + json=$(echo $json | jq '.env="chat"') + echo $json > ${runtimeDir}/supersonic-chat/webapp/supersonic.config.json +fi +echo $command +echo $service +case "$command" in + start) + if [[ "$service" == "semantic" ]];then + echo -e "Starting semantic" + sh ${runtimeDir}/supersonic-semantic/bin/service.sh start + elif [[ "$service" == "chat" ]];then + echo -e "Starting chat" + sh ${runtimeDir}/supersonic-chat/bin/service.sh start + elif [[ "$service" == "llmparser" ]];then + echo -e "Starting LLM" + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh start + elif [[ -z "$service" ]]; then + echo -e "Starting supersonic" + sh ${runtimeDir}/supersonic-standalone/bin/service.sh start + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh start + else + echo "Use command {semantic|semantic||} to run." + fi + ;; + stop) + if [[ "$service" == "semantic" ]];then + echo -e "Stopping semantic" + sh ${runtimeDir}/supersonic-semantic/bin/service.sh stop + elif [[ "$service" == "chat" ]];then + echo -e "Stopping chat" + sh ${runtimeDir}/supersonic-chat/bin/service.sh stop + elif [[ "$service" == "llmparser" ]];then + echo -e "Stopping LLM" + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh stop + elif [[ -z "$service" ]]; then + echo -e "Stopping supersonic" + sh ${runtimeDir}/supersonic-standalone/bin/service.sh stop + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh stop + else + echo "Use command {semantic|semantic||} to run." + fi + ;; + restart) + if [[ "$service" == "semantic" ]];then + echo -e "Restarting semantic" + sh ${runtimeDir}/supersonic-semantic/bin/service.sh restart + elif [[ "$service" == "chat" ]];then + echo -e "Restarting chat" + sh ${runtimeDir}/supersonic-chat/bin/service.sh restart + elif [[ "$service" == "llmparser" ]];then + echo -e "Restarting LLM" + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh restart + elif [[ -z "$service" ]]; then + echo -e "Restarting supersonic" + sh ${runtimeDir}/supersonic-standalone/bin/service.sh restart + sh ${runtimeDir}/supersonic-chat/llm/bin/service.sh restart + else + echo "Use command {semantic|semantic||} to run." + fi + ;; + *) + echo "Use command {start|stop|status|restart} to run." + exit 1 +esac + +exit 0 diff --git a/chat/core/src/main/python/bin/env.bat b/chat/core/src/main/python/bin/env.bat deleted file mode 100644 index 7f6a51207..000000000 --- a/chat/core/src/main/python/bin/env.bat +++ /dev/null @@ -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" diff --git a/chat/core/src/main/python/bin/install.bat b/chat/core/src/main/python/bin/install.bat deleted file mode 100644 index 6b114031a..000000000 --- a/chat/core/src/main/python/bin/install.bat +++ /dev/null @@ -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 - ) -) \ No newline at end of file diff --git a/chat/core/src/main/python/bin/run.bat b/chat/core/src/main/python/bin/run.bat deleted file mode 100644 index 90bf3fcf4..000000000 --- a/chat/core/src/main/python/bin/run.bat +++ /dev/null @@ -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 \ No newline at end of file diff --git a/chat/core/src/main/python/bin/service.bat b/chat/core/src/main/python/bin/service.bat deleted file mode 100644 index 72b752953..000000000 --- a/chat/core/src/main/python/bin/service.bat +++ /dev/null @@ -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 -) \ No newline at end of file diff --git a/launchers/standalone/src/main/bin/env.bat b/launchers/standalone/src/main/bin/env.bat deleted file mode 100644 index 51376b384..000000000 --- a/launchers/standalone/src/main/bin/env.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -set "APP_NAME=chat-service" -set "MAIN_CLASS=com.tencent.supersonic.StandaloneLauncher" diff --git a/launchers/standalone/src/main/bin/run.bat b/launchers/standalone/src/main/bin/run.bat deleted file mode 100644 index a5c21f02d..000000000 --- a/launchers/standalone/src/main/bin/run.bat +++ /dev/null @@ -1,30 +0,0 @@ -@echo off -setlocal - -set "binDir=%~dp0" -set "baseDir=%~dp0.." -set "libDir=%baseDir%\lib" -set "confDir=%baseDir%\conf" -set "webDir=%baseDir%\webapp" - -call "%baseDir%\bin\env.bat" - -set "CLASSPATH=%confDir%;%webDir%;%libDir%\*" - -set "LANG=zh_CN.UTF-8" - -cd /d "%baseDir%" - -set "command=-Dfile.encoding=UTF-8 -Duser.language=Zh -Duser.region=CN -Duser.timezone=GMT+08 -Xms1024m -Xmx2048m -cp %CLASSPATH% %MAIN_CLASS%" - -if not exist "%baseDir%\logs" ( - mkdir "%baseDir%\logs" -) - -if "%is_test%"=="true" ( - start "supersonic" /B java -Dspring.profiles.active=dev %command% >nul 2>"%baseDir%\logs\error.log" -) else ( - start "supersonic" /B java %command% >nul 2>"%baseDir%\logs\error.log" -) - -endlocal \ No newline at end of file diff --git a/launchers/standalone/src/main/bin/service.bat b/launchers/standalone/src/main/bin/service.bat deleted file mode 100644 index c72043bdd..000000000 --- a/launchers/standalone/src/main/bin/service.bat +++ /dev/null @@ -1,42 +0,0 @@ -@echo off -setlocal - -set "binDir=%~dp0" -set "baseDir=%~dp0.." -set "confDir=%baseDir%\conf" -call "%baseDir%\bin\env.bat" - -set "command=%~1" - - -if "%command%"=="start" ( - for /f "tokens=2" %%i in ('tasklist ^| findstr /i "java"') do ( - echo "Process (PID = %%i) is running." - goto :EOF - ) - echo "Starting %APP_NAME%" - "%baseDir%\bin\run.bat" %MAIN_CLASS% - echo "Process started, see logs/error with logs/error command" - goto :EOF -) - - -if "%command%"=="stop" ( - for /f "tokens=2" %%i in ('tasklist ^| findstr /i "java"') 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 "java"') do ( - taskkill /PID %%i /F - echo "Process (PID = %%i) is killed." - ) - "%baseDir%\bin\run.bat" %MAIN_CLASS% - echo "%APP_NAME% started, see logs/error with logs/error command" -) \ No newline at end of file