@npcify/web 0.3.0 → 0.4.1
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 +25 -10
- package/dist/index.d.ts +194 -5
- package/dist/index.js +825 -168
- package/examples/main.js +15 -12
- package/package.json +1 -1
package/examples/main.js
CHANGED
|
@@ -35,19 +35,22 @@ character.onOptionsReady(({ options }) => {
|
|
|
35
35
|
}
|
|
36
36
|
talk.disabled = false
|
|
37
37
|
})
|
|
38
|
-
// Hold the button, or Space, to talk. The release sends the speech.
|
|
38
|
+
// Hold the button, or Space, to talk. The release sends the speech. Voice
|
|
39
|
+
// needs the character's voice input (its owner turns it on in the STT tab).
|
|
39
40
|
talk.hidden = !character.inputModes.includes('voice')
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
if (!talk.hidden) {
|
|
42
|
+
character.bindPushToTalk({
|
|
43
|
+
element: talk,
|
|
44
|
+
enabled: () => !talk.disabled,
|
|
45
|
+
onResult: ({ sent }) => {
|
|
46
|
+
if (sent) {
|
|
47
|
+
replies.replaceChildren()
|
|
48
|
+
talk.disabled = true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
onError: report,
|
|
52
|
+
})
|
|
53
|
+
}
|
|
51
54
|
character.onListeningState((state) => {
|
|
52
55
|
talk.textContent =
|
|
53
56
|
{ listening: 'Listening…', recognizing: 'Recognizing…' }[state] ?? 'Hold to talk'
|