42 lines
1.9 KiB
PowerShell
42 lines
1.9 KiB
PowerShell
# Скачивает готовый llama-server.exe (CPU x64) из релиза llama.cpp в <репо>\tools\
|
||
# Запуск из корня репозитория:
|
||
# powershell -ExecutionPolicy Bypass -File install\assistant\download_llama_server_windows.ps1
|
||
#
|
||
# При смене релиза обновите $ReleaseTag (см. https://github.com/ggml-org/llama.cpp/releases )
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
$ReleaseTag = "b8864"
|
||
$ZipName = "llama-$ReleaseTag-bin-win-cpu-x64.zip"
|
||
$Url = "https://github.com/ggml-org/llama.cpp/releases/download/$ReleaseTag/$ZipName"
|
||
|
||
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
|
||
$toolsDir = Join-Path $repoRoot "tools"
|
||
$zipPath = Join-Path $env:TEMP "wesp-$ZipName"
|
||
$destExe = Join-Path $toolsDir "llama-server.exe"
|
||
|
||
New-Item -ItemType Directory -Force -Path $toolsDir | Out-Null
|
||
|
||
if (Test-Path -LiteralPath $destExe) {
|
||
Write-Host "Уже есть: $destExe" -ForegroundColor Green
|
||
exit 0
|
||
}
|
||
|
||
Write-Host "Загрузка: $Url" -ForegroundColor Cyan
|
||
Invoke-WebRequest -Uri $Url -OutFile $zipPath -UseBasicParsing
|
||
|
||
Write-Host "Распаковка..." -ForegroundColor Cyan
|
||
$extractDir = Join-Path $env:TEMP "wesp-llama-$ReleaseTag"
|
||
if (Test-Path $extractDir) { Remove-Item -Recurse -Force $extractDir }
|
||
Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force
|
||
|
||
$found = Get-ChildItem -Path $extractDir -Filter "llama-server.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
||
if (-not $found) {
|
||
Write-Error "В архиве не найден llama-server.exe — скачайте вручную с https://github.com/ggml-org/llama.cpp/releases"
|
||
}
|
||
|
||
Copy-Item -LiteralPath $found.FullName -Destination $destExe -Force
|
||
Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
|
||
Remove-Item $extractDir -Recurse -Force -ErrorAction SilentlyContinue
|
||
|
||
Write-Host "OK: $destExe" -ForegroundColor Green
|