@drakulavich/kesha-voice-kit 1.0.8 → 1.0.10
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/README.md +19 -17
- package/package.json +1 -1
- package/src/cli.ts +26 -2
package/README.md
CHANGED
|
@@ -37,34 +37,36 @@ bun add -g @drakulavich/kesha-voice-kit
|
|
|
37
37
|
kesha install
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
**Then
|
|
40
|
+
**Then configure OpenClaw to use Kesha for audio transcription:**
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
43
|
openclaw plugins install @drakulavich/kesha-voice-kit
|
|
44
|
+
openclaw config set tools.media.audio.models \
|
|
45
|
+
'[{"type":"cli","command":"kesha","args":["--format","transcript","{{MediaPath}}"],"timeoutSeconds":15}]'
|
|
46
|
+
openclaw config set tools.media.audio.enabled true
|
|
47
|
+
openclaw gateway restart
|
|
44
48
|
```
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
Your agent receives a voice message in Telegram/WhatsApp/Slack, Kesha transcribes it locally, and the agent sees enriched context:
|
|
47
51
|
|
|
48
|
-
Manage the plugin afterwards with `openclaw plugins list`, `openclaw plugins disable kesha-voice-kit`, or `openclaw plugins uninstall kesha-voice-kit`.
|
|
49
|
-
|
|
50
|
-
Your agent receives a voice message in Telegram/WhatsApp/Slack, Kesha transcribes it locally, and the transcript flows back into the agent loop:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"text": "Привет, как дела?",
|
|
55
|
-
"model": "parakeet-tdt-0.6b-v3"
|
|
56
|
-
}
|
|
57
52
|
```
|
|
53
|
+
Привет, как дела?
|
|
54
|
+
[lang: ru, confidence: 1.00]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Manage the plugin with `openclaw plugins list`, `openclaw plugins disable kesha-voice-kit`, or `openclaw plugins uninstall kesha-voice-kit`.
|
|
58
58
|
|
|
59
59
|
## CLI Tools
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
|
-
kesha install
|
|
63
|
-
kesha audio.ogg
|
|
64
|
-
kesha --
|
|
65
|
-
kesha --
|
|
66
|
-
kesha --
|
|
67
|
-
kesha
|
|
62
|
+
kesha install # download engine and models
|
|
63
|
+
kesha audio.ogg # transcribe (plain text)
|
|
64
|
+
kesha --format transcript audio.ogg # text + language/confidence
|
|
65
|
+
kesha --format json audio.ogg # full JSON with lang fields
|
|
66
|
+
kesha --json audio.ogg # alias for --format json
|
|
67
|
+
kesha --verbose audio.ogg # show language detection details
|
|
68
|
+
kesha --lang en audio.ogg # warn if detected language differs
|
|
69
|
+
kesha status # show installed backend info
|
|
68
70
|
```
|
|
69
71
|
|
|
70
72
|
Stdout: transcript. Stderr: errors. Pipe-friendly.
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -30,6 +30,7 @@ interface MainCommandArgs {
|
|
|
30
30
|
_: string[];
|
|
31
31
|
json: boolean;
|
|
32
32
|
verbose: boolean;
|
|
33
|
+
format?: string;
|
|
33
34
|
lang?: string;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -113,6 +114,10 @@ export const mainCommand = defineCommand({
|
|
|
113
114
|
description: "Show language detection details",
|
|
114
115
|
default: false,
|
|
115
116
|
},
|
|
117
|
+
format: {
|
|
118
|
+
type: "string",
|
|
119
|
+
description: "Output format: transcript (enriched text with lang/confidence)",
|
|
120
|
+
},
|
|
116
121
|
lang: {
|
|
117
122
|
type: "string",
|
|
118
123
|
description: "Expected language code (ISO 639-1), warn if mismatch",
|
|
@@ -129,7 +134,7 @@ export const mainCommand = defineCommand({
|
|
|
129
134
|
let hasError = false;
|
|
130
135
|
const results: TranscribeResult[] = [];
|
|
131
136
|
|
|
132
|
-
const wantsLangId = !!(args.lang || args.verbose || args.json);
|
|
137
|
+
const wantsLangId = !!(args.lang || args.verbose || args.json || args.format === "transcript" || args.format === "json");
|
|
133
138
|
|
|
134
139
|
for (const file of files) {
|
|
135
140
|
try {
|
|
@@ -178,8 +183,10 @@ export const mainCommand = defineCommand({
|
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
|
|
181
|
-
if (args.json) {
|
|
186
|
+
if (args.json || args.format === "json") {
|
|
182
187
|
process.stdout.write(formatJsonOutput(results));
|
|
188
|
+
} else if (args.format === "transcript") {
|
|
189
|
+
process.stdout.write(formatTranscriptOutput(results));
|
|
183
190
|
} else if (args.verbose) {
|
|
184
191
|
process.stdout.write(formatVerboseOutput(results));
|
|
185
192
|
} else {
|
|
@@ -258,6 +265,23 @@ export function formatVerboseOutput(results: TranscribeResult[]): string {
|
|
|
258
265
|
.join("\n") + "\n";
|
|
259
266
|
}
|
|
260
267
|
|
|
268
|
+
export function formatTranscriptOutput(results: TranscribeResult[]): string {
|
|
269
|
+
return results
|
|
270
|
+
.map((r, i) => {
|
|
271
|
+
const lines: string[] = [];
|
|
272
|
+
if (results.length > 1) {
|
|
273
|
+
if (i > 0) lines.push("");
|
|
274
|
+
lines.push(`=== ${r.file} ===`);
|
|
275
|
+
}
|
|
276
|
+
lines.push(r.text);
|
|
277
|
+
const lang = r.textLanguage?.code || r.audioLanguage?.code || r.lang;
|
|
278
|
+
const confidence = r.textLanguage?.confidence ?? r.audioLanguage?.confidence;
|
|
279
|
+
if (lang) lines.push(`[lang: ${lang}${confidence != null ? `, confidence: ${confidence.toFixed(2)}` : ""}]`);
|
|
280
|
+
return lines.join("\n");
|
|
281
|
+
})
|
|
282
|
+
.join("\n") + "\n";
|
|
283
|
+
}
|
|
284
|
+
|
|
261
285
|
export function formatJsonOutput(results: TranscribeResult[]): string {
|
|
262
286
|
return JSON.stringify(results, null, 2) + "\n";
|
|
263
287
|
}
|