@streamoji/aitwin 0.6.7 → 0.6.8
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/dist/aitwin.cjs +6 -6
- package/dist/aitwin.js +2206 -2106
- package/dist/index.d.ts +36 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export declare type AiTwinCaptionsOptions = {
|
|
|
17
17
|
|
|
18
18
|
export declare type AiTwinHandle = {
|
|
19
19
|
speakText: (text: string, options?: AvatarTtsSpeakOptions) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Generate an LLM reply and speak it in one `/avatar_ttsWithPoses` request
|
|
22
|
+
* (`generateReply: true`). Prefer this over `/avatarReply` + `speakText`.
|
|
23
|
+
*/
|
|
24
|
+
speakWithReply: (message: string, options?: SpeakWithReplyOptions) => Promise<SpeakWithReplyResult>;
|
|
20
25
|
stop: () => void;
|
|
21
26
|
setTtsEngineId: (engineId: TtsEngineId) => void;
|
|
22
27
|
renderViseme: (toViseme: string, options?: AiTwinRenderVisemeOptions) => Promise<void>;
|
|
@@ -49,11 +54,11 @@ export declare type AiTwinHandle = {
|
|
|
49
54
|
/** Mute/unmute bot audio output (TTS + voice). */
|
|
50
55
|
setMuted: (muted: boolean) => void;
|
|
51
56
|
isMuted: () => boolean;
|
|
52
|
-
/** Brain id from getAiTwin (for
|
|
57
|
+
/** Brain id from getAiTwin (for speakWithReply and /ws/voice). */
|
|
53
58
|
getBrainId: () => string | null;
|
|
54
59
|
/** @deprecated Use `getBrainId`. */
|
|
55
60
|
getPersonaId: () => string | null;
|
|
56
|
-
/** Client SSE brain URL from getAiTwin (for /ws/voice). */
|
|
61
|
+
/** Client SSE brain URL from getAiTwin (for speakWithReply / /ws/voice). */
|
|
57
62
|
getBrainUrl: () => string | null;
|
|
58
63
|
};
|
|
59
64
|
|
|
@@ -186,6 +191,7 @@ export declare const AiTwinWidget: ForwardRefExoticComponent<AiTwinWidgetProps &
|
|
|
186
191
|
/** Imperative API shared by React ref and HTML widget handle. */
|
|
187
192
|
export declare type AiTwinWidgetHandle = {
|
|
188
193
|
speakText: (text: string, options?: AvatarTtsSpeakOptions) => Promise<void>;
|
|
194
|
+
speakWithReply: (message: string, options?: SpeakWithReplyOptions) => Promise<SpeakWithReplyResult>;
|
|
189
195
|
connect: (options?: VoiceConnectOptions) => Promise<void>;
|
|
190
196
|
disconnect: () => Promise<void>;
|
|
191
197
|
stop: () => void;
|
|
@@ -236,14 +242,14 @@ export declare type AiTwinWidgetProps = {
|
|
|
236
242
|
*/
|
|
237
243
|
float?: boolean;
|
|
238
244
|
/**
|
|
239
|
-
* Brain id for
|
|
245
|
+
* Brain id for `speakWithReply` (Text mode) and `/ws/voice`.
|
|
240
246
|
* When omitted, uses getAiTwin `brainId` if available.
|
|
241
247
|
*/
|
|
242
248
|
brainId?: string;
|
|
243
249
|
/** @deprecated Use `brainId`. */
|
|
244
250
|
personaId?: string;
|
|
245
251
|
/**
|
|
246
|
-
* Client SSE brain URL for `/ws/voice`.
|
|
252
|
+
* Client SSE brain URL for `speakWithReply` / `/ws/voice`.
|
|
247
253
|
* When omitted, uses getAiTwin `brainUrl` if available.
|
|
248
254
|
*/
|
|
249
255
|
brainUrl?: string;
|
|
@@ -274,6 +280,11 @@ export declare type AvatarTtsLipsyncController = {
|
|
|
274
280
|
setTtsEngineId: (engineId: TtsEngineId) => void;
|
|
275
281
|
getTtsEngineId: () => TtsEngineId;
|
|
276
282
|
speak: (userQuery: string, options?: AvatarTtsSpeakOptions) => Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* LLM reply + TTS in one `/avatar_ttsWithPoses` request (`generateReply: true`).
|
|
285
|
+
* Avoids a separate `/avatarReply` round-trip.
|
|
286
|
+
*/
|
|
287
|
+
speakWithReply: (message: string, options?: SpeakWithReplyOptions) => Promise<SpeakWithReplyResult>;
|
|
277
288
|
stop: () => void;
|
|
278
289
|
getVisemeQueue: () => VisemeQueueItem[];
|
|
279
290
|
getWordQueue: () => WordQueueItem[];
|
|
@@ -574,6 +585,27 @@ export declare const SPEAKING_RATE_MAX = 1.5;
|
|
|
574
585
|
|
|
575
586
|
export declare const SPEAKING_RATE_MIN = 0.5;
|
|
576
587
|
|
|
588
|
+
export declare type SpeakWithReplyMessage = {
|
|
589
|
+
role: "user" | "assistant";
|
|
590
|
+
content: string;
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
/** Options for `/avatar_ttsWithPoses` with `generateReply: true`. */
|
|
594
|
+
export declare type SpeakWithReplyOptions = AvatarTtsSpeakOptions & {
|
|
595
|
+
brainId?: string;
|
|
596
|
+
brainUrl?: string;
|
|
597
|
+
history?: SpeakWithReplyMessage[];
|
|
598
|
+
/** Called as soon as spokenText arrives on the SSE stream. */
|
|
599
|
+
onSpokenText?: (spokenText: string) => void;
|
|
600
|
+
/** Called as soon as displayText arrives on the SSE stream. */
|
|
601
|
+
onDisplayText?: (displayText: string) => void;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
export declare type SpeakWithReplyResult = {
|
|
605
|
+
displayText: string;
|
|
606
|
+
spokenText: string;
|
|
607
|
+
};
|
|
608
|
+
|
|
577
609
|
/** Merge explicit `ttsEngineId` with a possibly packed `voiceId`. Packed engine wins only if engine is omitted. */
|
|
578
610
|
export declare function splitVoiceIdSpec(ttsEngineId?: TtsEngineId, voiceId?: string): {
|
|
579
611
|
ttsEngineId?: TtsEngineId;
|