diff --git a/package.json b/package.json index 2b8b2de15..bb519bd9f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "@tauri-apps/cli": "^2.2.5", "concurrently": "^9.1.0", "cpx": "^1.5.0", + "cross-env": "^7.0.3", "husky": "^9.1.5", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index 043572272..40726cbe0 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -3,4 +3,5 @@ /target/ /gen/schemas binaries -!binaries/download.sh \ No newline at end of file +!binaries/download.sh +!binaries/download.bat \ No newline at end of file diff --git a/src-tauri/binaries/download.bat b/src-tauri/binaries/download.bat new file mode 100644 index 000000000..20655c84f --- /dev/null +++ b/src-tauri/binaries/download.bat @@ -0,0 +1,43 @@ +@echo off + +set CORTEX_VERSION=1.0.13-rc1 +set ENGINE_VERSION=0.1.55 +set ENGINE_DOWNLOAD_URL=https://github.com/menloresearch/cortex.llamacpp/releases/download/v%ENGINE_VERSION%/cortex.llamacpp-%ENGINE_VERSION%-windows-amd64 +set CUDA_DOWNLOAD_URL=https://github.com/menloresearch/cortex.llamacpp/releases/download/v%ENGINE_VERSION% +set SUBFOLDERS=windows-amd64-noavx-cuda-12-0 windows-amd64-noavx-cuda-11-7 windows-amd64-avx2-cuda-12-0 windows-amd64-avx2-cuda-11-7 windows-amd64-noavx windows-amd64-avx windows-amd64-avx2 windows-amd64-avx512 windows-amd64-vulkan +set BIN_PATH="./" +set DOWNLOAD_TOOL=..\..\extensions\inference-cortex-extension\node_modules\.bin\download + +@REM Download cortex.llamacpp binaries + +call %DOWNLOAD_TOOL% -e --strip 1 -o %BIN_PATH% https://github.com/menloresearch/cortex.cpp/releases/download/v%CORTEX_VERSION%/cortex-%CORTEX_VERSION%-windows-amd64.tar.gz +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-avx2-cuda-12-0.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-avx2-cuda-12-0/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-avx2-cuda-11-7.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-avx2-cuda-11-7/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-noavx-cuda-12-0.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-noavx-cuda-12-0/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-noavx-cuda-11-7.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-noavx-cuda-11-7/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-noavx.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-noavx/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-avx.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-avx/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-avx2.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-avx2/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-avx512.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-avx512/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %ENGINE_DOWNLOAD_URL%-vulkan.tar.gz -e --strip 1 -o ./engines/cortex.llamacpp/windows-amd64-vulkan/v%ENGINE_VERSION% +call %DOWNLOAD_TOOL% %CUDA_DOWNLOAD_URL%/cuda-12-0-windows-amd64.tar.gz -e --strip 1 -o %BIN_PATH% +call %DOWNLOAD_TOOL% %CUDA_DOWNLOAD_URL%/cuda-11-7-windows-amd64.tar.gz -e --strip 1 -o %BIN_PATH% + +move %BIN_PATH%cortex-server-beta.exe %BIN_PATH%cortex-server.exe +copy %BIN_PATH%cortex-server.exe %BIN_PATH%cortex-server-x86_64-pc-windows-msvc.exe +del %BIN_PATH%cortex-beta.exe +del %BIN_PATH%cortex.exe + +@REM Loop through each folder and move DLLs (excluding engine.dll) +for %%F in (%SUBFOLDERS%) do ( + echo Processing folder: .\engines\cortex.llamacpp\%%F\v%ENGINE_VERSION% + + @REM Move all .dll files except engine.dll + for %%D in (.\engines\cortex.llamacpp\%%F\v%ENGINE_VERSION%\*.dll) do ( + if /I not "%%~nxD"=="engine.dll" ( + move "%%D" "%BIN_PATH%" + ) + ) +) + +echo DLL files moved successfully. diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 9b8fd192a..f2ae334b3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -6,8 +6,8 @@ "build": { "frontendDist": "../web/out", "devUrl": "http://localhost:3000", - "beforeDevCommand": "IS_TAURI=true yarn dev:web", - "beforeBuildCommand": "IS_TAURI=true yarn build:web" + "beforeDevCommand": "cross-env IS_TAURI=true yarn dev:web", + "beforeBuildCommand": "cross-env IS_TAURI=true yarn build:web" }, "app": { "macOSPrivateApi": true,