@nicfox77/parakeet-stt 0.2.2 → 0.2.4

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 +45 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicfox77/parakeet-stt",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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": {
@@ -151,14 +151,6 @@ configure_openclaw() {
151
151
  return 1
152
152
  fi
153
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
154
  # Check if parakeet is already configured
163
155
  if jq -e '.tools.media.audio.models[]? | select(.command | contains("parakeet"))' "$OPENCLAW_CONFIG" > /dev/null 2>&1; then
164
156
  echo "Parakeet already configured in OpenClaw"
@@ -167,15 +159,51 @@ configure_openclaw() {
167
159
 
168
160
  echo "Configuring OpenClaw to use Parakeet for audio transcription..."
169
161
 
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"
162
+ # Use config.patch RPC for partial update (cleaner than modifying file directly)
163
+ if command -v openclaw &> /dev/null; then
164
+ local patch_json=$(cat <<EOF
165
+ {
166
+ "patch": {
167
+ "tools": {
168
+ "media": {
169
+ "audio": {
170
+ "models": [
171
+ {
172
+ "type": "cli",
173
+ "command": "$PARAKEET_DIR/parakeet-audio-client.py",
174
+ "args": ["{{MediaPath}}", "{{OutputDir}}"]
175
+ }
176
+ ]
177
+ }
178
+ }
179
+ }
180
+ }
181
+ }
182
+ EOF
183
+ )
184
+ openclaw gateway call config.patch --params "$patch_json" 2>/dev/null && {
185
+ echo "Applied config.patch - Parakeet configured and gateway reloaded"
186
+ return 0
187
+ } || {
188
+ echo "config.patch failed, falling back to file modification..."
189
+ }
190
+ fi
177
191
 
178
- echo "Added Parakeet to tools.media.audio.models"
192
+ # Fallback: modify config file directly if jq available
193
+ if command -v jq &> /dev/null; then
194
+ local tmp_config=$(mktemp)
195
+ jq '.tools.media.audio.models += [{
196
+ "type": "cli",
197
+ "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",
198
+ "args": ["{{MediaPath}}", "{{OutputDir}}"]
199
+ }]' "$OPENCLAW_CONFIG" > "$tmp_config" && mv "$tmp_config" "$OPENCLAW_CONFIG"
200
+ echo "Added Parakeet to tools.media.audio.models (file modified directly)"
201
+ echo "Note: Gateway will auto-reload, or run: openclaw gateway restart"
202
+ else
203
+ echo "Warning: jq not found, skipping automatic config"
204
+ echo "Please manually add to openclaw.json:"
205
+ echo ' tools.media.audio.models: [{"type": "cli", "command": "'$PARAKEET_DIR'/parakeet-audio-client.py", "args": ["{{MediaPath}}", "{{OutputDir}}"]}]'
206
+ fi
179
207
  }
180
208
 
181
209
  configure_openclaw || true
@@ -192,5 +220,4 @@ echo "To switch models, run:"
192
220
  echo " $0 v2 # English optimized"
193
221
  echo " $0 v3 # Multilingual"
194
222
  echo ""
195
- echo "Restart OpenClaw gateway to apply changes:"
196
- echo " openclaw gateway restart"
223
+ echo "Audio transcription is now configured and ready."