dsh-liuying-voice 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-liuying-voice",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "流萤语音插件 for DeepSeek Harness:本地 edge-tts + RVC / GPT-SoVITS 双引擎,自带流萤参考音频、一键环境安装脚本、独立设置页面与 DSH 设置入口。开源 MIT。",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -1,4 +1,4 @@
1
- # ============================================================
1
+ # ============================================================
2
2
  # GPT-SoVITS 简易环境安装脚本(CPU 推理,配合 dsh-liuying-voice 使用)
3
3
  #
4
4
  # 做什么:
@@ -26,11 +26,29 @@ New-Item -ItemType Directory -Path $root -Force | Out-Null
26
26
 
27
27
  # 1. Python
28
28
  $python = $null
29
- foreach ($cand in @('python3.11', 'python3.10', 'python')) {
29
+ foreach ($cand in @('python3.11', 'python3.10')) {
30
30
  $cmd = Get-Command $cand -ErrorAction SilentlyContinue
31
31
  if ($cmd) { $python = $cmd.Source; break }
32
32
  }
33
- if (-not $python) { throw "需要 Python 3.10/3.11(GPT-SoVITS 依赖),请先安装并加入 PATH" }
33
+ if (-not $python) {
34
+ $pyDir = Join-Path $root 'python'
35
+ $pyExe = Join-Path $pyDir 'python.exe'
36
+ if (-not (Test-Path $pyExe)) {
37
+ Step '未找到 Python 3.10/3.11,下载便携版 3.11(约 10 MB)'
38
+ $zipFile = Join-Path $root 'python311-embed.zip'
39
+ Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip' -OutFile $zipFile -TimeoutSec 600
40
+ Expand-Archive -Path $zipFile -DestinationPath $pyDir -Force
41
+ $pth = Join-Path $pyDir 'python311._pth'
42
+ if (Test-Path $pth) {
43
+ $lines = Get-Content $pth | ForEach-Object { if ($_ -match '^#\s*import site') { 'import site' } else { $_ } }
44
+ [System.IO.File]::WriteAllLines($pth, $lines, (New-Object System.Text.UTF8Encoding($false)))
45
+ }
46
+ $gp = Join-Path $pyDir 'get-pip.py'
47
+ Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/get-pip.py' -OutFile $gp -TimeoutSec 300
48
+ & $pyExe $gp --no-warn-script-location
49
+ }
50
+ $python = $pyExe
51
+ }
34
52
  Write-Host "Python: $python"
35
53
 
36
54
  # 2. 源码
@@ -41,18 +59,18 @@ if (-not (Test-Path (Join-Path $repo 'api_v2.py'))) {
41
59
  }
42
60
  if (-not (Test-Path (Join-Path $repo 'api_v2.py'))) { throw "源码下载失败,请检查网络或代理" }
43
61
 
44
- # 3. 虚拟环境
45
- $venv = Join-Path $root 'venv'
46
- if (-not (Test-Path (Join-Path $venv 'Scripts\python.exe'))) {
47
- Step '创建虚拟环境'
48
- & $python -m venv $venv
49
- }
50
- $py = Join-Path $venv 'Scripts\python.exe'
62
+ # 3. 依赖(直接装到检测到的 Python,便携版也不需要 venv)
63
+ $py = $python
51
64
  & $py -m pip install -U pip -i $pipIndex
65
+ # 先装 numpy:pyopenjtalk 等包构建时需要
66
+ & $py -m pip install numpy -i $pipIndex
52
67
 
53
- Step '安装推理依赖(阿里镜像)'
68
+ Step '安装推理依赖(阿里镜像;pyopenjtalk 若编译失败需要 VS Build Tools,会跳过继续)'
54
69
  & $py -m pip install -r (Join-Path $repo 'requirements.txt') -i $pipIndex
55
- & $py -m pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
70
+ if ($LASTEXITCODE -ne 0) {
71
+ Write-Warning '部分依赖安装失败(pyopenjtalk 需要 C++ 构建工具),继续安装 torch,缺失的可稍后补'
72
+ }
73
+ & $py -m pip install torch==2.7.1 torchaudio==2.7.1 --index-url https://download.pytorch.org/whl/cpu
56
74
 
57
75
  # 4. 预训练
58
76
  $pretrained = Join-Path $repo 'GPT_SoVITS\pretrained_models'