@space3-npm/cybersoul-client 1.4.18 → 1.4.19
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/client.js +8 -2
- package/dist/types.d.ts +11 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -774,6 +774,12 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
774
774
|
parsedIntent.textResponse.trim().length > 0
|
|
775
775
|
? parsedIntent.textResponse
|
|
776
776
|
: params.userMessage;
|
|
777
|
+
// Pre-compute the voice-dispatch decision so we can tell
|
|
778
|
+
// `onTextReady` consumers up front whether a voice bubble is on
|
|
779
|
+
// the way. Mirrors the `shouldGenerateVoice` gate used below
|
|
780
|
+
// when scheduling the TTS task — keep the two in sync.
|
|
781
|
+
const willGenerateVoice = types.includes(InteractRequestType.VOICE) &&
|
|
782
|
+
(!isAuto || !!parsedIntent.voiceArgs);
|
|
777
783
|
// Fire text ready callback if provided
|
|
778
784
|
if (params.onTextReady && (resolvedTextResponse || parsedIntent.actionText)) {
|
|
779
785
|
params.onTextReady(resolvedTextResponse, parsedIntent.actionText, {
|
|
@@ -782,6 +788,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
782
788
|
isEndTurn: parsedIntent.isEndTurn,
|
|
783
789
|
triggerEvent: parsedIntent.triggerEvent,
|
|
784
790
|
likePreviousPicture: parsedIntent.likePreviousPicture,
|
|
791
|
+
willGenerateVoice,
|
|
785
792
|
});
|
|
786
793
|
}
|
|
787
794
|
// 5. Build Final Media Calls parallel
|
|
@@ -868,8 +875,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
868
875
|
captureMediaError("image", e);
|
|
869
876
|
}));
|
|
870
877
|
}
|
|
871
|
-
const shouldGenerateVoice =
|
|
872
|
-
(!isAuto || !!parsedIntent.voiceArgs);
|
|
878
|
+
const shouldGenerateVoice = willGenerateVoice;
|
|
873
879
|
if (shouldGenerateVoice) {
|
|
874
880
|
const normalizedVoiceArgs = parsedIntent.voiceArgs && typeof parsedIntent.voiceArgs === "object"
|
|
875
881
|
? parsedIntent.voiceArgs
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,17 @@ export interface InteractMetadata {
|
|
|
40
40
|
isEndTurn?: boolean;
|
|
41
41
|
triggerEvent?: DispatcherIntent["triggerEvent"];
|
|
42
42
|
likePreviousPicture?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True when the client has already decided to dispatch a voice
|
|
45
|
+
* generation task for this turn (i.e. `onMediaReady({modality:"voice"})`
|
|
46
|
+
* will fire later, barring TTS failure). UIs that render an early
|
|
47
|
+
* text bubble from `onTextReady` should suppress it when this is set —
|
|
48
|
+
* the text content is going to be replaced by the voice bubble anyway,
|
|
49
|
+
* so showing both (with a brief text-then-voice flicker, and a text
|
|
50
|
+
* push notification that gets superseded by a voice bubble) is
|
|
51
|
+
* confusing to the end user.
|
|
52
|
+
*/
|
|
53
|
+
willGenerateVoice?: boolean;
|
|
43
54
|
}
|
|
44
55
|
/**
|
|
45
56
|
* Server-authoritative snapshot returned by PATCH /characters/dynamic-context
|