agora-appbuilder-core 4.1.7-beta.5 → 4.1.7-beta.7
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/precall/joinWaitingRoomBtn.native.tsx +1 -1
- package/template/src/components/precall/joinWaitingRoomBtn.tsx +1 -1
- package/template/src/components/room-info/useRoomInfo.tsx +11 -15
- package/template/src/utils/useJoinRoom.ts +51 -206
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.7',
|
|
81
|
+
CORE_VERSION: '4.1.7-beta.7',
|
|
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
|
}
|
|
@@ -232,7 +232,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
232
232
|
const title = buttonText;
|
|
233
233
|
const onPress = () => onSubmit();
|
|
234
234
|
const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
|
|
235
|
-
? !hasHostJoined || isInWaitingRoom
|
|
235
|
+
? !hasHostJoined || isInWaitingRoom || username?.trim() === ''
|
|
236
236
|
: isInWaitingRoom || username?.trim() === '';
|
|
237
237
|
return props?.render ? (
|
|
238
238
|
props.render(onPress, title, disabled)
|
|
@@ -281,7 +281,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
281
281
|
const title = buttonText;
|
|
282
282
|
const onPress = () => onSubmit();
|
|
283
283
|
const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
|
|
284
|
-
? !hasHostJoined || isInWaitingRoom
|
|
284
|
+
? !hasHostJoined || isInWaitingRoom || username?.trim() === ''
|
|
285
285
|
: isInWaitingRoom || username?.trim() === '';
|
|
286
286
|
return props?.render ? (
|
|
287
287
|
props.render(onPress, title, disabled)
|
|
@@ -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
|
}
|
|
@@ -15,137 +15,7 @@ import isSDK from './isSDK';
|
|
|
15
15
|
import {AuthErrorCodes} from './common';
|
|
16
16
|
import SDKEvents from './SdkEvents';
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
query JoinChannel($passphrase: String!) {
|
|
20
|
-
joinChannel(passphrase: $passphrase) {
|
|
21
|
-
channel
|
|
22
|
-
title
|
|
23
|
-
isHost
|
|
24
|
-
secret
|
|
25
|
-
chat {
|
|
26
|
-
groupId
|
|
27
|
-
userToken
|
|
28
|
-
isGroupOwner
|
|
29
|
-
error {
|
|
30
|
-
code
|
|
31
|
-
message
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
secretSalt
|
|
35
|
-
mainUser {
|
|
36
|
-
rtc
|
|
37
|
-
rtm
|
|
38
|
-
uid
|
|
39
|
-
}
|
|
40
|
-
whiteboard {
|
|
41
|
-
room_uuid
|
|
42
|
-
room_token
|
|
43
|
-
error {
|
|
44
|
-
code
|
|
45
|
-
message
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
screenShare {
|
|
49
|
-
rtc
|
|
50
|
-
rtm
|
|
51
|
-
uid
|
|
52
|
-
}
|
|
53
|
-
agents {
|
|
54
|
-
id
|
|
55
|
-
is_active
|
|
56
|
-
config {
|
|
57
|
-
llm {
|
|
58
|
-
agent_name
|
|
59
|
-
model
|
|
60
|
-
prompt
|
|
61
|
-
}
|
|
62
|
-
vad {
|
|
63
|
-
threshold
|
|
64
|
-
}
|
|
65
|
-
asr_language
|
|
66
|
-
enable_aivad
|
|
67
|
-
tts {
|
|
68
|
-
vendor
|
|
69
|
-
params {
|
|
70
|
-
... on TtsVendorParamsMs {
|
|
71
|
-
voice_name
|
|
72
|
-
region
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
getUser {
|
|
80
|
-
name
|
|
81
|
-
email
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
`;
|
|
85
|
-
|
|
86
|
-
const JOIN_CHANNEL_PHRASE = gql`
|
|
87
|
-
query JoinChannel($passphrase: String!) {
|
|
88
|
-
joinChannel(passphrase: $passphrase) {
|
|
89
|
-
channel
|
|
90
|
-
title
|
|
91
|
-
isHost
|
|
92
|
-
secret
|
|
93
|
-
chat {
|
|
94
|
-
groupId
|
|
95
|
-
userToken
|
|
96
|
-
isGroupOwner
|
|
97
|
-
error {
|
|
98
|
-
code
|
|
99
|
-
message
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
secretSalt
|
|
103
|
-
mainUser {
|
|
104
|
-
rtc
|
|
105
|
-
rtm
|
|
106
|
-
uid
|
|
107
|
-
}
|
|
108
|
-
whiteboard {
|
|
109
|
-
room_uuid
|
|
110
|
-
room_token
|
|
111
|
-
error {
|
|
112
|
-
code
|
|
113
|
-
message
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
screenShare {
|
|
117
|
-
rtc
|
|
118
|
-
rtm
|
|
119
|
-
uid
|
|
120
|
-
}
|
|
121
|
-
agents {
|
|
122
|
-
id
|
|
123
|
-
is_active
|
|
124
|
-
config {
|
|
125
|
-
llm {
|
|
126
|
-
agent_name
|
|
127
|
-
model
|
|
128
|
-
prompt
|
|
129
|
-
}
|
|
130
|
-
vad {
|
|
131
|
-
threshold
|
|
132
|
-
}
|
|
133
|
-
asr_language
|
|
134
|
-
enable_aivad
|
|
135
|
-
tts {
|
|
136
|
-
vendor
|
|
137
|
-
params {
|
|
138
|
-
... on TtsVendorParamsMs {
|
|
139
|
-
voice_name
|
|
140
|
-
region
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`;
|
|
18
|
+
const JOIN_CHANNEL_URL = `${$config.BACKEND_ENDPOINT}/v1/channel/join`;
|
|
149
19
|
/**
|
|
150
20
|
* Returns an asynchronous function to join a meeting with the given phrase.
|
|
151
21
|
*/
|
|
@@ -165,8 +35,6 @@ export default function useJoinRoom() {
|
|
|
165
35
|
const {store} = useContext(StorageContext);
|
|
166
36
|
const {setRoomInfo} = useSetRoomInfo();
|
|
167
37
|
|
|
168
|
-
const {client} = useContext(GraphQLContext);
|
|
169
|
-
const username = useGetName();
|
|
170
38
|
const {request: requestToJoin} = useWaitingRoomAPI();
|
|
171
39
|
const isWaitingRoomEnabled = $config.ENABLE_WAITING_ROOM;
|
|
172
40
|
const chatErrorNoTokenText = useString(chatErrorNoToken)();
|
|
@@ -193,6 +61,7 @@ export default function useJoinRoom() {
|
|
|
193
61
|
send_event: false,
|
|
194
62
|
});
|
|
195
63
|
} else {
|
|
64
|
+
console.log('debugging store.token', store.token);
|
|
196
65
|
logger.log(
|
|
197
66
|
LogSource.NetworkRest,
|
|
198
67
|
'joinChannel',
|
|
@@ -202,22 +71,20 @@ export default function useJoinRoom() {
|
|
|
202
71
|
requestId,
|
|
203
72
|
},
|
|
204
73
|
);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
: JOIN_CHANNEL_PHRASE_AND_GET_USER,
|
|
216
|
-
variables: {
|
|
217
|
-
passphrase: phrase,
|
|
218
|
-
//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(),
|
|
219
84
|
},
|
|
85
|
+
body: payload,
|
|
220
86
|
});
|
|
87
|
+
response = await res.json();
|
|
221
88
|
}
|
|
222
89
|
const endReqTs = Date.now();
|
|
223
90
|
const latency = endReqTs - startReqTs;
|
|
@@ -245,8 +112,8 @@ export default function useJoinRoom() {
|
|
|
245
112
|
);
|
|
246
113
|
throw response.error;
|
|
247
114
|
} else {
|
|
248
|
-
if (
|
|
249
|
-
let data =
|
|
115
|
+
if (response) {
|
|
116
|
+
let data = response;
|
|
250
117
|
logger.log(
|
|
251
118
|
LogSource.NetworkRest,
|
|
252
119
|
`${isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'}`,
|
|
@@ -264,62 +131,53 @@ export default function useJoinRoom() {
|
|
|
264
131
|
);
|
|
265
132
|
let roomInfo: Partial<RoomInfoContextInterface['data']> = {};
|
|
266
133
|
|
|
267
|
-
if (data?.
|
|
134
|
+
if (data?.channel_name || data?.channel) {
|
|
268
135
|
roomInfo.channel = isWaitingRoomEnabled
|
|
269
136
|
? data.channel
|
|
270
|
-
: data.
|
|
137
|
+
: data.channel_name;
|
|
271
138
|
}
|
|
272
|
-
if (data?.
|
|
139
|
+
if (data?.main_user?.uid || data?.mainUser?.uid) {
|
|
273
140
|
roomInfo.uid = isWaitingRoomEnabled
|
|
274
141
|
? data.mainUser.uid
|
|
275
|
-
: data.
|
|
142
|
+
: data.main_user.uid;
|
|
276
143
|
}
|
|
277
|
-
if (data?.
|
|
144
|
+
if (data?.main_user?.rtc || data?.mainUser?.rtc) {
|
|
278
145
|
roomInfo.token = isWaitingRoomEnabled
|
|
279
146
|
? data.mainUser.rtc
|
|
280
|
-
: data.
|
|
147
|
+
: data.main_user.rtc;
|
|
281
148
|
}
|
|
282
|
-
if (data?.
|
|
149
|
+
if (data?.main_user?.rtm || data?.mainUser?.rtm) {
|
|
283
150
|
roomInfo.rtmToken = isWaitingRoomEnabled
|
|
284
151
|
? data.mainUser.rtm
|
|
285
|
-
: data.
|
|
152
|
+
: data.main_user.rtm;
|
|
286
153
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
: data.joinChannel.secret;
|
|
154
|
+
|
|
155
|
+
if (data?.secret) {
|
|
156
|
+
roomInfo.encryptionSecret = data.secret;
|
|
291
157
|
}
|
|
292
|
-
if (data?.
|
|
158
|
+
if (data?.secret_salt || data?.secretSalt) {
|
|
293
159
|
roomInfo.encryptionSecretSalt = base64ToUint8Array(
|
|
294
|
-
isWaitingRoomEnabled
|
|
295
|
-
? data.secretSalt
|
|
296
|
-
: data.joinChannel.secretSalt,
|
|
160
|
+
isWaitingRoomEnabled ? data.secretSalt : data.secret_salt,
|
|
297
161
|
) as Uint8Array;
|
|
298
162
|
}
|
|
299
|
-
if (data?.
|
|
163
|
+
if (data?.screen_share_user?.uid || data?.screenShare?.uid) {
|
|
300
164
|
roomInfo.screenShareUid = isWaitingRoomEnabled
|
|
301
165
|
? data.screenShare.uid
|
|
302
|
-
: data.
|
|
166
|
+
: data.screen_share_user.uid;
|
|
303
167
|
}
|
|
304
|
-
if (data?.
|
|
168
|
+
if (data?.screen_share_user?.rtc || data?.screenShare?.rtc) {
|
|
305
169
|
roomInfo.screenShareToken = isWaitingRoomEnabled
|
|
306
170
|
? data.screenShare.rtc
|
|
307
|
-
: data.
|
|
171
|
+
: data.screen_share_user.rtc;
|
|
308
172
|
}
|
|
309
173
|
|
|
310
|
-
if (data?.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
: data.joinChannel.mainUser.rtm;
|
|
314
|
-
}
|
|
315
|
-
if (data?.joinChannel?.chat || data?.chat) {
|
|
316
|
-
const chatData = isWaitingRoomEnabled
|
|
317
|
-
? data.chat
|
|
318
|
-
: data?.joinChannel?.chat;
|
|
174
|
+
if (data?.chat) {
|
|
175
|
+
const chatData = data.chat;
|
|
176
|
+
|
|
319
177
|
const hasError = chatData?.error?.code || chatData?.error?.message;
|
|
320
178
|
const missingUserToken = !(isWaitingRoomEnabled
|
|
321
179
|
? data.chat?.userToken
|
|
322
|
-
: data
|
|
180
|
+
: data.chat?.user_token);
|
|
323
181
|
if ($config.CHAT && (hasError || missingUserToken)) {
|
|
324
182
|
roomInfo.chat = {
|
|
325
183
|
user_token: '',
|
|
@@ -337,33 +195,28 @@ export default function useJoinRoom() {
|
|
|
337
195
|
} else {
|
|
338
196
|
const chat: RoomInfoContextInterface['data']['chat'] = {
|
|
339
197
|
user_token: isWaitingRoomEnabled
|
|
340
|
-
? data.chat
|
|
341
|
-
: data
|
|
198
|
+
? data.chat?.userToken
|
|
199
|
+
: data.chat?.user_token,
|
|
342
200
|
group_id: isWaitingRoomEnabled
|
|
343
|
-
? data.chat
|
|
344
|
-
: data
|
|
201
|
+
? data.chat?.groupId
|
|
202
|
+
: data.chat?.group_id,
|
|
345
203
|
is_group_owner: isWaitingRoomEnabled
|
|
346
|
-
? data.chat
|
|
347
|
-
: data
|
|
204
|
+
? data.chat?.isGroupOwner
|
|
205
|
+
: data.chat?.is_group_owner,
|
|
348
206
|
error: null,
|
|
349
207
|
};
|
|
350
208
|
roomInfo.chat = chat;
|
|
351
209
|
}
|
|
352
210
|
}
|
|
353
211
|
|
|
354
|
-
roomInfo.isHost = isWaitingRoomEnabled
|
|
355
|
-
? data.isHost
|
|
356
|
-
: data.joinChannel.isHost;
|
|
212
|
+
roomInfo.isHost = isWaitingRoomEnabled ? data.isHost : data.is_host;
|
|
357
213
|
|
|
358
214
|
if (data?.joinChannel?.title || data?.title) {
|
|
359
|
-
roomInfo.meetingTitle =
|
|
360
|
-
? data.title
|
|
361
|
-
: data.joinChannel.title;
|
|
215
|
+
roomInfo.meetingTitle = data.title;
|
|
362
216
|
}
|
|
363
|
-
if (data?.
|
|
364
|
-
const whiteboardData =
|
|
365
|
-
|
|
366
|
-
: data?.joinChannel?.whiteboard;
|
|
217
|
+
if (data?.whiteboard) {
|
|
218
|
+
const whiteboardData = data.whiteboard;
|
|
219
|
+
|
|
367
220
|
if (
|
|
368
221
|
$config.ENABLE_WHITEBOARD &&
|
|
369
222
|
(whiteboardData?.error?.code || whiteboardData?.error?.message)
|
|
@@ -379,12 +232,8 @@ export default function useJoinRoom() {
|
|
|
379
232
|
} else {
|
|
380
233
|
const whiteboard: RoomInfoContextInterface['data']['whiteboard'] =
|
|
381
234
|
{
|
|
382
|
-
room_token:
|
|
383
|
-
|
|
384
|
-
: data?.joinChannel?.whiteboard?.room_token,
|
|
385
|
-
room_uuid: isWaitingRoomEnabled
|
|
386
|
-
? data.whiteboard.room_uuid
|
|
387
|
-
: data?.joinChannel?.whiteboard?.room_uuid,
|
|
235
|
+
room_token: data.whiteboard?.room_token,
|
|
236
|
+
room_uuid: data.whiteboard?.room_uuid,
|
|
388
237
|
error: null,
|
|
389
238
|
};
|
|
390
239
|
if (whiteboard?.room_token && whiteboard?.room_uuid) {
|
|
@@ -395,13 +244,9 @@ export default function useJoinRoom() {
|
|
|
395
244
|
|
|
396
245
|
//set the ai agent data
|
|
397
246
|
if ($config.ENABLE_CONVERSATIONAL_AI) {
|
|
398
|
-
roomInfo.agents = data?.
|
|
247
|
+
roomInfo.agents = data?.agents;
|
|
399
248
|
}
|
|
400
249
|
|
|
401
|
-
//getUser is not available from backend
|
|
402
|
-
// if (data?.getUser?.name) {
|
|
403
|
-
// roomInfo.username = data.getUser.name;
|
|
404
|
-
// }
|
|
405
250
|
const validPreference =
|
|
406
251
|
preference && Object.keys(preference).length > 0;
|
|
407
252
|
setRoomInfo(prevState => {
|