agora-appbuilder-core 4.1.0-beta-10 → 4.1.0-beta-11
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/package.json +1 -1
- package/template/bridge/rtc/webNg/RtcEngine.ts +7 -7
- package/template/defaultConfig.js +2 -2
- package/template/src/ai-agent/components/AgentControls/AgentContext.tsx +10 -16
- package/template/src/ai-agent/components/AgentControls/index.tsx +0 -6
- package/template/src/ai-agent/components/AgentControls/message.ts +33 -37
- package/template/src/ai-agent/components/CustomSettingsPanel.tsx +2 -2
- package/template/src/ai-agent/components/SelectAiAgent.tsx +1 -1
- package/template/src/ai-agent/components/SelectAiAgentVoice.tsx +3 -3
- package/template/src/ai-agent/components/SelectUserLanguage.tsx +3 -2
- package/template/src/ai-agent/components/UserPrompt.tsx +1 -1
- package/template/src/ai-agent/components/mobile/MobileLayoutComponent.tsx +0 -1
- package/template/src/ai-agent/index.tsx +0 -7
- package/template/src/ai-agent/layout/ConversationalAI.tsx +0 -2
- package/template/src/ai-agent/layout/DefaultAIOnly.tsx +1 -7
- package/template/src/components/StorageContext.tsx +16 -0
package/package.json
CHANGED
|
@@ -894,13 +894,13 @@ export default class RtcEngine {
|
|
|
894
894
|
|
|
895
895
|
/* Recieve Captions */
|
|
896
896
|
this.client.on('stream-message', (uid: UID, payload: UInt8Array) => {
|
|
897
|
-
logger.debug(
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
);
|
|
897
|
+
// logger.debug(
|
|
898
|
+
// LogSource.AgoraSDK,
|
|
899
|
+
// 'Event',
|
|
900
|
+
// 'RTC [stream-message](stt-web: onStreamMessageCallback)',
|
|
901
|
+
// uid,
|
|
902
|
+
// payload,
|
|
903
|
+
// );
|
|
904
904
|
(this.eventsMap.get('onStreamMessage') as callbackType)(uid, payload);
|
|
905
905
|
});
|
|
906
906
|
|
|
@@ -76,8 +76,8 @@ const DefaultConfig = {
|
|
|
76
76
|
CHAT_ORG_NAME: '',
|
|
77
77
|
CHAT_APP_NAME: '',
|
|
78
78
|
CHAT_URL: '',
|
|
79
|
-
CLI_VERSION: '3.1.0-beta-
|
|
80
|
-
CORE_VERSION: '4.1.0-beta-
|
|
79
|
+
CLI_VERSION: '3.1.0-beta-11',
|
|
80
|
+
CORE_VERSION: '4.1.0-beta-11',
|
|
81
81
|
DISABLE_LANDSCAPE_MODE: false,
|
|
82
82
|
STT_AUTO_START: false,
|
|
83
83
|
CLOUD_RECORDING_AUTO_START: false,
|
|
@@ -161,7 +161,7 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
|
|
|
161
161
|
React.useEffect(() => {
|
|
162
162
|
const getChatHistoryFromEvent = (event: MessageEvent) => {
|
|
163
163
|
const {data} = event;
|
|
164
|
-
console.log('get chat history from event', data);
|
|
164
|
+
// console.log('get chat history from event', data);
|
|
165
165
|
if (data.type === 'message') {
|
|
166
166
|
setChatHistory(prevChatHistory => [...(data?.chatHistory || [])]);
|
|
167
167
|
}
|
|
@@ -179,13 +179,6 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
|
|
|
179
179
|
}, []);
|
|
180
180
|
|
|
181
181
|
useEffect(() => {
|
|
182
|
-
console.log(
|
|
183
|
-
'debugging users agent contrl',
|
|
184
|
-
agentConnectionState,
|
|
185
|
-
{users},
|
|
186
|
-
agentUID,
|
|
187
|
-
);
|
|
188
|
-
|
|
189
182
|
// welcome agent
|
|
190
183
|
const aiAgentUID = users.filter(item => item === agentUID);
|
|
191
184
|
|
|
@@ -259,19 +252,20 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
|
|
|
259
252
|
try {
|
|
260
253
|
setAgentConnectionState(AgentState.REQUEST_SENT);
|
|
261
254
|
setStartAPICalled(true);
|
|
255
|
+
const params = {
|
|
256
|
+
agent_id: agentId,
|
|
257
|
+
prompt: prompt,
|
|
258
|
+
voice: agents?.find(a => a.id === agentId)?.config?.tts?.params
|
|
259
|
+
?.voice_name,
|
|
260
|
+
enable_interruption_handling: isInterruptionHandlingEnabled,
|
|
261
|
+
language: language,
|
|
262
|
+
};
|
|
262
263
|
const data = await connectToAIAgent(
|
|
263
264
|
'start',
|
|
264
265
|
channel_name,
|
|
265
266
|
localUid,
|
|
266
267
|
store.token,
|
|
267
|
-
|
|
268
|
-
agent_id: agentId || agents?.length ? agents[0].id : null,
|
|
269
|
-
prompt: prompt,
|
|
270
|
-
voice: agents.find(a => a.id === agentId)?.config?.tts?.params
|
|
271
|
-
?.voice_name,
|
|
272
|
-
enable_interruption_handling: isInterruptionHandlingEnabled,
|
|
273
|
-
language: language,
|
|
274
|
-
},
|
|
268
|
+
params,
|
|
275
269
|
);
|
|
276
270
|
// console.log("response X-Client-ID", newClientId, typeof newClientId)
|
|
277
271
|
// @ts-ignore
|
|
@@ -18,12 +18,6 @@ export const AgentControl: React.FC = () => {
|
|
|
18
18
|
const isAwaitingLeave = agentConnectionState === AgentState.AWAITING_LEAVE;
|
|
19
19
|
const isAgentAvailable = useIsAgentAvailable();
|
|
20
20
|
|
|
21
|
-
console.log(
|
|
22
|
-
'Agent Control--',
|
|
23
|
-
{agentConnectionState},
|
|
24
|
-
{bth: AI_AGENT_STATE[agentConnectionState]},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
21
|
const isLoading =
|
|
28
22
|
agentConnectionState === AgentState.REQUEST_SENT ||
|
|
29
23
|
agentConnectionState === AgentState.AGENT_DISCONNECT_REQUEST ||
|
|
@@ -446,12 +446,12 @@ export class MessageEngine {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
public handleMessageInterrupt(message: IMessageInterrupt) {
|
|
449
|
-
logger.debug(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
);
|
|
449
|
+
// logger.debug(
|
|
450
|
+
// LogSource.AgoraSDK,
|
|
451
|
+
// 'AI_AGENT',
|
|
452
|
+
// 'handleMessageInterrupt',
|
|
453
|
+
// message,
|
|
454
|
+
// );
|
|
455
455
|
const turn_id = message.turn_id;
|
|
456
456
|
const start_ms = message.start_ms;
|
|
457
457
|
this._interruptQueue({
|
|
@@ -662,21 +662,21 @@ export class MessageEngine {
|
|
|
662
662
|
.join('');
|
|
663
663
|
|
|
664
664
|
// decode message
|
|
665
|
-
logger.debug(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
);
|
|
665
|
+
// logger.debug(
|
|
666
|
+
// LogSource.AgoraSDK,
|
|
667
|
+
// 'AI_AGENT',
|
|
668
|
+
// '[message]',
|
|
669
|
+
// atob(message),
|
|
670
|
+
// );
|
|
671
671
|
|
|
672
672
|
const decodedMessage = JSON.parse(Base64.atob(message));
|
|
673
673
|
|
|
674
|
-
logger.debug(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
);
|
|
674
|
+
// logger.debug(
|
|
675
|
+
// LogSource.AgoraSDK,
|
|
676
|
+
// 'AI_AGENT',
|
|
677
|
+
// '[decodedMessage]',
|
|
678
|
+
// decodedMessage,
|
|
679
|
+
// );
|
|
680
680
|
|
|
681
681
|
// callback
|
|
682
682
|
callback?.(decodedMessage);
|
|
@@ -830,12 +830,12 @@ export class MessageEngine {
|
|
|
830
830
|
item => item.turn_id === turn_id,
|
|
831
831
|
);
|
|
832
832
|
if (!correspondingQueueItem) {
|
|
833
|
-
logger.debug(
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
);
|
|
833
|
+
// logger.debug(
|
|
834
|
+
// LogSource.AgoraSDK,
|
|
835
|
+
// 'AI_AGENT',
|
|
836
|
+
// 'No corresponding queue item found',
|
|
837
|
+
// options,
|
|
838
|
+
// );
|
|
839
839
|
return;
|
|
840
840
|
}
|
|
841
841
|
// if correspondingQueueItem exists, update its status to interrupted
|
|
@@ -962,15 +962,15 @@ export class MessageEngine {
|
|
|
962
962
|
|
|
963
963
|
private _mutateChatHistory() {
|
|
964
964
|
// logger.debug(LogSource.AgoraSDK,'AI_AGENT', 'Mutate messageList', this.messageList)
|
|
965
|
-
logger.debug(
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
);
|
|
965
|
+
// logger.debug(
|
|
966
|
+
// LogSource.AgoraSDK,
|
|
967
|
+
// 'AI_AGENT',
|
|
968
|
+
// 'Mutate messageList',
|
|
969
|
+
// this._pts,
|
|
970
|
+
// this.messageList
|
|
971
|
+
// .map(item => `${item.text}[status: ${item.status}]`)
|
|
972
|
+
// .join('\n'),
|
|
973
|
+
// );
|
|
974
974
|
this.onMessageListUpdate?.(this.messageList as IMessageListItem[]);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
@@ -982,10 +982,7 @@ export let messageService: MessageEngine | null = null;
|
|
|
982
982
|
* @returns {MessageEngine} Singleton instance of MessageEngine
|
|
983
983
|
*/
|
|
984
984
|
export function initializeMessageEngine(): MessageEngine {
|
|
985
|
-
console.log('debguggingnew initializeMessageEngine getting here');
|
|
986
985
|
if (!messageService) {
|
|
987
|
-
console.log('debuggingnew getting here');
|
|
988
|
-
|
|
989
986
|
messageService = new MessageEngine(EMessageEngineMode.AUTO, chatHistory => {
|
|
990
987
|
LocalEventEmitter.emit(LocalEventsEnum.AGENT_TRANSCRIPT_CHANGE, {
|
|
991
988
|
data: {
|
|
@@ -995,7 +992,6 @@ export function initializeMessageEngine(): MessageEngine {
|
|
|
995
992
|
});
|
|
996
993
|
});
|
|
997
994
|
}
|
|
998
|
-
console.log('debguggingnew messageService', messageService);
|
|
999
995
|
return messageService;
|
|
1000
996
|
}
|
|
1001
997
|
|
|
@@ -70,7 +70,7 @@ const InfoSection = () => {
|
|
|
70
70
|
<View style={[styles.flex1, styles.alignEnd]}>
|
|
71
71
|
<Text style={[styles.infoRowValue]}>
|
|
72
72
|
{formatVoiceName(
|
|
73
|
-
agents
|
|
73
|
+
agents?.find(a => a.id === agentId)?.config?.tts?.params
|
|
74
74
|
?.voice_name,
|
|
75
75
|
)}
|
|
76
76
|
</Text>
|
|
@@ -123,7 +123,7 @@ const AdvancedSettings = () => {
|
|
|
123
123
|
|
|
124
124
|
//when user switchs agent then update the toggle value for that agent
|
|
125
125
|
useEffect(() => {
|
|
126
|
-
if (agentId) {
|
|
126
|
+
if (agentId && agents?.length) {
|
|
127
127
|
setIsInterruptionHandlingEnabled(
|
|
128
128
|
agents?.find(a => a?.id === agentId)?.config?.enable_aivad,
|
|
129
129
|
);
|
|
@@ -20,11 +20,11 @@ const SelectAiAgentVoice = () => {
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
if (agentId && !agentVoice) {
|
|
23
|
+
if (agentId && !agentVoice && agents?.length) {
|
|
24
24
|
//@ts-ignore
|
|
25
|
-
setAgentVoice(agents
|
|
25
|
+
setAgentVoice(agents?.find((agent: any) => agent.id === agentId)?.voice);
|
|
26
26
|
}
|
|
27
|
-
}, [agentId]);
|
|
27
|
+
}, [agentId, agents]);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<View>
|
|
@@ -21,10 +21,11 @@ const SelectUserLanguage = () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
|
-
if (agentId) {
|
|
24
|
+
if (agentId && agents?.length) {
|
|
25
25
|
//@ts-ignore
|
|
26
26
|
setLanguage(
|
|
27
|
-
agents
|
|
27
|
+
agents?.find((agent: any) => agent.id === agentId)?.config
|
|
28
|
+
?.asr_language,
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
}, [agentId, setLanguage, agents]);
|
|
@@ -27,7 +27,6 @@ const MobileLayoutComponent: LayoutComponent = () => {
|
|
|
27
27
|
const {getLocalAudioStream, getRemoteAudioStream} = useLocalAudio();
|
|
28
28
|
const isAudioEnabled = useIsAudioEnabled();
|
|
29
29
|
const connected = activeUids.includes(agentUID);
|
|
30
|
-
console.log({activeUids}, 'active uids');
|
|
31
30
|
|
|
32
31
|
useEffect(() => {
|
|
33
32
|
if (getLocalAudioStream()) {
|
|
@@ -62,17 +62,10 @@ const DesktopLayoutComponent: LayoutComponent = () => {
|
|
|
62
62
|
const {getLocalAudioStream, getRemoteAudioStream} = useLocalAudio();
|
|
63
63
|
|
|
64
64
|
const connected = activeUids.includes(agentUID);
|
|
65
|
-
console.log({activeUids}, 'active uids');
|
|
66
65
|
|
|
67
66
|
// this state occurs when agent_stop is successful, but
|
|
68
67
|
// user is still not disconnected from the RTC channel - state-of-wait
|
|
69
68
|
const isAwaitingLeave = agentConnectionState === AgentState.AWAITING_LEAVE;
|
|
70
|
-
console.log(
|
|
71
|
-
{isAwaitingLeave},
|
|
72
|
-
{connected},
|
|
73
|
-
'what is going on',
|
|
74
|
-
agentConnectionState,
|
|
75
|
-
);
|
|
76
69
|
useEffect(() => {
|
|
77
70
|
if (getLocalAudioStream()) {
|
|
78
71
|
setLocalTrack(getLocalAudioStream());
|
|
@@ -132,8 +132,6 @@ export const ConversationalAI: LayoutComponent = () => {
|
|
|
132
132
|
// save the app in a ref for later use
|
|
133
133
|
// spline.current = splineApp;
|
|
134
134
|
// sphere.current = splineApp.findObjectByName('Sphere');
|
|
135
|
-
// console.log('debugging animation main', spline.current);
|
|
136
|
-
// console.log('debugging animation sphere', sphere.current);
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
const isLoading =
|
|
@@ -26,17 +26,11 @@ export const DefaultAIOnly: LayoutComponent = () => {
|
|
|
26
26
|
const {getLocalAudioStream, getRemoteAudioStream} = useLocalAudio();
|
|
27
27
|
|
|
28
28
|
const connected = activeUids.includes(agentUID);
|
|
29
|
-
console.log({activeUids}, 'active uids');
|
|
30
29
|
|
|
31
30
|
// this state occurs when agent_stop is successful, but
|
|
32
31
|
// user is still not disconnected from the RTC channel - state-of-wait
|
|
33
32
|
const isAwaitingLeave = agentConnectionState === AgentState.AWAITING_LEAVE;
|
|
34
|
-
|
|
35
|
-
{isAwaitingLeave},
|
|
36
|
-
{connected},
|
|
37
|
-
'what is going on',
|
|
38
|
-
agentConnectionState,
|
|
39
|
-
);
|
|
33
|
+
|
|
40
34
|
useEffect(() => {
|
|
41
35
|
if (getLocalAudioStream()) {
|
|
42
36
|
setLocalTrack(getLocalAudioStream());
|
|
@@ -30,6 +30,7 @@ export interface StoreInterface {
|
|
|
30
30
|
>;
|
|
31
31
|
activeDeviceId: Record<MediaDeviceInfo['kind'], string>;
|
|
32
32
|
whiteboardNativeInfoToast?: boolean;
|
|
33
|
+
projectId: string;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface StorageContextInterface {
|
|
@@ -52,6 +53,7 @@ export const initStoreValue: StoreInterface = {
|
|
|
52
53
|
audiooutput: '',
|
|
53
54
|
videoinput: '',
|
|
54
55
|
},
|
|
56
|
+
projectId: $config.PROJECT_ID,
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
const initStorageContextValue = {
|
|
@@ -97,6 +99,13 @@ export const StorageProvider = (props: {children: React.ReactNode}) => {
|
|
|
97
99
|
if (!ENABLE_AUTH && !$config.ENABLE_CONVERSATIONAL_AI) {
|
|
98
100
|
storeFromStorage['token'] = null;
|
|
99
101
|
}
|
|
102
|
+
const projectId = $config.PROJECT_ID;
|
|
103
|
+
//if project id different then we should not use the previous session token.
|
|
104
|
+
//so setting into null and updating new project id
|
|
105
|
+
if (storeFromStorage['projectId'] !== projectId) {
|
|
106
|
+
storeFromStorage['token'] = null;
|
|
107
|
+
storeFromStorage['projectId'] = projectId;
|
|
108
|
+
}
|
|
100
109
|
storeFromStorage['whiteboardNativeInfoToast'] = false;
|
|
101
110
|
setStore(storeFromStorage);
|
|
102
111
|
logger.log(
|
|
@@ -133,6 +142,13 @@ export const StorageProvider = (props: {children: React.ReactNode}) => {
|
|
|
133
142
|
if (!ENABLE_AUTH && !$config.ENABLE_CONVERSATIONAL_AI) {
|
|
134
143
|
tempStore['token'] = null;
|
|
135
144
|
}
|
|
145
|
+
const projectId = $config.PROJECT_ID;
|
|
146
|
+
//if project id different then we should not use the previous session token.
|
|
147
|
+
//so setting into null and updating new project id
|
|
148
|
+
if (tempStore['projectId'] !== projectId) {
|
|
149
|
+
tempStore['token'] = null;
|
|
150
|
+
tempStore['projectId'] = projectId;
|
|
151
|
+
}
|
|
136
152
|
await AsyncStorage.setItem('store', JSON.stringify(tempStore));
|
|
137
153
|
logger.log(
|
|
138
154
|
LogSource.Internals,
|