@goodandready/dsh-voice 0.8.8 → 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/index.js +20 -3
- package/package.json +2 -1
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
|
}
|