agora-appbuilder-core 4.1.7-beta.4 → 4.1.7-beta.6
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/defaultConfig.js +2 -2
- package/template/src/ai-agent/components/AgentControls/AgentContext.tsx +1 -2
- package/template/src/ai-agent/components/CustomSettingsPanel.tsx +2 -3
- package/template/src/ai-agent/components/SelectAiAgent.tsx +1 -1
- package/template/src/ai-agent/components/SelectUserLanguage.tsx +1 -2
- package/template/src/ai-agent/components/UserPrompt.tsx +1 -1
- package/template/src/components/room-info/useRoomInfo.tsx +11 -15
- package/template/src/utils/useJoinRoom.ts +72 -223
package/package.json
CHANGED
|
@@ -77,8 +77,8 @@ const DefaultConfig = {
|
|
|
77
77
|
CHAT_ORG_NAME: '',
|
|
78
78
|
CHAT_APP_NAME: '',
|
|
79
79
|
CHAT_URL: '',
|
|
80
|
-
CLI_VERSION: '3.1.7-beta.
|
|
81
|
-
CORE_VERSION: '4.1.7-beta.
|
|
80
|
+
CLI_VERSION: '3.1.7-beta.6',
|
|
81
|
+
CORE_VERSION: '4.1.7-beta.6',
|
|
82
82
|
DISABLE_LANDSCAPE_MODE: false,
|
|
83
83
|
STT_AUTO_START: false,
|
|
84
84
|
CLOUD_RECORDING_AUTO_START: false,
|
|
@@ -276,8 +276,7 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
|
|
|
276
276
|
const params = {
|
|
277
277
|
agent_id: agentId,
|
|
278
278
|
prompt: prompt,
|
|
279
|
-
voice: agents?.find(a => a.id === agentId)?.
|
|
280
|
-
?.voice_name,
|
|
279
|
+
voice: agents?.find(a => a.id === agentId)?.tts?.params?.voice_name,
|
|
281
280
|
enable_interruption_handling: isInterruptionHandlingEnabled,
|
|
282
281
|
language: language,
|
|
283
282
|
};
|
|
@@ -70,8 +70,7 @@ const InfoSection = () => {
|
|
|
70
70
|
<View style={[styles.flex1, styles.alignEnd]}>
|
|
71
71
|
<Text style={[styles.infoRowValue]}>
|
|
72
72
|
{formatVoiceName(
|
|
73
|
-
agents?.find(a => a.id === agentId)?.
|
|
74
|
-
?.voice_name,
|
|
73
|
+
agents?.find(a => a.id === agentId)?.tts?.params?.voice_name,
|
|
75
74
|
)}
|
|
76
75
|
</Text>
|
|
77
76
|
</View>
|
|
@@ -129,7 +128,7 @@ const AdvancedSettings = () => {
|
|
|
129
128
|
agents?.length
|
|
130
129
|
) {
|
|
131
130
|
setIsInterruptionHandlingEnabled(
|
|
132
|
-
agents?.find(a => a?.id === agentId)?.
|
|
131
|
+
agents?.find(a => a?.id === agentId)?.enable_aivad,
|
|
133
132
|
);
|
|
134
133
|
}
|
|
135
134
|
}, [agentId, agents, isInterruptionHandlingEnabled]);
|
|
@@ -24,8 +24,7 @@ const SelectUserLanguage = () => {
|
|
|
24
24
|
if (!language && agentId && agents?.length) {
|
|
25
25
|
//@ts-ignore
|
|
26
26
|
setLanguage(
|
|
27
|
-
agents?.find((agent: any) => agent.id === agentId)?.
|
|
28
|
-
?.asr_language,
|
|
27
|
+
agents?.find((agent: any) => agent.id === agentId)?.asr_language,
|
|
29
28
|
);
|
|
30
29
|
} else if (language) {
|
|
31
30
|
setLanguage(language);
|
|
@@ -40,7 +40,7 @@ const UserPrompt = () => {
|
|
|
40
40
|
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (!prompt && agentId && agents?.length) {
|
|
43
|
-
setPrompt(agents?.find(a => a?.id === agentId)?.
|
|
43
|
+
setPrompt(agents?.find(a => a?.id === agentId)?.prompt);
|
|
44
44
|
} else if (prompt) {
|
|
45
45
|
setPrompt(prompt);
|
|
46
46
|
}
|
|
@@ -71,21 +71,17 @@ export interface RoomData {
|
|
|
71
71
|
export interface AIAgentInterface {
|
|
72
72
|
id: string;
|
|
73
73
|
is_active: boolean;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
key: string;
|
|
86
|
-
voice_name: string;
|
|
87
|
-
region: string;
|
|
88
|
-
};
|
|
74
|
+
agent_name: string;
|
|
75
|
+
model: string;
|
|
76
|
+
prompt: string;
|
|
77
|
+
enable_aivad?: boolean;
|
|
78
|
+
asr_language?: keyof typeof ASR_LANGUAGES;
|
|
79
|
+
tts: {
|
|
80
|
+
vendor: string;
|
|
81
|
+
params: {
|
|
82
|
+
key: string;
|
|
83
|
+
voice_name: string;
|
|
84
|
+
region: string;
|
|
89
85
|
};
|
|
90
86
|
};
|
|
91
87
|
}
|
|
@@ -9,142 +9,13 @@ import useWaitingRoomAPI from '../subComponents/waiting-rooms/useWaitingRoomAPI'
|
|
|
9
9
|
import {base64ToUint8Array} from '../utils';
|
|
10
10
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
11
11
|
import getUniqueID from './getUniqueID';
|
|
12
|
-
import {
|
|
13
|
-
chatErrorNoToken
|
|
14
|
-
} from '../language/default-labels/videoCallScreenLabels';
|
|
12
|
+
import {chatErrorNoToken} from '../language/default-labels/videoCallScreenLabels';
|
|
15
13
|
import {useString} from '../utils/useString';
|
|
14
|
+
import isSDK from './isSDK';
|
|
15
|
+
import {AuthErrorCodes} from './common';
|
|
16
|
+
import SDKEvents from './SdkEvents';
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
query JoinChannel($passphrase: String!) {
|
|
19
|
-
joinChannel(passphrase: $passphrase) {
|
|
20
|
-
channel
|
|
21
|
-
title
|
|
22
|
-
isHost
|
|
23
|
-
secret
|
|
24
|
-
chat {
|
|
25
|
-
groupId
|
|
26
|
-
userToken
|
|
27
|
-
isGroupOwner
|
|
28
|
-
error {
|
|
29
|
-
code
|
|
30
|
-
message
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
secretSalt
|
|
34
|
-
mainUser {
|
|
35
|
-
rtc
|
|
36
|
-
rtm
|
|
37
|
-
uid
|
|
38
|
-
}
|
|
39
|
-
whiteboard {
|
|
40
|
-
room_uuid
|
|
41
|
-
room_token
|
|
42
|
-
error {
|
|
43
|
-
code
|
|
44
|
-
message
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
screenShare {
|
|
48
|
-
rtc
|
|
49
|
-
rtm
|
|
50
|
-
uid
|
|
51
|
-
}
|
|
52
|
-
agents {
|
|
53
|
-
id
|
|
54
|
-
is_active
|
|
55
|
-
config {
|
|
56
|
-
llm {
|
|
57
|
-
agent_name
|
|
58
|
-
model
|
|
59
|
-
prompt
|
|
60
|
-
}
|
|
61
|
-
vad {
|
|
62
|
-
threshold
|
|
63
|
-
}
|
|
64
|
-
asr_language
|
|
65
|
-
enable_aivad
|
|
66
|
-
tts {
|
|
67
|
-
vendor
|
|
68
|
-
params {
|
|
69
|
-
... on TtsVendorParamsMs {
|
|
70
|
-
voice_name
|
|
71
|
-
region
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
getUser {
|
|
79
|
-
name
|
|
80
|
-
email
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
const JOIN_CHANNEL_PHRASE = gql`
|
|
86
|
-
query JoinChannel($passphrase: String!) {
|
|
87
|
-
joinChannel(passphrase: $passphrase) {
|
|
88
|
-
channel
|
|
89
|
-
title
|
|
90
|
-
isHost
|
|
91
|
-
secret
|
|
92
|
-
chat {
|
|
93
|
-
groupId
|
|
94
|
-
userToken
|
|
95
|
-
isGroupOwner
|
|
96
|
-
error {
|
|
97
|
-
code
|
|
98
|
-
message
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
secretSalt
|
|
102
|
-
mainUser {
|
|
103
|
-
rtc
|
|
104
|
-
rtm
|
|
105
|
-
uid
|
|
106
|
-
}
|
|
107
|
-
whiteboard {
|
|
108
|
-
room_uuid
|
|
109
|
-
room_token
|
|
110
|
-
error {
|
|
111
|
-
code
|
|
112
|
-
message
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
screenShare {
|
|
116
|
-
rtc
|
|
117
|
-
rtm
|
|
118
|
-
uid
|
|
119
|
-
}
|
|
120
|
-
agents {
|
|
121
|
-
id
|
|
122
|
-
is_active
|
|
123
|
-
config {
|
|
124
|
-
llm {
|
|
125
|
-
agent_name
|
|
126
|
-
model
|
|
127
|
-
prompt
|
|
128
|
-
}
|
|
129
|
-
vad {
|
|
130
|
-
threshold
|
|
131
|
-
}
|
|
132
|
-
asr_language
|
|
133
|
-
enable_aivad
|
|
134
|
-
tts {
|
|
135
|
-
vendor
|
|
136
|
-
params {
|
|
137
|
-
... on TtsVendorParamsMs {
|
|
138
|
-
voice_name
|
|
139
|
-
region
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
`;
|
|
18
|
+
const JOIN_CHANNEL_URL = `${$config.BACKEND_ENDPOINT}/v1/channel/join`;
|
|
148
19
|
/**
|
|
149
20
|
* Returns an asynchronous function to join a meeting with the given phrase.
|
|
150
21
|
*/
|
|
@@ -164,8 +35,6 @@ export default function useJoinRoom() {
|
|
|
164
35
|
const {store} = useContext(StorageContext);
|
|
165
36
|
const {setRoomInfo} = useSetRoomInfo();
|
|
166
37
|
|
|
167
|
-
const {client} = useContext(GraphQLContext);
|
|
168
|
-
const username = useGetName();
|
|
169
38
|
const {request: requestToJoin} = useWaitingRoomAPI();
|
|
170
39
|
const isWaitingRoomEnabled = $config.ENABLE_WAITING_ROOM;
|
|
171
40
|
const chatErrorNoTokenText = useString(chatErrorNoToken)();
|
|
@@ -192,6 +61,7 @@ export default function useJoinRoom() {
|
|
|
192
61
|
send_event: false,
|
|
193
62
|
});
|
|
194
63
|
} else {
|
|
64
|
+
console.log('debugging store.token', store.token);
|
|
195
65
|
logger.log(
|
|
196
66
|
LogSource.NetworkRest,
|
|
197
67
|
'joinChannel',
|
|
@@ -201,26 +71,30 @@ export default function useJoinRoom() {
|
|
|
201
71
|
requestId,
|
|
202
72
|
},
|
|
203
73
|
);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
: JOIN_CHANNEL_PHRASE_AND_GET_USER,
|
|
215
|
-
variables: {
|
|
216
|
-
passphrase: phrase,
|
|
217
|
-
//userName: username,
|
|
74
|
+
const payload = JSON.stringify({
|
|
75
|
+
passphrase: phrase,
|
|
76
|
+
});
|
|
77
|
+
const res = await fetch(`${JOIN_CHANNEL_URL}`, {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
authorization: store.token ? `Bearer ${store.token}` : '',
|
|
82
|
+
'X-Request-Id': requestId,
|
|
83
|
+
'X-Session-Id': logger.getSessionId(),
|
|
218
84
|
},
|
|
85
|
+
body: payload,
|
|
219
86
|
});
|
|
87
|
+
response = await res.json();
|
|
220
88
|
}
|
|
221
89
|
const endReqTs = Date.now();
|
|
222
90
|
const latency = endReqTs - startReqTs;
|
|
223
91
|
if (response?.error) {
|
|
92
|
+
if (isWaitingRoomEnabled) {
|
|
93
|
+
const errorCode = response?.error?.code;
|
|
94
|
+
if (AuthErrorCodes.indexOf(errorCode) !== -1 && isSDK()) {
|
|
95
|
+
SDKEvents.emit('unauthorized', response?.error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
224
98
|
logger.error(
|
|
225
99
|
LogSource.NetworkRest,
|
|
226
100
|
`${isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'}`,
|
|
@@ -238,8 +112,8 @@ export default function useJoinRoom() {
|
|
|
238
112
|
);
|
|
239
113
|
throw response.error;
|
|
240
114
|
} else {
|
|
241
|
-
if (
|
|
242
|
-
let data =
|
|
115
|
+
if (response) {
|
|
116
|
+
let data = response;
|
|
243
117
|
logger.log(
|
|
244
118
|
LogSource.NetworkRest,
|
|
245
119
|
`${isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'}`,
|
|
@@ -257,109 +131,92 @@ export default function useJoinRoom() {
|
|
|
257
131
|
);
|
|
258
132
|
let roomInfo: Partial<RoomInfoContextInterface['data']> = {};
|
|
259
133
|
|
|
260
|
-
if (data?.
|
|
134
|
+
if (data?.channel_name || data?.channel) {
|
|
261
135
|
roomInfo.channel = isWaitingRoomEnabled
|
|
262
136
|
? data.channel
|
|
263
|
-
: data.
|
|
137
|
+
: data.channel_name;
|
|
264
138
|
}
|
|
265
|
-
if (data?.
|
|
139
|
+
if (data?.main_user?.uid || data?.mainUser?.uid) {
|
|
266
140
|
roomInfo.uid = isWaitingRoomEnabled
|
|
267
141
|
? data.mainUser.uid
|
|
268
|
-
: data.
|
|
142
|
+
: data.main_user.uid;
|
|
269
143
|
}
|
|
270
|
-
if (data?.
|
|
144
|
+
if (data?.main_user?.rtc || data?.mainUser?.rtc) {
|
|
271
145
|
roomInfo.token = isWaitingRoomEnabled
|
|
272
146
|
? data.mainUser.rtc
|
|
273
|
-
: data.
|
|
147
|
+
: data.main_user.rtc;
|
|
274
148
|
}
|
|
275
|
-
if (data?.
|
|
149
|
+
if (data?.main_user?.rtm || data?.mainUser?.rtm) {
|
|
276
150
|
roomInfo.rtmToken = isWaitingRoomEnabled
|
|
277
151
|
? data.mainUser.rtm
|
|
278
|
-
: data.
|
|
152
|
+
: data.main_user.rtm;
|
|
279
153
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
: data.joinChannel.secret;
|
|
154
|
+
|
|
155
|
+
if (data?.secret) {
|
|
156
|
+
roomInfo.encryptionSecret = data.secret;
|
|
284
157
|
}
|
|
285
|
-
if (data?.
|
|
158
|
+
if (data?.secret_salt || data?.secretSalt) {
|
|
286
159
|
roomInfo.encryptionSecretSalt = base64ToUint8Array(
|
|
287
|
-
isWaitingRoomEnabled
|
|
288
|
-
? data.secretSalt
|
|
289
|
-
: data.joinChannel.secretSalt,
|
|
160
|
+
isWaitingRoomEnabled ? data.secretSalt : data.secret_salt,
|
|
290
161
|
) as Uint8Array;
|
|
291
162
|
}
|
|
292
|
-
if (data?.
|
|
163
|
+
if (data?.screen_share_user?.uid || data?.screenShare?.uid) {
|
|
293
164
|
roomInfo.screenShareUid = isWaitingRoomEnabled
|
|
294
165
|
? data.screenShare.uid
|
|
295
|
-
: data.
|
|
166
|
+
: data.screen_share_user.uid;
|
|
296
167
|
}
|
|
297
|
-
if (data?.
|
|
168
|
+
if (data?.screen_share_user?.rtc || data?.screenShare?.rtc) {
|
|
298
169
|
roomInfo.screenShareToken = isWaitingRoomEnabled
|
|
299
170
|
? data.screenShare.rtc
|
|
300
|
-
: data.
|
|
171
|
+
: data.screen_share_user.rtc;
|
|
301
172
|
}
|
|
302
173
|
|
|
303
|
-
if (data?.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
: data?.joinChannel?.chat;
|
|
312
|
-
const hasError = chatData?.error?.code || chatData?.error?.message;
|
|
313
|
-
const missingUserToken =
|
|
314
|
-
!(
|
|
315
|
-
isWaitingRoomEnabled
|
|
316
|
-
? data.chat?.userToken
|
|
317
|
-
: data?.joinChannel?.chat?.userToken
|
|
318
|
-
);
|
|
319
|
-
if (
|
|
320
|
-
$config.CHAT &&
|
|
321
|
-
(hasError || missingUserToken)
|
|
322
|
-
) {
|
|
174
|
+
if (data?.chat) {
|
|
175
|
+
const chatData = data.chat;
|
|
176
|
+
|
|
177
|
+
const hasError = chatData?.error?.code || chatData?.error?.message;
|
|
178
|
+
const missingUserToken = !(isWaitingRoomEnabled
|
|
179
|
+
? data.chat?.userToken
|
|
180
|
+
: data.chat?.user_token);
|
|
181
|
+
if ($config.CHAT && (hasError || missingUserToken)) {
|
|
323
182
|
roomInfo.chat = {
|
|
324
183
|
user_token: '',
|
|
325
184
|
group_id: '',
|
|
326
185
|
is_group_owner: false,
|
|
327
186
|
error: {
|
|
328
|
-
code:
|
|
329
|
-
|
|
330
|
-
|
|
187
|
+
code:
|
|
188
|
+
chatData?.error?.code ||
|
|
189
|
+
(missingUserToken ? 'NO_USER_TOKEN' : ''),
|
|
190
|
+
message:
|
|
191
|
+
chatData?.error?.message ||
|
|
192
|
+
(missingUserToken ? chatErrorNoTokenText : ''),
|
|
331
193
|
},
|
|
332
194
|
};
|
|
333
195
|
} else {
|
|
334
196
|
const chat: RoomInfoContextInterface['data']['chat'] = {
|
|
335
197
|
user_token: isWaitingRoomEnabled
|
|
336
|
-
? data.chat
|
|
337
|
-
: data
|
|
198
|
+
? data.chat?.userToken
|
|
199
|
+
: data.chat?.user_token,
|
|
338
200
|
group_id: isWaitingRoomEnabled
|
|
339
|
-
? data.chat
|
|
340
|
-
: data
|
|
201
|
+
? data.chat?.groupId
|
|
202
|
+
: data.chat?.group_id,
|
|
341
203
|
is_group_owner: isWaitingRoomEnabled
|
|
342
|
-
? data.chat
|
|
343
|
-
: data
|
|
344
|
-
error:
|
|
204
|
+
? data.chat?.isGroupOwner
|
|
205
|
+
: data.chat?.is_group_owner,
|
|
206
|
+
error: null,
|
|
345
207
|
};
|
|
346
208
|
roomInfo.chat = chat;
|
|
347
209
|
}
|
|
348
210
|
}
|
|
349
211
|
|
|
350
|
-
roomInfo.isHost = isWaitingRoomEnabled
|
|
351
|
-
? data.isHost
|
|
352
|
-
: data.joinChannel.isHost;
|
|
212
|
+
roomInfo.isHost = isWaitingRoomEnabled ? data.isHost : data.is_host;
|
|
353
213
|
|
|
354
214
|
if (data?.joinChannel?.title || data?.title) {
|
|
355
|
-
roomInfo.meetingTitle =
|
|
356
|
-
? data.title
|
|
357
|
-
: data.joinChannel.title;
|
|
215
|
+
roomInfo.meetingTitle = data.title;
|
|
358
216
|
}
|
|
359
|
-
if (data?.
|
|
360
|
-
const whiteboardData =
|
|
361
|
-
|
|
362
|
-
: data?.joinChannel?.whiteboard;
|
|
217
|
+
if (data?.whiteboard) {
|
|
218
|
+
const whiteboardData = data.whiteboard;
|
|
219
|
+
|
|
363
220
|
if (
|
|
364
221
|
$config.ENABLE_WHITEBOARD &&
|
|
365
222
|
(whiteboardData?.error?.code || whiteboardData?.error?.message)
|
|
@@ -375,12 +232,8 @@ export default function useJoinRoom() {
|
|
|
375
232
|
} else {
|
|
376
233
|
const whiteboard: RoomInfoContextInterface['data']['whiteboard'] =
|
|
377
234
|
{
|
|
378
|
-
room_token:
|
|
379
|
-
|
|
380
|
-
: data?.joinChannel?.whiteboard?.room_token,
|
|
381
|
-
room_uuid: isWaitingRoomEnabled
|
|
382
|
-
? data.whiteboard.room_uuid
|
|
383
|
-
: data?.joinChannel?.whiteboard?.room_uuid,
|
|
235
|
+
room_token: data.whiteboard?.room_token,
|
|
236
|
+
room_uuid: data.whiteboard?.room_uuid,
|
|
384
237
|
error: null,
|
|
385
238
|
};
|
|
386
239
|
if (whiteboard?.room_token && whiteboard?.room_uuid) {
|
|
@@ -391,13 +244,9 @@ export default function useJoinRoom() {
|
|
|
391
244
|
|
|
392
245
|
//set the ai agent data
|
|
393
246
|
if ($config.ENABLE_CONVERSATIONAL_AI) {
|
|
394
|
-
roomInfo.agents = data?.
|
|
247
|
+
roomInfo.agents = data?.agents;
|
|
395
248
|
}
|
|
396
249
|
|
|
397
|
-
//getUser is not available from backend
|
|
398
|
-
// if (data?.getUser?.name) {
|
|
399
|
-
// roomInfo.username = data.getUser.name;
|
|
400
|
-
// }
|
|
401
250
|
const validPreference =
|
|
402
251
|
preference && Object.keys(preference).length > 0;
|
|
403
252
|
setRoomInfo(prevState => {
|