@convai/web-sdk 0.1.1-beta.4 → 0.2.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 +735 -189
- package/dist/core/AudioManager.d.ts +8 -0
- package/dist/core/AudioManager.d.ts.map +1 -1
- package/dist/core/AudioManager.js +45 -5
- package/dist/core/AudioManager.js.map +1 -1
- package/dist/core/ConvaiClient.d.ts +22 -9
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +92 -41
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +27 -24
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/ScreenShareManager.d.ts.map +1 -1
- package/dist/core/ScreenShareManager.js +4 -0
- package/dist/core/ScreenShareManager.js.map +1 -1
- package/dist/core/VideoManager.d.ts.map +1 -1
- package/dist/core/VideoManager.js +2 -0
- package/dist/core/VideoManager.js.map +1 -1
- package/dist/core/types.d.ts +13 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.d.ts +3 -0
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.js +25 -22
- package/dist/react/components/ConvaiWidget.js.map +1 -1
- package/dist/react/components/index.d.ts +0 -1
- package/dist/react/components/index.d.ts.map +1 -1
- package/dist/react/components/index.js +0 -2
- package/dist/react/components/index.js.map +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts +3 -0
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +46 -9
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/types/index.d.ts +1 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/vanilla/AudioRenderer.d.ts +45 -0
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -0
- package/dist/vanilla/AudioRenderer.js +126 -0
- package/dist/vanilla/AudioRenderer.js.map +1 -0
- package/dist/vanilla/ConvaiWidget.d.ts +39 -0
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -0
- package/dist/vanilla/ConvaiWidget.js +1835 -0
- package/dist/vanilla/ConvaiWidget.js.map +1 -0
- package/dist/vanilla/icons.d.ts +34 -0
- package/dist/vanilla/icons.d.ts.map +1 -0
- package/dist/vanilla/icons.js +215 -0
- package/dist/vanilla/icons.js.map +1 -0
- package/dist/vanilla/index.d.ts +35 -0
- package/dist/vanilla/index.d.ts.map +1 -0
- package/dist/vanilla/index.js +37 -0
- package/dist/vanilla/index.js.map +1 -0
- package/dist/{components/rtc-widget/styles/theme.d.ts → vanilla/styles.d.ts} +14 -50
- package/dist/vanilla/styles.d.ts.map +1 -0
- package/dist/vanilla/styles.js +287 -0
- package/dist/vanilla/styles.js.map +1 -0
- package/dist/vanilla/types.d.ts +38 -0
- package/dist/vanilla/types.d.ts.map +1 -0
- package/dist/vanilla/types.js +2 -0
- package/dist/vanilla/types.js.map +1 -0
- package/package.json +12 -5
- package/dist/components/ConvaiWidget.d.ts +0 -59
- package/dist/components/ConvaiWidget.d.ts.map +0 -1
- package/dist/components/ConvaiWidget.js +0 -421
- package/dist/components/ConvaiWidget.js.map +0 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -5
- package/dist/components/index.js.map +0 -1
- package/dist/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -10
- package/dist/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/AudioSettingsPanel.js +0 -316
- package/dist/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
- package/dist/components/rtc-widget/components/ConviMessage.d.ts +0 -10
- package/dist/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/ConviMessage.js +0 -14
- package/dist/components/rtc-widget/components/ConviMessage.js.map +0 -1
- package/dist/components/rtc-widget/components/FloatingVideo.d.ts +0 -9
- package/dist/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/FloatingVideo.js +0 -122
- package/dist/components/rtc-widget/components/FloatingVideo.js.map +0 -1
- package/dist/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -7
- package/dist/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/MarkdownRenderer.js +0 -68
- package/dist/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
- package/dist/components/rtc-widget/components/MessageBubble.d.ts +0 -10
- package/dist/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/MessageBubble.js +0 -23
- package/dist/components/rtc-widget/components/MessageBubble.js.map +0 -1
- package/dist/components/rtc-widget/components/MessageList.d.ts +0 -11
- package/dist/components/rtc-widget/components/MessageList.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/MessageList.js +0 -89
- package/dist/components/rtc-widget/components/MessageList.js.map +0 -1
- package/dist/components/rtc-widget/components/UserMessage.d.ts +0 -9
- package/dist/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/UserMessage.js +0 -15
- package/dist/components/rtc-widget/components/UserMessage.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -6
- package/dist/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviButton.js +0 -15
- package/dist/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -25
- package/dist/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviFooter.js +0 -172
- package/dist/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -17
- package/dist/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/ConviHeader.js +0 -66
- package/dist/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -12
- package/dist/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/SettingsTray.js +0 -68
- package/dist/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -8
- package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -199
- package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/index.d.ts +0 -6
- package/dist/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/conviComponents/index.js +0 -6
- package/dist/components/rtc-widget/components/conviComponents/index.js.map +0 -1
- package/dist/components/rtc-widget/components/index.d.ts +0 -8
- package/dist/components/rtc-widget/components/index.d.ts.map +0 -1
- package/dist/components/rtc-widget/components/index.js +0 -13
- package/dist/components/rtc-widget/components/index.js.map +0 -1
- package/dist/components/rtc-widget/index.d.ts +0 -6
- package/dist/components/rtc-widget/index.d.ts.map +0 -1
- package/dist/components/rtc-widget/index.js +0 -9
- package/dist/components/rtc-widget/index.js.map +0 -1
- package/dist/components/rtc-widget/styles/framerConfig.d.ts +0 -116
- package/dist/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
- package/dist/components/rtc-widget/styles/framerConfig.js +0 -73
- package/dist/components/rtc-widget/styles/framerConfig.js.map +0 -1
- package/dist/components/rtc-widget/styles/icons.d.ts +0 -28
- package/dist/components/rtc-widget/styles/icons.d.ts.map +0 -1
- package/dist/components/rtc-widget/styles/icons.js +0 -257
- package/dist/components/rtc-widget/styles/icons.js.map +0 -1
- package/dist/components/rtc-widget/styles/index.d.ts +0 -6
- package/dist/components/rtc-widget/styles/index.d.ts.map +0 -1
- package/dist/components/rtc-widget/styles/index.js +0 -9
- package/dist/components/rtc-widget/styles/index.js.map +0 -1
- package/dist/components/rtc-widget/styles/styledComponents.d.ts +0 -90
- package/dist/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
- package/dist/components/rtc-widget/styles/styledComponents.js +0 -661
- package/dist/components/rtc-widget/styles/styledComponents.js.map +0 -1
- package/dist/components/rtc-widget/styles/theme.d.ts.map +0 -1
- package/dist/components/rtc-widget/styles/theme.js +0 -290
- package/dist/components/rtc-widget/styles/theme.js.map +0 -1
- package/dist/components/rtc-widget/types/index.d.ts +0 -60
- package/dist/components/rtc-widget/types/index.d.ts.map +0 -1
- package/dist/components/rtc-widget/types/index.js +0 -2
- package/dist/components/rtc-widget/types/index.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -13
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -14
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useAudioControls.d.ts +0 -41
- package/dist/hooks/useAudioControls.d.ts.map +0 -1
- package/dist/hooks/useAudioControls.js +0 -208
- package/dist/hooks/useAudioControls.js.map +0 -1
- package/dist/hooks/useCharacterInfo.d.ts +0 -17
- package/dist/hooks/useCharacterInfo.d.ts.map +0 -1
- package/dist/hooks/useCharacterInfo.js +0 -60
- package/dist/hooks/useCharacterInfo.js.map +0 -1
- package/dist/hooks/useConvaiClient.d.ts +0 -30
- package/dist/hooks/useConvaiClient.d.ts.map +0 -1
- package/dist/hooks/useConvaiClient.js +0 -349
- package/dist/hooks/useConvaiClient.js.map +0 -1
- package/dist/hooks/useDynamicInfoUpdater.d.ts +0 -33
- package/dist/hooks/useDynamicInfoUpdater.d.ts.map +0 -1
- package/dist/hooks/useDynamicInfoUpdater.js +0 -49
- package/dist/hooks/useDynamicInfoUpdater.js.map +0 -1
- package/dist/hooks/useLocalCameraTrack.d.ts +0 -22
- package/dist/hooks/useLocalCameraTrack.d.ts.map +0 -1
- package/dist/hooks/useLocalCameraTrack.js +0 -34
- package/dist/hooks/useLocalCameraTrack.js.map +0 -1
- package/dist/hooks/useMessageHandler.d.ts +0 -28
- package/dist/hooks/useMessageHandler.d.ts.map +0 -1
- package/dist/hooks/useMessageHandler.js +0 -267
- package/dist/hooks/useMessageHandler.js.map +0 -1
- package/dist/hooks/useScreenShare.d.ts +0 -45
- package/dist/hooks/useScreenShare.d.ts.map +0 -1
- package/dist/hooks/useScreenShare.js +0 -186
- package/dist/hooks/useScreenShare.js.map +0 -1
- package/dist/hooks/useTemplateKeysUpdater.d.ts +0 -35
- package/dist/hooks/useTemplateKeysUpdater.d.ts.map +0 -1
- package/dist/hooks/useTemplateKeysUpdater.js +0 -51
- package/dist/hooks/useTemplateKeysUpdater.js.map +0 -1
- package/dist/hooks/useTriggerMessageSender.d.ts +0 -28
- package/dist/hooks/useTriggerMessageSender.d.ts.map +0 -1
- package/dist/hooks/useTriggerMessageSender.js +0 -46
- package/dist/hooks/useTriggerMessageSender.js.map +0 -1
- package/dist/hooks/useTtsToggle.d.ts +0 -37
- package/dist/hooks/useTtsToggle.d.ts.map +0 -1
- package/dist/hooks/useTtsToggle.js +0 -63
- package/dist/hooks/useTtsToggle.js.map +0 -1
- package/dist/hooks/useUserTextMessageSender.d.ts +0 -28
- package/dist/hooks/useUserTextMessageSender.d.ts.map +0 -1
- package/dist/hooks/useUserTextMessageSender.js +0 -58
- package/dist/hooks/useUserTextMessageSender.js.map +0 -1
- package/dist/hooks/useVideoControls.d.ts +0 -39
- package/dist/hooks/useVideoControls.d.ts.map +0 -1
- package/dist/hooks/useVideoControls.js +0 -193
- package/dist/hooks/useVideoControls.js.map +0 -1
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Room } from "livekit-client";
|
|
2
|
-
/**
|
|
3
|
-
* Hook for sending trigger messages to Convai.
|
|
4
|
-
*
|
|
5
|
-
* Sends system trigger messages that can activate specific behaviors
|
|
6
|
-
* or responses from the AI assistant.
|
|
7
|
-
*
|
|
8
|
-
* @param {Room} room - LiveKit room instance
|
|
9
|
-
* @param {string} participantSid - Participant session ID
|
|
10
|
-
* @returns {Object} Object containing sendTriggerMessage function
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* function TriggerComponent() {
|
|
15
|
-
* const { sendTriggerMessage } = useTriggerMessageSender(room, participantSid);
|
|
16
|
-
*
|
|
17
|
-
* const handleTrigger = () => {
|
|
18
|
-
* sendTriggerMessage("character_introduction", "User just entered the room");
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* return <button onClick={handleTrigger}>Send Trigger</button>;
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const useTriggerMessageSender: (room: Room, participantSid: string) => {
|
|
26
|
-
sendTriggerMessage: (triggerName?: string, triggerMessage?: string) => void;
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=useTriggerMessageSender.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTriggerMessageSender.d.ts","sourceRoot":"","sources":["../../src/hooks/useTriggerMessageSender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,IAAI,EACV,gBAAgB,MAAM;uCAGL,MAAM,mBAAmB,MAAM;CAuBjD,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Hook for sending trigger messages to Convai.
|
|
4
|
-
*
|
|
5
|
-
* Sends system trigger messages that can activate specific behaviors
|
|
6
|
-
* or responses from the AI assistant.
|
|
7
|
-
*
|
|
8
|
-
* @param {Room} room - LiveKit room instance
|
|
9
|
-
* @param {string} participantSid - Participant session ID
|
|
10
|
-
* @returns {Object} Object containing sendTriggerMessage function
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* function TriggerComponent() {
|
|
15
|
-
* const { sendTriggerMessage } = useTriggerMessageSender(room, participantSid);
|
|
16
|
-
*
|
|
17
|
-
* const handleTrigger = () => {
|
|
18
|
-
* sendTriggerMessage("character_introduction", "User just entered the room");
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* return <button onClick={handleTrigger}>Send Trigger</button>;
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export const useTriggerMessageSender = (room, participantSid) => {
|
|
26
|
-
const sendTriggerMessage = useCallback((triggerName, triggerMessage) => {
|
|
27
|
-
if (room && room.localParticipant) {
|
|
28
|
-
const message = {
|
|
29
|
-
type: "trigger-message",
|
|
30
|
-
data: {
|
|
31
|
-
...(triggerName && { trigger_name: triggerName }),
|
|
32
|
-
...(triggerMessage && { trigger_message: triggerMessage }),
|
|
33
|
-
participant_sid: participantSid || room.localParticipant.sid,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const encodedData = new TextEncoder().encode(JSON.stringify(message));
|
|
37
|
-
room.localParticipant.publishData(encodedData, {
|
|
38
|
-
reliable: true,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}, [room, participantSid]);
|
|
42
|
-
return {
|
|
43
|
-
sendTriggerMessage,
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=useTriggerMessageSender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTriggerMessageSender.js","sourceRoot":"","sources":["../../src/hooks/useTriggerMessageSender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,IAAU,EACV,cAAsB,EACtB,EAAE;IACF,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,WAAoB,EAAE,cAAuB,EAAE,EAAE;QAChD,IAAI,IAAI,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG;gBACd,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE;oBACJ,GAAG,CAAC,WAAW,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;oBACjD,GAAG,CAAC,cAAc,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;oBAC1D,eAAe,EAAE,cAAc,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG;iBAC7D;aACF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,WAAW,EAAE;gBAC7C,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EACD,CAAC,IAAI,EAAE,cAAc,CAAC,CACvB,CAAC;IAEF,OAAO;QACL,kBAAkB;KACnB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Room } from "livekit-client";
|
|
2
|
-
/**
|
|
3
|
-
* Hook for toggling TTS (Text-to-Speech) generation in Convai.
|
|
4
|
-
*
|
|
5
|
-
* Sends a tts-toggle message to control whether the bot generates audio.
|
|
6
|
-
* This is more efficient than muting audio after generation, as it prevents
|
|
7
|
-
* audio generation at the source.
|
|
8
|
-
*
|
|
9
|
-
* @param {Room} room - LiveKit room instance
|
|
10
|
-
* @returns {Object} Object containing toggleTts function
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* function AudioControlComponent() {
|
|
15
|
-
* const { toggleTts } = useTtsToggle(room);
|
|
16
|
-
*
|
|
17
|
-
* const handleMute = () => {
|
|
18
|
-
* toggleTts(false); // Disable TTS generation
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* const handleUnmute = () => {
|
|
22
|
-
* toggleTts(true); // Enable TTS generation
|
|
23
|
-
* };
|
|
24
|
-
*
|
|
25
|
-
* return (
|
|
26
|
-
* <div>
|
|
27
|
-
* <button onClick={handleMute}>Mute TTS</button>
|
|
28
|
-
* <button onClick={handleUnmute}>Unmute TTS</button>
|
|
29
|
-
* </div>
|
|
30
|
-
* );
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare const useTtsToggle: (room: Room) => {
|
|
35
|
-
toggleTts: (enabled: boolean) => void;
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=useTtsToggle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTtsToggle.d.ts","sourceRoot":"","sources":["../../src/hooks/useTtsToggle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI;yBAEzB,OAAO;CA8BpB,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { logger } from "../utils/logger";
|
|
3
|
-
/**
|
|
4
|
-
* Hook for toggling TTS (Text-to-Speech) generation in Convai.
|
|
5
|
-
*
|
|
6
|
-
* Sends a tts-toggle message to control whether the bot generates audio.
|
|
7
|
-
* This is more efficient than muting audio after generation, as it prevents
|
|
8
|
-
* audio generation at the source.
|
|
9
|
-
*
|
|
10
|
-
* @param {Room} room - LiveKit room instance
|
|
11
|
-
* @returns {Object} Object containing toggleTts function
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* function AudioControlComponent() {
|
|
16
|
-
* const { toggleTts } = useTtsToggle(room);
|
|
17
|
-
*
|
|
18
|
-
* const handleMute = () => {
|
|
19
|
-
* toggleTts(false); // Disable TTS generation
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* const handleUnmute = () => {
|
|
23
|
-
* toggleTts(true); // Enable TTS generation
|
|
24
|
-
* };
|
|
25
|
-
*
|
|
26
|
-
* return (
|
|
27
|
-
* <div>
|
|
28
|
-
* <button onClick={handleMute}>Mute TTS</button>
|
|
29
|
-
* <button onClick={handleUnmute}>Unmute TTS</button>
|
|
30
|
-
* </div>
|
|
31
|
-
* );
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export const useTtsToggle = (room) => {
|
|
36
|
-
const toggleTts = useCallback((enabled) => {
|
|
37
|
-
// Check if room is connected and localParticipant exists
|
|
38
|
-
if (!room || room.state === 'disconnected' || !room.localParticipant) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const message = {
|
|
43
|
-
type: "tts-toggle",
|
|
44
|
-
data: {
|
|
45
|
-
"enabled": enabled
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const encodedData = new TextEncoder().encode(JSON.stringify(message));
|
|
49
|
-
room.localParticipant.publishData(encodedData, {
|
|
50
|
-
reliable: true,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
logger.error("Failed to toggle TTS:", error);
|
|
55
|
-
// Re-throw to allow caller to handle
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
}, [room]);
|
|
59
|
-
return {
|
|
60
|
-
toggleTts,
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=useTtsToggle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTtsToggle.js","sourceRoot":"","sources":["../../src/hooks/useTtsToggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAE,EAAE;IACzC,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,OAAgB,EAAE,EAAE;QACnB,yDAAyD;QACzD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,cAAc,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACrE,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG;gBACd,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE;oBACJ,SAAS,EAAE,OAAO;iBACnB;aACF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,WAAW,EAAE;gBAC7C,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAC7C,qCAAqC;YACrC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EACD,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO;QACL,SAAS;KACV,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Room } from "livekit-client";
|
|
2
|
-
/**
|
|
3
|
-
* Hook for sending user text messages to Convai.
|
|
4
|
-
*
|
|
5
|
-
* Sends programmatic text messages that are processed by the AI assistant
|
|
6
|
-
* but not displayed in the chat interface.
|
|
7
|
-
*
|
|
8
|
-
* @param {Room} room - LiveKit room instance
|
|
9
|
-
* @param {string} participantSid - Participant session ID
|
|
10
|
-
* @returns {Object} Object containing sendUserTextMessage function
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* function ChatComponent() {
|
|
15
|
-
* const { sendUserTextMessage } = useUserTextMessageSender(room, participantSid);
|
|
16
|
-
*
|
|
17
|
-
* const handleSendMessage = () => {
|
|
18
|
-
* sendUserTextMessage("Hello, how are you?");
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* return <button onClick={handleSendMessage}>Send Message</button>;
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare const useUserTextMessageSender: (room: Room, participantSid: string) => {
|
|
26
|
-
sendUserTextMessage: (text: string) => void;
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=useUserTextMessageSender.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUserTextMessageSender.d.ts","sourceRoot":"","sources":["../../src/hooks/useUserTextMessageSender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,wBAAwB,GACnC,MAAM,IAAI,EACV,gBAAgB,MAAM;gCAGb,MAAM;CAmChB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
import { logger } from "../utils/logger";
|
|
3
|
-
/**
|
|
4
|
-
* Hook for sending user text messages to Convai.
|
|
5
|
-
*
|
|
6
|
-
* Sends programmatic text messages that are processed by the AI assistant
|
|
7
|
-
* but not displayed in the chat interface.
|
|
8
|
-
*
|
|
9
|
-
* @param {Room} room - LiveKit room instance
|
|
10
|
-
* @param {string} participantSid - Participant session ID
|
|
11
|
-
* @returns {Object} Object containing sendUserTextMessage function
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* function ChatComponent() {
|
|
16
|
-
* const { sendUserTextMessage } = useUserTextMessageSender(room, participantSid);
|
|
17
|
-
*
|
|
18
|
-
* const handleSendMessage = () => {
|
|
19
|
-
* sendUserTextMessage("Hello, how are you?");
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* return <button onClick={handleSendMessage}>Send Message</button>;
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export const useUserTextMessageSender = (room, participantSid) => {
|
|
27
|
-
const sendUserTextMessage = useCallback((text) => {
|
|
28
|
-
// Check if room is connected and localParticipant exists
|
|
29
|
-
if (!room || room.state === 'disconnected' || !room.localParticipant) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (!text || !text.trim()) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const message = {
|
|
37
|
-
type: "user_text_message",
|
|
38
|
-
data: {
|
|
39
|
-
text: text.trim(),
|
|
40
|
-
participant_sid: participantSid || room.localParticipant.sid,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
const encodedData = new TextEncoder().encode(JSON.stringify(message));
|
|
44
|
-
room.localParticipant.publishData(encodedData, {
|
|
45
|
-
reliable: true,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
logger.error("Failed to send user text message:", error);
|
|
50
|
-
// Re-throw to allow caller to handle
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}, [room, participantSid]);
|
|
54
|
-
return {
|
|
55
|
-
sendUserTextMessage,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=useUserTextMessageSender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUserTextMessageSender.js","sourceRoot":"","sources":["../../src/hooks/useUserTextMessageSender.ts"],"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@
|
|
|
1
|
-
import { Room } from "livekit-client";
|
|
2
|
-
export interface VideoControls {
|
|
3
|
-
isVideoEnabled: boolean;
|
|
4
|
-
isVideoHidden: boolean;
|
|
5
|
-
enableVideo: () => Promise<void>;
|
|
6
|
-
disableVideo: () => Promise<void>;
|
|
7
|
-
hideVideo: () => Promise<void>;
|
|
8
|
-
showVideo: () => Promise<void>;
|
|
9
|
-
toggleVideo: () => Promise<void>;
|
|
10
|
-
setVideoDevice: (deviceId: string) => Promise<void>;
|
|
11
|
-
getVideoDevices: () => Promise<MediaDeviceInfo[]>;
|
|
12
|
-
setVideoQuality: (quality: 'low' | 'medium' | 'high') => Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Hook for managing video controls in LiveKit.
|
|
16
|
-
*
|
|
17
|
-
* Provides methods to enable/disable camera, manage video devices,
|
|
18
|
-
* and control video visibility state.
|
|
19
|
-
*
|
|
20
|
-
* @param {Room | null} room - LiveKit room instance
|
|
21
|
-
* @returns {VideoControls} Object containing video control methods and state
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* function VideoControls() {
|
|
26
|
-
* const videoControls = useVideoControls(room);
|
|
27
|
-
*
|
|
28
|
-
* return (
|
|
29
|
-
* <div>
|
|
30
|
-
* <button onClick={videoControls.toggleVideo}>
|
|
31
|
-
* {videoControls.isVideoEnabled ? 'Disable Camera' : 'Enable Camera'}
|
|
32
|
-
* </button>
|
|
33
|
-
* </div>
|
|
34
|
-
* );
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare const useVideoControls: (room: Room | null) => VideoControls;
|
|
39
|
-
//# sourceMappingURL=useVideoControls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVideoControls.d.ts","sourceRoot":"","sources":["../../src/hooks/useVideoControls.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,MAAM,WAAW,aAAa;IAE5B,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IAGvB,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAGjC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,eAAe,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAGlD,eAAe,EAAE,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,GAAG,IAAI,KAAG,aAwLpD,CAAC"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState, useEffect } from "react";
|
|
2
|
-
import { logger } from "../utils/logger";
|
|
3
|
-
/**
|
|
4
|
-
* Hook for managing video controls in LiveKit.
|
|
5
|
-
*
|
|
6
|
-
* Provides methods to enable/disable camera, manage video devices,
|
|
7
|
-
* and control video visibility state.
|
|
8
|
-
*
|
|
9
|
-
* @param {Room | null} room - LiveKit room instance
|
|
10
|
-
* @returns {VideoControls} Object containing video control methods and state
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* function VideoControls() {
|
|
15
|
-
* const videoControls = useVideoControls(room);
|
|
16
|
-
*
|
|
17
|
-
* return (
|
|
18
|
-
* <div>
|
|
19
|
-
* <button onClick={videoControls.toggleVideo}>
|
|
20
|
-
* {videoControls.isVideoEnabled ? 'Disable Camera' : 'Enable Camera'}
|
|
21
|
-
* </button>
|
|
22
|
-
* </div>
|
|
23
|
-
* );
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export const useVideoControls = (room) => {
|
|
28
|
-
const [isVideoEnabled, setIsVideoEnabled] = useState(false);
|
|
29
|
-
const [isVideoHidden, setIsVideoHidden] = useState(false);
|
|
30
|
-
// Update video state when room changes
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (!room || room.state === 'disconnected') {
|
|
33
|
-
setIsVideoEnabled(false);
|
|
34
|
-
setIsVideoHidden(false);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const localParticipant = room.localParticipant;
|
|
38
|
-
// Set initial state
|
|
39
|
-
setIsVideoEnabled(localParticipant.isCameraEnabled);
|
|
40
|
-
setIsVideoHidden(false); // LiveKit doesn't have a direct hidden state for video
|
|
41
|
-
// Listen for video state changes
|
|
42
|
-
const handleTrackMuted = (track) => {
|
|
43
|
-
if (track.source === 'camera') {
|
|
44
|
-
setIsVideoHidden(true);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const handleTrackUnmuted = (track) => {
|
|
48
|
-
if (track.source === 'camera') {
|
|
49
|
-
setIsVideoHidden(false);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const handleTrackPublished = (publication) => {
|
|
53
|
-
if (publication.source === 'camera') {
|
|
54
|
-
setIsVideoEnabled(true);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const handleTrackUnpublished = (publication) => {
|
|
58
|
-
if (publication.source === 'camera') {
|
|
59
|
-
setIsVideoEnabled(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
// Subscribe to events
|
|
63
|
-
localParticipant.on('trackMuted', handleTrackMuted);
|
|
64
|
-
localParticipant.on('trackUnmuted', handleTrackUnmuted);
|
|
65
|
-
localParticipant.on('trackPublished', handleTrackPublished);
|
|
66
|
-
localParticipant.on('trackUnpublished', handleTrackUnpublished);
|
|
67
|
-
return () => {
|
|
68
|
-
localParticipant.off('trackMuted', handleTrackMuted);
|
|
69
|
-
localParticipant.off('trackUnmuted', handleTrackUnmuted);
|
|
70
|
-
localParticipant.off('trackPublished', handleTrackPublished);
|
|
71
|
-
localParticipant.off('trackUnpublished', handleTrackUnpublished);
|
|
72
|
-
};
|
|
73
|
-
}, [room, room?.state]);
|
|
74
|
-
// Enable video
|
|
75
|
-
const enableVideo = useCallback(async () => {
|
|
76
|
-
if (!room) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
await room.localParticipant.setCameraEnabled(true);
|
|
81
|
-
setIsVideoEnabled(true); // Update state immediately
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
logger.error("Failed to enable video:", error);
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}, [room]);
|
|
88
|
-
// Disable video
|
|
89
|
-
const disableVideo = useCallback(async () => {
|
|
90
|
-
if (!room) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
await room.localParticipant.setCameraEnabled(false);
|
|
95
|
-
setIsVideoEnabled(false); // Update state immediately
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
logger.error("Failed to disable video:", error);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
}, [room]);
|
|
102
|
-
// Hide video
|
|
103
|
-
const hideVideo = useCallback(async () => {
|
|
104
|
-
if (!room) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
// For now, we'll just disable the camera as LiveKit doesn't have a direct hide method
|
|
109
|
-
await room.localParticipant.setCameraEnabled(false);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
logger.error("Failed to hide video:", error);
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}, [room]);
|
|
116
|
-
// Show video
|
|
117
|
-
const showVideo = useCallback(async () => {
|
|
118
|
-
if (!room) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
await room.localParticipant.setCameraEnabled(true);
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
logger.error("Failed to show video:", error);
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
}, [room]);
|
|
129
|
-
// Toggle video
|
|
130
|
-
const toggleVideo = useCallback(async () => {
|
|
131
|
-
if (isVideoEnabled) {
|
|
132
|
-
await disableVideo();
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
await enableVideo();
|
|
136
|
-
}
|
|
137
|
-
}, [isVideoEnabled, enableVideo, disableVideo]);
|
|
138
|
-
// Set video device
|
|
139
|
-
const setVideoDevice = useCallback(async (deviceId) => {
|
|
140
|
-
if (!room) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
await room.localParticipant.setCameraEnabled(true, { deviceId });
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
logger.error("Failed to set video device:", error);
|
|
148
|
-
throw error;
|
|
149
|
-
}
|
|
150
|
-
}, [room]);
|
|
151
|
-
// Get available video devices
|
|
152
|
-
const getVideoDevices = useCallback(async () => {
|
|
153
|
-
try {
|
|
154
|
-
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
155
|
-
const videoDevices = devices.filter(device => device.kind === 'videoinput');
|
|
156
|
-
return videoDevices;
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
logger.error("Failed to get video devices:", error);
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
162
|
-
}, []);
|
|
163
|
-
// Set video quality
|
|
164
|
-
const setVideoQuality = useCallback(async (quality) => {
|
|
165
|
-
if (!room) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
// TODO: Implement video quality settings when LiveKit provides the API
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
logger.error("Failed to set video quality:", error);
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
}, [room]);
|
|
176
|
-
return {
|
|
177
|
-
// Video state
|
|
178
|
-
isVideoEnabled,
|
|
179
|
-
isVideoHidden,
|
|
180
|
-
// Video controls
|
|
181
|
-
enableVideo,
|
|
182
|
-
disableVideo,
|
|
183
|
-
hideVideo,
|
|
184
|
-
showVideo,
|
|
185
|
-
toggleVideo,
|
|
186
|
-
// Video settings
|
|
187
|
-
setVideoDevice,
|
|
188
|
-
getVideoDevices,
|
|
189
|
-
// Video quality
|
|
190
|
-
setVideoQuality,
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
//# sourceMappingURL=useVideoControls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useVideoControls.js","sourceRoot":"","sources":["../../src/hooks/useVideoControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAsBzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAiB,EAAiB,EAAE;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1D,uCAAuC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,cAAc,EAAE,CAAC;YAC3C,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,gBAAgB,CAAC,KAAK,CAAC,CAAC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