@nicfox77/parakeet-stt 0.2.1 → 0.2.3

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 +55 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicfox77/parakeet-stt",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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,6 +8,7 @@ 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
13
  # Model URLs (GitHub release - mirrored from Handy project)
13
14
  # Fallback to Handy if GitHub is unavailable
@@ -143,6 +144,59 @@ for script in parakeet-lazy-daemon.py parakeet-audio-client.py parakeet_transcri
143
144
  fi
144
145
  done
145
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
+
183
+ # Apply config changes properly (requires config.apply, not just restart)
184
+ apply_config() {
185
+ if command -v openclaw &> /dev/null; then
186
+ echo ""
187
+ echo "Applying configuration to OpenClaw gateway..."
188
+ openclaw gateway call config.apply --params '{"raw": "'$(cat "$OPENCLAW_CONFIG" | jq -c '.')'", "note": "Parakeet STT installation"}' 2>/dev/null || {
189
+ echo "Note: Could not apply config automatically. Please run:"
190
+ echo " openclaw gateway restart"
191
+ }
192
+ fi
193
+ }
194
+
195
+ # Only apply if we added new config
196
+ if jq -e '.tools.media.audio.models[]? | select(.command | contains("parakeet"))' "$OPENCLAW_CONFIG" > /dev/null 2>&1; then
197
+ apply_config
198
+ fi
199
+
146
200
  echo ""
147
201
  echo "=== Installation Complete ==="
148
202
  echo ""
@@ -155,5 +209,4 @@ echo "To switch models, run:"
155
209
  echo " $0 v2 # English optimized"
156
210
  echo " $0 v3 # Multilingual"
157
211
  echo ""
158
- echo "OpenClaw config (already configured):"
159
- echo ' tools.media.audio.models → parakeet-audio-client.py'
212
+ echo "Audio transcription is now configured and ready."