@goodandready/dsh-voice 0.8.7 → 0.8.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/lib/client.js +10 -14
- package/lib/index.js +20 -3
- package/package.json +2 -1
package/lib/client.js
CHANGED
|
@@ -1303,6 +1303,14 @@ window.__ModuleLoader__.load({
|
|
|
1303
1303
|
return () => { alive = false; off() }
|
|
1304
1304
|
}, [])
|
|
1305
1305
|
|
|
1306
|
+
const [devices, setDevices] = React.useState([])
|
|
1307
|
+
React.useEffect(() => {
|
|
1308
|
+
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return
|
|
1309
|
+
navigator.mediaDevices.enumerateDevices()
|
|
1310
|
+
.then((list) => setDevices(list.filter((d) => d.kind === 'audioinput')))
|
|
1311
|
+
.catch(() => {})
|
|
1312
|
+
}, [])
|
|
1313
|
+
|
|
1306
1314
|
// Снимок приходит со статусом, и он важнее самого значения.
|
|
1307
1315
|
// loading — ответа хоста ещё нет;
|
|
1308
1316
|
// unavailable — хост ответил, но наш namespace ему пока неизвестен:
|
|
@@ -1442,26 +1450,14 @@ window.__ModuleLoader__.load({
|
|
|
1442
1450
|
t('hotkeyHint1')
|
|
1443
1451
|
+ t('hotkeyHint2')))
|
|
1444
1452
|
|
|
1445
|
-
const micField = () => {
|
|
1446
|
-
const devices = React.useState([])[0]
|
|
1447
|
-
const setDevices = React.useState([])[1]
|
|
1448
|
-
React.useEffect(() => {
|
|
1449
|
-
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return
|
|
1450
|
-
navigator.mediaDevices.enumerateDevices()
|
|
1451
|
-
.then((list) => setDevices(list.filter((d) => d.kind === 'audioinput')))
|
|
1452
|
-
.catch(() => {})
|
|
1453
|
-
}, [])
|
|
1454
|
-
return React.createElement('label', { className: 'dvs-field' }, t('mic'),
|
|
1453
|
+
const micField = () => React.createElement('label', { className: 'dvs-field' }, t('mic'),
|
|
1455
1454
|
React.createElement('select', {
|
|
1456
1455
|
value: String((snap && snap.micDeviceId) || ''), disabled: !writable,
|
|
1457
1456
|
onChange: (e) => setTop('micDeviceId', e.target.value),
|
|
1458
1457
|
},
|
|
1459
1458
|
React.createElement('option', { value: '' }, t('micDefault')),
|
|
1460
1459
|
devices.map((d) => React.createElement('option', { key: d.deviceId, value: d.deviceId },
|
|
1461
|
-
d.label || d.deviceId.slice(0, 12))))
|
|
1462
|
-
)
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1460
|
+
d.label || d.deviceId.slice(0, 12)))))
|
|
1465
1461
|
const langField = (mode) => React.createElement('label', { className: 'dvs-field' }, t('language'),
|
|
1466
1462
|
React.createElement('select', {
|
|
1467
1463
|
value: modeVal(mode, 'language', 'ru'), disabled: !writable,
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { runChain } from './chain.js'
|
|
|
21
21
|
import { makeProviders, PROVIDER_KEYS, PRESET_KEYS, KNOWN_KEYS, DEFAULT_MODELS, CUSTOM_TEMPLATES } from './providers.js'
|
|
22
22
|
import { toWav16k } from './wav.js'
|
|
23
23
|
import { normalizePhrase } from './normalize.js'
|
|
24
|
+
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
|
24
25
|
|
|
25
26
|
function isAutoLang(lang) {
|
|
26
27
|
return !lang || lang === 'auto' || String(lang).includes(',')
|
|
@@ -134,6 +135,10 @@ export const Config = z.object({
|
|
|
134
135
|
.description('Offline polish: model id on polishBaseUrl.'),
|
|
135
136
|
polishKeyEnv: z.string().default('')
|
|
136
137
|
.description('Offline polish: credential name for the api key. Empty means no Authorization header.'),
|
|
138
|
+
polishProvider: z.string().default('')
|
|
139
|
+
.description('Harness polish: provider id. Empty uses the agent default model selection.'),
|
|
140
|
+
polishModelId: z.string().default('')
|
|
141
|
+
.description('Harness polish: model id. Empty uses the agent default model selection.'),
|
|
137
142
|
})
|
|
138
143
|
|
|
139
144
|
const MIME_BY_EXT = {
|
|
@@ -281,12 +286,24 @@ export function apply(ctx, baseConfig) {
|
|
|
281
286
|
&& data.choices[0].message.content
|
|
282
287
|
return (pick && String(pick).trim()) || text
|
|
283
288
|
}
|
|
284
|
-
// Штатная модель
|
|
289
|
+
// Штатная модель харнесса (DSH 0.1.2-alpha.1 API).
|
|
285
290
|
const llm = ctx.llm
|
|
286
291
|
if (!llm || typeof llm.stream !== 'function') return text
|
|
292
|
+
// provider/model обязательны в GenerateOptions; берём дефолт из
|
|
293
|
+
// agentDefaultModel, если не заданы явно.
|
|
294
|
+
const sel = (ctx.get && ctx.get('agentDefaultModel') && ctx.get('agentDefaultModel').currentSelection)
|
|
295
|
+
? ctx.get('agentDefaultModel').currentSelection()
|
|
296
|
+
: null
|
|
297
|
+
const provider = cfg.polishProvider || (sel && sel.provider) || ''
|
|
298
|
+
const model = cfg.polishModelId || (sel && sel.model) || ''
|
|
299
|
+
if (!provider || !model) return text
|
|
287
300
|
let acc = ''
|
|
288
|
-
for await (const chunk of llm.stream({
|
|
289
|
-
|
|
301
|
+
for await (const chunk of llm.stream({
|
|
302
|
+
provider, model,
|
|
303
|
+
messages: [createUserMessage({ content: [{ type: 'text', text: ask }], source: { kind: 'user' } })],
|
|
304
|
+
signal,
|
|
305
|
+
})) {
|
|
306
|
+
if (chunk && chunk.type === 'text-delta' && typeof chunk.text === 'string') acc += chunk.text
|
|
290
307
|
}
|
|
291
308
|
const clean = acc.trim()
|
|
292
309
|
return clean || text
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-voice",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
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",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
|
|
59
59
|
"@deepseek-ai/dsh-credentials": "^0.1.0-rc.6",
|
|
60
60
|
"@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
|
|
61
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
|
|
61
62
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
62
63
|
}
|
|
63
64
|
}
|