@npcify/vue 0.3.0 → 0.4.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/README.md CHANGED
@@ -65,7 +65,9 @@ const reply = async (label) => {
65
65
 
66
66
  - `options`: `baseUrl`, `characterId`, `apiKey`, `serverRendering`, and optional
67
67
  `assetProfile` (`original` or `web-optimized-v1`) and `inputModes` (`'options'`,
68
- `'text'`, `'voice'`). See Export → Web SDK for the character's configuration.
68
+ `'text'`, `'voice'`; `'voice'` needs the character's voice input, which the
69
+ owner turns on in the STT tab). See Export → Web SDK for the character's
70
+ configuration.
69
71
  These are JavaScript props, never HTML attributes.
70
72
  - Voice input: call `bindPushToTalk({ element })` on the ready SDK to talk while
71
73
  the player holds a button or Space; the release sends the speech. See the
package/examples/App.vue CHANGED
@@ -35,16 +35,19 @@ const reportError = (error) => { status.value = error.message }
35
35
  const handleReady = (client) => {
36
36
  npcify.value = client
37
37
  client.onOptionsReady(({ options }) => { replies.value = options })
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
  voice.value = client.inputModes.includes('voice')
40
41
  client.onListeningState((state) => { listening.value = state })
41
42
  client.onTranscript(({ text }) => { status.value = text })
42
- unbindTalk = client.bindPushToTalk({
43
- element: talk.value,
44
- enabled: () => replies.value.length > 0,
45
- onResult: ({ sent }) => { if (sent) replies.value = [] },
46
- onError: reportError,
47
- })
43
+ if (voice.value) {
44
+ unbindTalk = client.bindPushToTalk({
45
+ element: talk.value,
46
+ enabled: () => replies.value.length > 0,
47
+ onResult: ({ sent }) => { if (sent) replies.value = [] },
48
+ onError: reportError,
49
+ })
50
+ }
48
51
  }
49
52
  const start = async () => {
50
53
  started.value = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npcify/vue",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Vue components for Npcify characters and conversations",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -23,7 +23,7 @@
23
23
  "registry": "https://registry.npmjs.org/"
24
24
  },
25
25
  "dependencies": {
26
- "@npcify/web": "^0.3.0"
26
+ "@npcify/web": "^0.4.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^3.5.0"