@nicfox77/parakeet-stt 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/install.sh +71 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicfox77/parakeet-stt",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Parakeet TDT INT8 speech-to-text plugin for OpenClaw. Supports V2 (English) and V3 (Multilingual) models.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -8,10 +8,14 @@ set -e
8
8
  # Configuration
9
9
  PARAKEET_DIR="${PARAKEET_DIR:-$HOME/.openclaw/tools/parakeet}"
10
10
  VENV_DIR="$PARAKEET_DIR/.venv"
11
+ OPENCLAW_CONFIG="$HOME/.openclaw/openclaw.json"
11
12
 
12
- # Model URLs (from Handy project)
13
- MODEL_URLS_V2="https://blob.handy.computer/parakeet-v2-int8.tar.gz"
14
- MODEL_URLS_V3="https://blob.handy.computer/parakeet-v3-int8.tar.gz"
13
+ # Model URLs (GitHub release - mirrored from Handy project)
14
+ # Fallback to Handy if GitHub is unavailable
15
+ MODEL_URLS_V2="https://github.com/Nicfox77/openclaw-parakeet-stt-plugin/releases/download/v1.0.0/parakeet-v2-int8.tar.gz"
16
+ MODEL_URLS_V2_FALLBACK="https://blob.handy.computer/parakeet-v2-int8.tar.gz"
17
+ MODEL_URLS_V3="https://github.com/Nicfox77/openclaw-parakeet-stt-plugin/releases/download/v1.0.0/parakeet-v3-int8.tar.gz"
18
+ MODEL_URLS_V3_FALLBACK="https://blob.handy.computer/parakeet-v3-int8.tar.gz"
15
19
 
16
20
  # Default to V2 (English optimized)
17
21
  VERSION="${1:-v2}"
@@ -77,13 +81,32 @@ if [ ! -d "$MODEL_DIR" ] || [ ! -f "$MODEL_DIR/model.onnx" ]; then
77
81
 
78
82
  TMP_TAR="/tmp/parakeet-$VERSION-int8.tar.gz"
79
83
 
80
- if command -v wget &> /dev/null; then
81
- wget -O "$TMP_TAR" "$MODEL_URL"
82
- elif command -v curl &> /dev/null; then
83
- curl -L -o "$TMP_TAR" "$MODEL_URL"
84
- else
85
- echo "Error: wget or curl required for download"
86
- exit 1
84
+ download_model() {
85
+ local url="$1"
86
+ local output="$2"
87
+ if command -v wget &> /dev/null; then
88
+ wget -O "$output" "$url"
89
+ elif command -v curl &> /dev/null; then
90
+ curl -L -o "$output" "$url"
91
+ else
92
+ echo "Error: wget or curl required for download"
93
+ return 1
94
+ fi
95
+ }
96
+
97
+ # Try primary URL, fall back to Handy if it fails
98
+ if ! download_model "$MODEL_URL" "$TMP_TAR"; then
99
+ echo "Primary download failed, trying fallback..."
100
+ FALLBACK_URL=""
101
+ if [[ "$VERSION" == "v2" ]]; then
102
+ FALLBACK_URL="$MODEL_URLS_V2_FALLBACK"
103
+ else
104
+ FALLBACK_URL="$MODEL_URLS_V3_FALLBACK"
105
+ fi
106
+ if ! download_model "$FALLBACK_URL" "$TMP_TAR"; then
107
+ echo "Error: Failed to download model"
108
+ exit 1
109
+ fi
87
110
  fi
88
111
 
89
112
  echo "Extracting model..."
@@ -121,6 +144,42 @@ for script in parakeet-lazy-daemon.py parakeet-audio-client.py parakeet_transcri
121
144
  fi
122
145
  done
123
146
 
147
+ # Configure OpenClaw to use Parakeet for audio transcription
148
+ configure_openclaw() {
149
+ if [ ! -f "$OPENCLAW_CONFIG" ]; then
150
+ echo "Warning: OpenClaw config not found at $OPENCLAW_CONFIG"
151
+ return 1
152
+ fi
153
+
154
+ # Check if jq is available
155
+ if ! command -v jq &> /dev/null; then
156
+ echo "Warning: jq not found, skipping automatic config"
157
+ echo "Please manually add to openclaw.json:"
158
+ echo ' tools.media.audio.models: [{"type": "cli", "command": "'$PARAKEET_DIR'/parakeet-audio-client.py", "args": ["{{MediaPath}}", "{{OutputDir}}"]}]'
159
+ return 1
160
+ fi
161
+
162
+ # Check if parakeet is already configured
163
+ if jq -e '.tools.media.audio.models[]? | select(.command | contains("parakeet"))' "$OPENCLAW_CONFIG" > /dev/null 2>&1; then
164
+ echo "Parakeet already configured in OpenClaw"
165
+ return 0
166
+ fi
167
+
168
+ echo "Configuring OpenClaw to use Parakeet for audio transcription..."
169
+
170
+ # Add parakeet to audio models
171
+ local tmp_config=$(mktemp)
172
+ jq '.tools.media.audio.models += [{
173
+ "type": "cli",
174
+ "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",
175
+ "args": ["{{MediaPath}}", "{{OutputDir}}"]
176
+ }]' "$OPENCLAW_CONFIG" > "$tmp_config" && mv "$tmp_config" "$OPENCLAW_CONFIG"
177
+
178
+ echo "Added Parakeet to tools.media.audio.models"
179
+ }
180
+
181
+ configure_openclaw || true
182
+
124
183
  echo ""
125
184
  echo "=== Installation Complete ==="
126
185
  echo ""
@@ -133,5 +192,5 @@ echo "To switch models, run:"
133
192
  echo " $0 v2 # English optimized"
134
193
  echo " $0 v3 # Multilingual"
135
194
  echo ""
136
- echo "OpenClaw config (already configured):"
137
- echo ' tools.media.audio.models parakeet-audio-client.py'
195
+ echo "Restart OpenClaw gateway to apply changes:"
196
+ echo " openclaw gateway restart"