deep-read-summarize 0.3.7 → 0.3.9
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/CHANGELOG.md +71 -1
- package/README.en.md +13 -9
- package/README.md +14 -10
- package/cordis.patch.yml +14 -7
- package/docs/RELEASE.md +44 -7
- package/index.js +60 -6
- package/package.json +4 -3
- package/parsers/book.js +1 -1
- package/parsers/video.js +54 -18
- package/schemas/index.js +9 -2
- package/scripts/transcribe.js +306 -0
- package/skills/deep-read-summarize/SKILL.md +11 -9
- package/tests/index.test.js +319 -1
- package/tests/run-tests.js +7 -3
- package/workflow.js +89 -76
- package/scripts/transcribe.ps1 +0 -68
package/scripts/transcribe.ps1
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# transcribe.ps1 - faster-whisper transcription bootstrap (plugin-internal, self-bootstrapping)
|
|
2
|
-
# Usage: pwsh transcribe.ps1 -Audio <file> -Out <txt> [-Model small] [-Language zh]
|
|
3
|
-
# Deterministic per-user cache so behavior is identical on dev & user machines.
|
|
4
|
-
param(
|
|
5
|
-
[Parameter(Mandatory=$true)][string]$Audio,
|
|
6
|
-
[Parameter(Mandatory=$true)][string]$Out,
|
|
7
|
-
[string]$Model = 'small',
|
|
8
|
-
[string]$Language = 'zh'
|
|
9
|
-
)
|
|
10
|
-
$ErrorActionPreference = 'Stop'
|
|
11
|
-
|
|
12
|
-
$cacheRoot = Join-Path $env:LOCALAPPDATA 'deep-read-summarize'
|
|
13
|
-
$venvDir = Join-Path $cacheRoot 'venv'
|
|
14
|
-
$venvPy = Join-Path $venvDir 'Scripts/python.exe'
|
|
15
|
-
$hfHome = Join-Path $cacheRoot 'hf'
|
|
16
|
-
$pyScript = Join-Path $cacheRoot 'transcribe_run.py'
|
|
17
|
-
|
|
18
|
-
New-Item -ItemType Directory -Force -Path $cacheRoot | Out-Null
|
|
19
|
-
|
|
20
|
-
$uv = $null
|
|
21
|
-
$uvCmd = Get-Command uv -ErrorAction SilentlyContinue
|
|
22
|
-
if ($uvCmd) { $uv = $uvCmd.Source }
|
|
23
|
-
else { $alt = Join-Path $HOME '.local/bin/uv.exe'; if (Test-Path $alt) { $uv = $alt } }
|
|
24
|
-
if (-not $uv) { throw 'uv not found. Please install uv (winget install astral-sh.uv) or ensure it is on PATH.' }
|
|
25
|
-
|
|
26
|
-
# Use a China mirror for CPython download (uv pulls python-build-standalone from GitHub, slow in CN),
|
|
27
|
-
# and prefer an already-installed 3.12 (avoids the download entirely on many machines).
|
|
28
|
-
$env:UV_PYTHON_INSTALL_MIRROR = 'https://ghproxy.com/https://github.com/astral-sh/python-build-standalone/releases/download'
|
|
29
|
-
|
|
30
|
-
if (-not (Test-Path $venvPy)) {
|
|
31
|
-
# reuse an existing python 3.12 if present; else uv installs 3.12 (via mirror)
|
|
32
|
-
$usePy = (py -0p 2>$null | Select-String '3.12' | Select-Object -First 1)
|
|
33
|
-
if ($usePy) { $pyArg = '3.12' } else { $pyArg = '3.12' }
|
|
34
|
-
& $uv venv --python $pyArg $venvDir
|
|
35
|
-
if ($LASTEXITCODE -ne 0) { throw 'uv venv creation failed.' }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
& $venvPy -c 'import faster_whisper' 2>$null
|
|
39
|
-
if ($LASTEXITCODE -ne 0) {
|
|
40
|
-
& $uv pip install --python $venvPy faster-whisper -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|
41
|
-
if ($LASTEXITCODE -ne 0) { throw 'faster-whisper install failed (mirror unreachable?).' }
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
$env:HF_ENDPOINT = 'https://hf-mirror.com'
|
|
45
|
-
$env:HF_HOME = $hfHome
|
|
46
|
-
# Disable the hf-xet backend: it bypasses the mirror (cas-server.xethub.hf.co) and 401s; the mirror works over plain HTTP.
|
|
47
|
-
$env:HF_HUB_DISABLE_XET = '1'
|
|
48
|
-
$env:HF_HUB_DISABLE_SYMLINKS_WARNING = '1'
|
|
49
|
-
$env:DRS_AUDIO = $Audio
|
|
50
|
-
$env:DRS_OUT = $Out
|
|
51
|
-
$env:DRS_MODEL = $Model
|
|
52
|
-
$env:DRS_LANG = $Language
|
|
53
|
-
|
|
54
|
-
$py = @'
|
|
55
|
-
import os
|
|
56
|
-
from faster_whisper import WhisperModel
|
|
57
|
-
m = WhisperModel(os.environ['DRS_MODEL'], device='auto', compute_type='int8')
|
|
58
|
-
segs, info = m.transcribe(os.environ['DRS_AUDIO'], vad_filter=True, language=(os.environ.get('DRS_LANG') or None))
|
|
59
|
-
with open(os.environ['DRS_OUT'], 'w', encoding='utf-8') as f:
|
|
60
|
-
for s in segs:
|
|
61
|
-
f.write(s.text.strip() + ' ')
|
|
62
|
-
print('DONE', info.language, round(info.duration, 1))
|
|
63
|
-
'@
|
|
64
|
-
[System.IO.File]::WriteAllText($pyScript, $py, (New-Object System.Text.UTF8Encoding($false)))
|
|
65
|
-
|
|
66
|
-
& $venvPy $pyScript
|
|
67
|
-
if ($LASTEXITCODE -ne 0) { throw 'transcription failed.' }
|
|
68
|
-
Write-Output ('TRANSCRIBED ' + (Get-Item $Out).Length + ' bytes to ' + $Out)
|