dsh-live-voice 0.0.2 → 0.2.0
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/CHANGELOG.md +74 -0
- package/README.md +1 -1
- package/lib/client.js +795 -207
- package/lib/server.js +18 -3
- package/package.json +2 -1
- package/scripts/build.ts +1 -1
- package/src/client/chat.ts +7 -0
- package/src/client/components.ts +453 -190
- package/src/client/index.ts +111 -11
- package/src/client/qwen-settings.ts +1 -1
- package/src/client/styles.ts +11 -7
- package/src/core/coordinator.ts +209 -26
- package/src/core/filters.ts +63 -0
- package/src/core/microphone.ts +7 -1
- package/src/core/ownership.ts +1 -1
- package/src/core/settings.ts +102 -3
- package/src/engines/qwen-http-host.ts +3 -9
- package/src/engines/recognition/browser.ts +23 -0
- package/src/engines/speaking/qwen-http.ts +6 -1
package/lib/server.js
CHANGED
|
@@ -469,18 +469,33 @@ var defaultSettings = Object.freeze({
|
|
|
469
469
|
lang: "pt-BR",
|
|
470
470
|
recognitionLang: "pt-BR",
|
|
471
471
|
voice: "",
|
|
472
|
+
inputDeviceId: "",
|
|
473
|
+
outputDeviceId: "",
|
|
474
|
+
recognitionFilterEnabled: true,
|
|
475
|
+
recognitionMinimumWords: 2,
|
|
476
|
+
voiceCommandsEnabled: true,
|
|
477
|
+
voiceCommandSend: "send, send message",
|
|
478
|
+
voiceCommandQueue: "queue, queue message",
|
|
479
|
+
voiceCommandEnd: "end, end conversation",
|
|
480
|
+
voiceCommandMute: "mute, stop listening",
|
|
481
|
+
voiceCommandResume: "resume, start listening",
|
|
482
|
+
voiceCommandStopSpeaking: "stop talking, stop speaking, shut up",
|
|
483
|
+
voiceCommandClear: "clear all, clear message",
|
|
484
|
+
outputCodeFilterEnabled: true,
|
|
485
|
+
outputCodeMaxLines: 5,
|
|
486
|
+
outputCodeNotice: "Look the code on out conversation",
|
|
472
487
|
rate: 1
|
|
473
488
|
});
|
|
474
489
|
|
|
475
490
|
// src/engines/qwen-http-host.ts
|
|
476
|
-
var LOOPBACK2 = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1", "[::1]"]);
|
|
477
491
|
var clean2 = (value) => String(value ?? "").trim();
|
|
478
492
|
function resolveQwenBaseUrl(value = process.env.DSH_LIVE_VOICE_QWEN_URL || "http://127.0.0.1:8080/") {
|
|
479
493
|
const url = new URL(value);
|
|
480
|
-
if (
|
|
481
|
-
throw new Error("Qwen API URL must
|
|
494
|
+
if (!["http:", "https:"].includes(url.protocol))
|
|
495
|
+
throw new Error("Qwen API URL must use HTTP or HTTPS.");
|
|
482
496
|
url.pathname = url.pathname.replace(/\/*$/, "/");
|
|
483
497
|
url.search = "";
|
|
498
|
+
url.hash = "";
|
|
484
499
|
return url;
|
|
485
500
|
}
|
|
486
501
|
function validateQwenConfig(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-live-voice",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"lib/",
|
|
53
53
|
"cordis.patch.yml",
|
|
54
54
|
"README.md",
|
|
55
|
+
"CHANGELOG.md",
|
|
55
56
|
"PLAN.md",
|
|
56
57
|
"DEVELOPMENT.md",
|
|
57
58
|
"HISTORY.md",
|
package/scripts/build.ts
CHANGED
|
@@ -9,7 +9,7 @@ const client: BuildOptions = {
|
|
|
9
9
|
format: 'cjs',
|
|
10
10
|
platform: 'browser',
|
|
11
11
|
target: ['es2022'],
|
|
12
|
-
external: ['react'],
|
|
12
|
+
external: ['react', 'react-dom'],
|
|
13
13
|
banner: {
|
|
14
14
|
js: 'window.__ModuleLoader__.load({id:"dsh-live-voice",factory:(require)=>{var module={exports:{}};var exports=module.exports;',
|
|
15
15
|
},
|
package/src/client/chat.ts
CHANGED
|
@@ -25,6 +25,13 @@ export function assistantMessages(snapshot) {
|
|
|
25
25
|
})
|
|
26
26
|
.sort((a, b) => a.turn - b.turn || a.step - b.step);
|
|
27
27
|
}
|
|
28
|
+
/** Read one prompt from a pending structured question request. */
|
|
29
|
+
export function pendingQuestionSpeech(interaction, index = 0) {
|
|
30
|
+
if (!interaction || interaction.kind !== 'question' || !Array.isArray(interaction.questions)) return '';
|
|
31
|
+
const question = interaction.questions[index]?.question;
|
|
32
|
+
return typeof question === 'string' ? question.trim() : '';
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
export function latestUserSequence(snapshot) {
|
|
29
36
|
return Math.max(
|
|
30
37
|
-1,
|