@streamoji/aitwin 0.6.1 → 0.6.3
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 +22 -4
- package/dist/aitwin.cjs +6 -6
- package/dist/aitwin.js +2635 -2488
- package/dist/index.d.ts +306 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,8 +96,9 @@ Provide **`id`** (cloud twin), **`avatarId`/`faceId`** (R2 custom face), or **`a
|
|
|
96
96
|
| `faceId` | Alias for `avatarId` (same CDN path) |
|
|
97
97
|
| `assets` | `{ twinBase, binBase, encrypted }` — skip getAiTwin (lab / custom CDN) |
|
|
98
98
|
| `authToken` | Bearer for TTS + encrypted assets; omitted → dev `getAuthToken` |
|
|
99
|
-
| `ttsEngineId` | TTS engine
|
|
100
|
-
| `voiceId` |
|
|
99
|
+
| `ttsEngineId` | TTS engine (default Cartesia). Optional if `voiceId` is packed as `engine:voice` |
|
|
100
|
+
| `voiceId` | Voice id, or packed `ttsEngineId:voiceId` (e.g. `visemetts:eve`) |
|
|
101
|
+
| `language` | Default TTS language for `speakText()` and `connect()` (`en`, `es-MX`, `auto`, …) |
|
|
101
102
|
| `speakingRate` | Default `0.85` |
|
|
102
103
|
| `idleHandoffHoldMs` | Milliseconds to hold still sil after speech before resuming the idle video loop (default `200`) |
|
|
103
104
|
| `showErrorOverlay` | Canvas error overlay (default `true`) |
|
|
@@ -147,11 +148,25 @@ After speech ends, the twin returns to a still closed-mouth frame before the idl
|
|
|
147
148
|
|
|
148
149
|
Applies to both `speakText()` and voice `connect()` playback.
|
|
149
150
|
|
|
151
|
+
#### Language
|
|
152
|
+
|
|
153
|
+
`language` is a uniform code for visemetts and Cartesia. Pass it on `<AiTwin>`, `speakText()`, or `connect()`. Per-call options override the prop. Omitted → the API default.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
await twinRef.current?.speakText("Hola, ¿cómo estás?", {
|
|
157
|
+
ttsEngineId: "visemetts",
|
|
158
|
+
voiceId: "eve",
|
|
159
|
+
language: "es-MX",
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`auto` is visemetts-only. Cartesia also accepts extra codes (`nl`, `pl`, `th`, …). See `TTS_LANGUAGE_CATALOG` / `ttsLanguagesForEngine()`.
|
|
164
|
+
|
|
150
165
|
### Ref handle
|
|
151
166
|
|
|
152
167
|
| Method | Description |
|
|
153
168
|
|--------|-------------|
|
|
154
|
-
| `speakText(text, options?)` | SSE TTS + lipsync; optional per-call `
|
|
169
|
+
| `speakText(text, options?)` | SSE TTS + lipsync; optional per-call `ttsEngineId` / `voiceId` / `language` |
|
|
155
170
|
| `connect(options)` | Mic + WebSocket voice session (`/ws/voice`) |
|
|
156
171
|
| `disconnect()` | End voice session |
|
|
157
172
|
| `isConnected()` | Whether voice WebSocket is active |
|
|
@@ -195,6 +210,7 @@ function VoiceDemo() {
|
|
|
195
210
|
authToken: authJwt,
|
|
196
211
|
voiceId: optionalCartesiaUuid,
|
|
197
212
|
speakingRate: 0.85,
|
|
213
|
+
language: "es-MX",
|
|
198
214
|
});
|
|
199
215
|
};
|
|
200
216
|
|
|
@@ -220,7 +236,9 @@ WebSocket URL: `wss://<api-host>/ws/voice?<query>`. The SDK builds it from `conn
|
|
|
220
236
|
|-------------|----------|--------|
|
|
221
237
|
| `authToken` | Yes | Same JWT as SSE `Authorization: Bearer` (`client_…` from `getAuthToken`) |
|
|
222
238
|
| `tenant` | Yes | Always `aiTwin` |
|
|
223
|
-
| `voiceId` | No | Cartesia UUID
|
|
239
|
+
| `voiceId` | No | Cartesia UUID, visemetts name (`eve`), or packed `engine:voice` |
|
|
240
|
+
| `ttsEngineId` | No | `visemetts` or Cartesia id; also parsed from packed `voiceId` |
|
|
241
|
+
| `language` | No | Uniform TTS language (`en`, `es-MX`, `auto`, …) for visemetts and Cartesia |
|
|
224
242
|
| `personaId` | No | getAiTwin `knowledgeContextId` when present |
|
|
225
243
|
| `speaking_rate` | No | `0.5`–`1.5`, default `0.85` |
|
|
226
244
|
| `tts_stream` | No | Default `true` (server TTS + `avatar_audio_chunk`) |
|