@nicfox77/parakeet-stt 0.2.5 → 0.2.7
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 +4 -2
- package/scripts/install.sh +17 -21
- package/scripts/parakeet-audio-client.py +26 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicfox77/parakeet-stt",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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": {
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"@sinclair/typebox": "0.34.48"
|
|
23
23
|
},
|
|
24
24
|
"openclaw": {
|
|
25
|
-
"extensions": [
|
|
25
|
+
"extensions": [
|
|
26
|
+
"./index.ts"
|
|
27
|
+
]
|
|
26
28
|
}
|
|
27
29
|
}
|
package/scripts/install.sh
CHANGED
|
@@ -147,28 +147,24 @@ done
|
|
|
147
147
|
configure_openclaw() {
|
|
148
148
|
echo "Configuring OpenClaw to use Parakeet for audio transcription..."
|
|
149
149
|
|
|
150
|
-
# Use config.patch RPC for partial update
|
|
150
|
+
# Use config.patch RPC for partial update
|
|
151
151
|
if command -v openclaw &> /dev/null; then
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
152
|
+
# Get current config hash (required for config.patch)
|
|
153
|
+
CONFIG_HASH=$(openclaw gateway call config.get --params '{}' --json 2>/dev/null | jq -r '.payload.hash' 2>/dev/null)
|
|
154
|
+
|
|
155
|
+
if [ -n "$CONFIG_HASH" ] && [ "$CONFIG_HASH" != "null" ]; then
|
|
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"
|
|
165
164
|
}
|
|
166
|
-
|
|
167
|
-
echo "
|
|
168
|
-
|
|
169
|
-
} || {
|
|
170
|
-
echo "Warning: config.patch failed"
|
|
171
|
-
}
|
|
165
|
+
else
|
|
166
|
+
echo "Warning: Could not get config hash for config.patch"
|
|
167
|
+
fi
|
|
172
168
|
else
|
|
173
169
|
echo "Warning: openclaw CLI not found"
|
|
174
170
|
fi
|
|
@@ -183,7 +179,7 @@ configure_openclaw() {
|
|
|
183
179
|
echo ' "models": [{'
|
|
184
180
|
echo ' "type": "cli",'
|
|
185
181
|
echo ' "command": "'$PARAKEET_DIR'/parakeet-audio-client.py",'
|
|
186
|
-
echo ' "args": ["{{MediaPath}}"
|
|
182
|
+
echo ' "args": ["{{MediaPath}}"]'
|
|
187
183
|
echo ' }]'
|
|
188
184
|
echo ' }'
|
|
189
185
|
echo ' }'
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Parakeet Audio Client for OpenClaw
|
|
4
|
+
Transcribes audio files using the Parakeet lazy daemon.
|
|
5
|
+
Outputs transcript to stdout (OpenClaw CLI model requirement).
|
|
6
|
+
"""
|
|
2
7
|
import json
|
|
3
8
|
import os
|
|
4
9
|
import socket
|
|
@@ -10,7 +15,7 @@ SOCKET_PATH = "/tmp/parakeet-lazy.sock"
|
|
|
10
15
|
DAEMON_PATH = os.path.expanduser("~/.openclaw/tools/parakeet/parakeet-lazy-daemon.py")
|
|
11
16
|
|
|
12
17
|
def ensure_daemon():
|
|
13
|
-
|
|
18
|
+
"""Check if daemon is running, start it if not."""
|
|
14
19
|
try:
|
|
15
20
|
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
|
|
16
21
|
s.settimeout(0.5)
|
|
@@ -32,6 +37,7 @@ def ensure_daemon():
|
|
|
32
37
|
sys.exit(1)
|
|
33
38
|
|
|
34
39
|
def query_daemon(audio_path):
|
|
40
|
+
"""Query the daemon for transcription."""
|
|
35
41
|
for attempt in range(3):
|
|
36
42
|
try:
|
|
37
43
|
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
|
|
@@ -49,25 +55,36 @@ def query_daemon(audio_path):
|
|
|
49
55
|
if response_data:
|
|
50
56
|
response = json.loads(response_data.strip())
|
|
51
57
|
if "text" in response:
|
|
52
|
-
|
|
53
|
-
return 0
|
|
58
|
+
return response["text"]
|
|
54
59
|
else:
|
|
55
60
|
print(response.get("error", "Unknown error"), file=sys.stderr)
|
|
56
|
-
return
|
|
61
|
+
return None
|
|
57
62
|
else:
|
|
58
63
|
time.sleep(0.5)
|
|
59
64
|
except Exception as e:
|
|
60
65
|
if attempt == 2:
|
|
61
66
|
print(f"Daemon communication failed: {e}", file=sys.stderr)
|
|
62
|
-
return
|
|
67
|
+
return None
|
|
63
68
|
time.sleep(0.5)
|
|
64
|
-
return
|
|
69
|
+
return None
|
|
65
70
|
|
|
66
71
|
if __name__ == "__main__":
|
|
67
72
|
if len(sys.argv) < 2:
|
|
68
|
-
print("Usage: parakeet-audio-client.py <audio_path>
|
|
73
|
+
print("Usage: parakeet-audio-client.py <audio_path>", file=sys.stderr)
|
|
69
74
|
sys.exit(1)
|
|
75
|
+
|
|
70
76
|
audio_path = sys.argv[1]
|
|
71
|
-
|
|
77
|
+
|
|
78
|
+
# Start daemon if needed
|
|
72
79
|
ensure_daemon()
|
|
73
|
-
|
|
80
|
+
|
|
81
|
+
# Get transcription
|
|
82
|
+
transcript = query_daemon(audio_path)
|
|
83
|
+
|
|
84
|
+
if transcript:
|
|
85
|
+
# Output transcript to stdout (OpenClaw reads stdout for CLI transcribers)
|
|
86
|
+
print(transcript)
|
|
87
|
+
sys.exit(0)
|
|
88
|
+
else:
|
|
89
|
+
print("Transcription failed", file=sys.stderr)
|
|
90
|
+
sys.exit(1)
|