@goodandready/dsh-voice 0.9.37 → 0.9.38
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/lib/client.js +1753 -1625
- package/lib/host-routes.js +4 -0
- package/lib/normalize.js +7 -0
- package/lib/stats.js +2 -0
- package/lib/transcribe-core.js +2 -1
- package/package.json +1 -1
package/lib/host-routes.js
CHANGED
|
@@ -334,6 +334,8 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
334
334
|
polishMs: polishTookMs,
|
|
335
335
|
vadMs: Number(payload.vadMs) || 0,
|
|
336
336
|
wordCount: text ? text.split(/\s+/).filter(Boolean).length : 0,
|
|
337
|
+
clipping: Boolean(payload.clipping),
|
|
338
|
+
lowVolume: Boolean(payload.lowVolume),
|
|
337
339
|
})
|
|
338
340
|
}
|
|
339
341
|
writeJson(res, 200, { ok: true, text, rawText, subMode, action, provider: out.provider, tookMs: out.tookMs, polishTookMs, totalTookMs })
|
|
@@ -349,6 +351,8 @@ export function registerHostRoutes(ctx, deps) {
|
|
|
349
351
|
totalTookMs: Date.now() - reqStart,
|
|
350
352
|
vadMs: Number(payload.vadMs) || 0,
|
|
351
353
|
error: String(e && e.message || e),
|
|
354
|
+
clipping: Boolean(payload.clipping),
|
|
355
|
+
lowVolume: Boolean(payload.lowVolume),
|
|
352
356
|
})
|
|
353
357
|
}
|
|
354
358
|
writeJson(res, 502, { ok: false, error: { code: 'chain', message: String(e && e.message || e) } })
|
package/lib/normalize.js
CHANGED
|
@@ -149,6 +149,9 @@ export function extractVoiceActions(text) {
|
|
|
149
149
|
if (/^(новая строка|с новой строки|new line|newline|换行|新行)$/i.test(lower)) {
|
|
150
150
|
return { text: '', action: 'newline' }
|
|
151
151
|
}
|
|
152
|
+
if (/^(отмени последнее|сотри последнее|удали последнее|откати последнее|undo|undo last|undo chunk|撤销|撤销上一句)$/i.test(lower)) {
|
|
153
|
+
return { text: '', action: 'undo_chunk' }
|
|
154
|
+
}
|
|
152
155
|
|
|
153
156
|
const trailingSend = /[\s,]+(отправь|отправить|send|send it|发送|发出)[.!?…]*$/i
|
|
154
157
|
if (trailingSend.test(raw)) {
|
|
@@ -162,6 +165,10 @@ export function extractVoiceActions(text) {
|
|
|
162
165
|
if (trailingNewline.test(raw)) {
|
|
163
166
|
return { text: raw.replace(trailingNewline, '').trim() + '\n', action: 'newline' }
|
|
164
167
|
}
|
|
168
|
+
const trailingUndo = /[\s,]+(отмени последнее|сотри последнее|удали последнее|откати последнее|undo last|undo chunk|撤销上一句)[.!?…]*$/i
|
|
169
|
+
if (trailingUndo.test(raw)) {
|
|
170
|
+
return { text: raw.replace(trailingUndo, '').trim(), action: 'undo_chunk' }
|
|
171
|
+
}
|
|
165
172
|
|
|
166
173
|
return { text: raw, action: null }
|
|
167
174
|
}
|
package/lib/stats.js
CHANGED
|
@@ -30,6 +30,8 @@ export function createStatsTracker() {
|
|
|
30
30
|
})) : [],
|
|
31
31
|
error: entry.error ? String(entry.error).slice(0, 200) : undefined,
|
|
32
32
|
wordCount: typeof entry.wordCount === 'number' ? entry.wordCount : undefined,
|
|
33
|
+
clipping: entry.clipping !== undefined ? !!entry.clipping : undefined,
|
|
34
|
+
lowVolume: entry.lowVolume !== undefined ? !!entry.lowVolume : undefined,
|
|
33
35
|
})
|
|
34
36
|
if (diagnostics.length > MAX_DIAGNOSTICS) {
|
|
35
37
|
diagnostics.shift()
|
package/lib/transcribe-core.js
CHANGED
|
@@ -35,11 +35,12 @@ const SESSION_COMMANDS = [
|
|
|
35
35
|
{ re: /^(отмени|отмена|cancel|отменить|取消|算了)\s*[.!?]*$/i, cmd: 'cancel' },
|
|
36
36
|
{ re: /^(стоп|stop|хватит|停止|暂停)\s*[.!?]*$/i, cmd: 'stop' },
|
|
37
37
|
{ re: /^(продолжи|continue|продолжай|继续)\s*[.!?]*$/i, cmd: 'continue' },
|
|
38
|
+
{ re: /^(отмени последнее|сотри последнее|удали последнее|откати последнее|undo|undo last|undo chunk|撤销|撤销上一句)\s*[.!?]*$/i, cmd: 'undo_chunk' },
|
|
38
39
|
]
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* @param {string} text
|
|
42
|
-
* @returns {'send'|'cancel'|'stop'|'continue'|null}
|
|
43
|
+
* @returns {'send'|'cancel'|'stop'|'continue'|'undo_chunk'|null}
|
|
43
44
|
*/
|
|
44
45
|
export function sessionCommand(text) {
|
|
45
46
|
const t = String(text || '').trim().toLowerCase()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-voice",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.38",
|
|
4
4
|
"description": "Voice input for DeepSeek Harness: dictation chunked by pauses and voice messages, each with its own provider fallback chain (Deepgram, Groq, HuggingFace, local whisper.cpp, plus any OpenAI-compatible API of your own).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|