39 lines
1.6 KiB
PowerShell
39 lines
1.6 KiB
PowerShell
|
|
# 下载vosk-android AAR文件
|
|||
|
|
$voskVersion = "0.3.47"
|
|||
|
|
$voskUrl = "https://repo1.maven.org/maven2/com/alphacephei/vosk-android/$voskVersion/vosk-android-$voskVersion.aar"
|
|||
|
|
$libsDir = "fronted_uniapp\uni_modules\xwq-speech-to-text\utssdk\app-android\libs"
|
|||
|
|
|
|||
|
|
Write-Host "🔽 正在下载vosk-android $voskVersion..." -ForegroundColor Cyan
|
|||
|
|
|
|||
|
|
# 创建libs目录
|
|||
|
|
if (-not (Test-Path $libsDir)) {
|
|||
|
|
New-Item -ItemType Directory -Path $libsDir -Force | Out-Null
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$outputFile = Join-Path $libsDir "vosk-android-$voskVersion.aar"
|
|||
|
|
|
|||
|
|
try {
|
|||
|
|
# 使用阿里云镜像(如果可用)
|
|||
|
|
$aliyunUrl = "https://maven.aliyun.com/repository/public/com/alphacephei/vosk-android/$voskVersion/vosk-android-$voskVersion.aar"
|
|||
|
|
|
|||
|
|
Write-Host "尝试从阿里云镜像下载..." -ForegroundColor Yellow
|
|||
|
|
Invoke-WebRequest -Uri $aliyunUrl -OutFile $outputFile -ErrorAction Stop
|
|||
|
|
Write-Host "✅ 下载成功!" -ForegroundColor Green
|
|||
|
|
} catch {
|
|||
|
|
Write-Host "阿里云镜像失败,尝试Maven中央仓库..." -ForegroundColor Yellow
|
|||
|
|
try {
|
|||
|
|
Invoke-WebRequest -Uri $voskUrl -OutFile $outputFile -ErrorAction Stop
|
|||
|
|
Write-Host "✅ 下载成功!" -ForegroundColor Green
|
|||
|
|
} catch {
|
|||
|
|
Write-Host "❌ 下载失败: $_" -ForegroundColor Red
|
|||
|
|
Write-Host "请手动从以下地址下载:" -ForegroundColor Yellow
|
|||
|
|
Write-Host $voskUrl -ForegroundColor Cyan
|
|||
|
|
Write-Host "并保存到:$outputFile" -ForegroundColor Cyan
|
|||
|
|
exit 1
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "文件保存位置:$outputFile" -ForegroundColor Green
|
|||
|
|
Write-Host "文件大小:$((Get-Item $outputFile).Length / 1MB) MB" -ForegroundColor Green
|