@npcify/react 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 CHANGED
@@ -69,7 +69,9 @@ export default function App() {
69
69
 
70
70
  - `options`: `baseUrl`, `characterId`, `apiKey`, `serverRendering`, and optional
71
71
  `assetProfile` (`original` or `web-optimized-v1`) and `inputModes` (`'options'`,
72
- `'text'`, `'voice'`). See Export → Web SDK for the character's configuration.
72
+ `'text'`, `'voice'`; `'voice'` needs the character's voice input, which the
73
+ owner turns on in the STT tab). See Export → Web SDK for the character's
74
+ configuration.
73
75
  These are JavaScript props, never HTML attributes.
74
76
  - Voice input: call `bindPushToTalk({ element })` on the ready SDK to talk while
75
77
  the player holds a button or Space; the release sends the speech. See the
package/examples/App.jsx CHANGED
@@ -27,16 +27,20 @@ export default function App() {
27
27
  const handleReady = (client) => {
28
28
  npcify.current = client
29
29
  client.onOptionsReady(({ options }) => setReplies(options))
30
- // Hold the button, or Space, to talk. The release sends the speech.
31
- setVoice(client.inputModes.includes('voice'))
30
+ // Hold the button, or Space, to talk. The release sends the speech. Voice
31
+ // needs the character's voice input (its owner turns it on in the STT tab).
32
+ const hasVoice = client.inputModes.includes('voice')
33
+ setVoice(hasVoice)
32
34
  client.onListeningState(setListening)
33
35
  client.onTranscript(({ text }) => setStatus(text))
34
- unbindTalk.current = client.bindPushToTalk({
35
- element: talk.current,
36
- enabled: () => replyCount.current > 0,
37
- onResult: ({ sent }) => { if (sent) setReplies([]) },
38
- onError: reportError,
39
- })
36
+ if (hasVoice) {
37
+ unbindTalk.current = client.bindPushToTalk({
38
+ element: talk.current,
39
+ enabled: () => replyCount.current > 0,
40
+ onResult: ({ sent }) => { if (sent) setReplies([]) },
41
+ onError: reportError,
42
+ })
43
+ }
40
44
  setReady(true)
41
45
  }
42
46
  const start = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npcify/react",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "React 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.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^18.3.0 || ^19.0.0"