@nicfox77/parakeet-stt 0.2.7 → 0.2.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/package.json +1 -1
- package/scripts/install.sh +54 -24
- package/scripts/parakeet-audio-client.py +6 -3
package/package.json
CHANGED
package/scripts/install.sh
CHANGED
|
@@ -73,7 +73,7 @@ pip install --upgrade pip
|
|
|
73
73
|
pip install onnxruntime librosa soundfile
|
|
74
74
|
|
|
75
75
|
# Download and extract model if not present
|
|
76
|
-
if [ ! -d "$MODEL_DIR" ] || [ ! -f "$MODEL_DIR/model.onnx" ]; then
|
|
76
|
+
if [ ! -d "$MODEL_DIR" ] || [ ! -f "$MODEL_DIR/encoder-model.int8.onnx" ]; then
|
|
77
77
|
echo ""
|
|
78
78
|
echo "Downloading Parakeet TDT $VERSION model (~$MODEL_SIZE)..."
|
|
79
79
|
echo "URL: $MODEL_URL"
|
|
@@ -147,35 +147,67 @@ done
|
|
|
147
147
|
configure_openclaw() {
|
|
148
148
|
echo "Configuring OpenClaw to use Parakeet for audio transcription..."
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
CONFIG_FILE="$HOME/.openclaw/openclaw.json"
|
|
151
|
+
|
|
152
|
+
if [ ! -f "$CONFIG_FILE" ]; then
|
|
153
|
+
echo "Warning: OpenClaw config not found at $CONFIG_FILE"
|
|
154
|
+
echo "Please configure manually after running 'openclaw configure'"
|
|
155
|
+
return 1
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
# Check if jq is available
|
|
159
|
+
if ! command -v jq &> /dev/null; then
|
|
160
|
+
echo "Warning: jq not found. Please install jq for automatic config."
|
|
161
|
+
echo "Then re-run this script or configure manually."
|
|
162
|
+
return 1
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# Build the audio config
|
|
166
|
+
AUDIO_CONFIG=$(cat <<EOF
|
|
167
|
+
{
|
|
168
|
+
"enabled": true,
|
|
169
|
+
"scope": {
|
|
170
|
+
"default": "deny",
|
|
171
|
+
"rules": [{ "action": "allow", "match": { "chatType": "direct" } }]
|
|
172
|
+
},
|
|
173
|
+
"models": [{
|
|
174
|
+
"type": "cli",
|
|
175
|
+
"command": "$PARAKEET_DIR/parakeet-audio-client.py",
|
|
176
|
+
"args": ["{{MediaPath}}"]
|
|
177
|
+
}]
|
|
178
|
+
}
|
|
179
|
+
EOF
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
# Merge into config using jq
|
|
183
|
+
# This creates tools.media.audio if it doesn't exist, or updates it
|
|
184
|
+
TMP_CONFIG=$(mktemp)
|
|
185
|
+
jq --argjson audio "$AUDIO_CONFIG" '
|
|
186
|
+
.tools.media.audio = $audio
|
|
187
|
+
' "$CONFIG_FILE" > "$TMP_CONFIG" && mv "$TMP_CONFIG" "$CONFIG_FILE"
|
|
188
|
+
|
|
189
|
+
echo "Config updated successfully"
|
|
190
|
+
|
|
191
|
+
# Restart gateway to pick up changes
|
|
151
192
|
if command -v openclaw &> /dev/null; then
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
openclaw gateway call config.patch --params '{
|
|
157
|
-
"raw": "{ tools: { media: { audio: { models: [{ \"type\": \"cli\", \"command\": \"'$PARAKEET_DIR'/parakeet-audio-client.py\", \"args\": [\"{{MediaPath}}\"] }] } } } } }",
|
|
158
|
-
"baseHash": "'$CONFIG_HASH'"
|
|
159
|
-
}' 2>/dev/null && {
|
|
160
|
-
echo "Applied config.patch - Parakeet configured and gateway reloaded"
|
|
161
|
-
return 0
|
|
162
|
-
} || {
|
|
163
|
-
echo "Warning: config.patch failed"
|
|
164
|
-
}
|
|
165
|
-
else
|
|
166
|
-
echo "Warning: Could not get config hash for config.patch"
|
|
167
|
-
fi
|
|
168
|
-
else
|
|
169
|
-
echo "Warning: openclaw CLI not found"
|
|
193
|
+
echo "Restarting OpenClaw gateway..."
|
|
194
|
+
openclaw gateway restart 2>/dev/null || {
|
|
195
|
+
echo "Note: Gateway restart failed. Run 'openclaw gateway restart' manually."
|
|
196
|
+
}
|
|
170
197
|
fi
|
|
171
198
|
|
|
172
|
-
|
|
199
|
+
return 0
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
configure_openclaw || {
|
|
173
203
|
echo ""
|
|
174
|
-
echo "Please manually add to your openclaw.json:"
|
|
204
|
+
echo "Automatic config failed. Please manually add to your openclaw.json:"
|
|
175
205
|
echo ""
|
|
176
206
|
echo ' "tools": {'
|
|
177
207
|
echo ' "media": {'
|
|
178
208
|
echo ' "audio": {'
|
|
209
|
+
echo ' "enabled": true,'
|
|
210
|
+
echo ' "scope": { "default": "deny", "rules": [{ "action": "allow", "match": { "chatType": "direct" } }] },'
|
|
179
211
|
echo ' "models": [{'
|
|
180
212
|
echo ' "type": "cli",'
|
|
181
213
|
echo ' "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",'
|
|
@@ -188,8 +220,6 @@ configure_openclaw() {
|
|
|
188
220
|
echo "Then run: openclaw gateway restart"
|
|
189
221
|
}
|
|
190
222
|
|
|
191
|
-
configure_openclaw || true
|
|
192
|
-
|
|
193
223
|
echo ""
|
|
194
224
|
echo "=== Installation Complete ==="
|
|
195
225
|
echo ""
|
|
@@ -12,7 +12,9 @@ import sys
|
|
|
12
12
|
import time
|
|
13
13
|
|
|
14
14
|
SOCKET_PATH = "/tmp/parakeet-lazy.sock"
|
|
15
|
-
|
|
15
|
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
16
|
+
DAEMON_PATH = os.path.join(SCRIPT_DIR, "parakeet-lazy-daemon.py")
|
|
17
|
+
VENV_PYTHON = os.path.join(SCRIPT_DIR, ".venv", "bin", "python")
|
|
16
18
|
|
|
17
19
|
def ensure_daemon():
|
|
18
20
|
"""Check if daemon is running, start it if not."""
|
|
@@ -23,10 +25,11 @@ def ensure_daemon():
|
|
|
23
25
|
return # daemon already running
|
|
24
26
|
except Exception:
|
|
25
27
|
pass
|
|
26
|
-
# Start daemon in background
|
|
28
|
+
# Start daemon in background with venv Python
|
|
29
|
+
python_exe = VENV_PYTHON if os.path.exists(VENV_PYTHON) else sys.executable
|
|
27
30
|
try:
|
|
28
31
|
subprocess.Popen(
|
|
29
|
-
[
|
|
32
|
+
[python_exe, DAEMON_PATH],
|
|
30
33
|
stdout=subprocess.DEVNULL,
|
|
31
34
|
stderr=subprocess.DEVNULL,
|
|
32
35
|
start_new_session=True
|