agora-appbuilder-core 4.1.0-beta-2 → 4.1.0-beta-3
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/customization-api/atoms.ts +1 -0
- package/template/customization-api/sub-components.ts +2 -0
- package/template/src/ai-agent/components/AgentControls/AgentContext.tsx +16 -1
- package/template/src/ai-agent/components/AgentControls/const.ts +38 -5
- package/template/src/ai-agent/components/AgentControls/index.tsx +40 -23
- package/template/src/ai-agent/components/AudioVisualizer.tsx +32 -20
- package/template/src/ai-agent/components/Bottombar.tsx +113 -48
- package/template/src/ai-agent/components/{CustomSidePanel.tsx → CustomChatPanel.tsx} +3 -3
- package/template/src/ai-agent/components/CustomCreate.tsx +7 -185
- package/template/src/ai-agent/components/CustomSettingsPanel.tsx +155 -0
- package/template/src/ai-agent/components/SelectAiAgent.tsx +71 -0
- package/template/src/ai-agent/components/SelectAiAgentVoice.tsx +68 -0
- package/template/src/ai-agent/components/agent-chat-panel/agent-chat-ui.tsx +3 -3
- package/template/src/ai-agent/components/mobile/MobileLayoutComponent.tsx +1 -1
- package/template/src/ai-agent/components/mobile/Topbar.tsx +10 -26
- package/template/src/ai-agent/index.tsx +48 -199
- package/template/src/atoms/Dropdown.tsx +1 -1
- package/template/src/components/SettingsView.tsx +7 -3
- package/template/src/components/room-info/useRoomInfo.tsx +10 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +18 -3
- package/template/src/subComponents/FallbackLogo.tsx +1 -3
- package/template/src/subComponents/SelectDevice.tsx +7 -7
- package/template/src/subComponents/SidePanelHeader.tsx +2 -2
- package/template/src/utils/useJoinRoom.ts +6 -0
- package/template/src/ai-agent/components/CustomCreateNative.tsx +0 -265
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import React, {useEffect, useState
|
|
2
|
-
import {View, Text, StyleSheet, TouchableOpacity} from 'react-native';
|
|
1
|
+
import React, {useEffect, useState} from 'react';
|
|
3
2
|
import {
|
|
4
3
|
useRoomInfo,
|
|
5
4
|
useCreateRoom,
|
|
6
|
-
useHistory,
|
|
7
5
|
Toast,
|
|
8
6
|
isWebInternal,
|
|
9
7
|
trimText,
|
|
10
8
|
useString,
|
|
11
|
-
Spacer,
|
|
12
9
|
useSetRoomInfo,
|
|
13
10
|
isSDK,
|
|
14
11
|
useStorageContext,
|
|
15
12
|
useErrorContext,
|
|
16
13
|
RoomInfoDefaultValue,
|
|
14
|
+
Loading,
|
|
17
15
|
} from 'customization-api';
|
|
18
16
|
import {Redirect} from '../../components/Router';
|
|
19
|
-
import ThemeConfig from '../../theme';
|
|
20
|
-
import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
|
|
21
|
-
import {AgoraLogo, AgoraOpenAILogo, OpenAILogo, CallIcon} from './icons';
|
|
22
|
-
import {AgentContext} from './AgentControls/AgentContext';
|
|
23
17
|
|
|
24
18
|
const CustomCreate = () => {
|
|
25
19
|
const {
|
|
@@ -28,16 +22,11 @@ const CustomCreate = () => {
|
|
|
28
22
|
},
|
|
29
23
|
} = useRoomInfo();
|
|
30
24
|
const {setGlobalErrorMessage} = useErrorContext();
|
|
31
|
-
const [loading, setLoading] = useState(false);
|
|
32
25
|
const [roomTitle, onChangeRoomTitle] = useState('');
|
|
33
26
|
const [roomCreated, setRoomCreated] = useState(false);
|
|
34
27
|
const createRoomFun = useCreateRoom();
|
|
35
28
|
const {setRoomInfo} = useSetRoomInfo();
|
|
36
29
|
const {setStore} = useStorageContext();
|
|
37
|
-
const loadingText = useString('loadingText')();
|
|
38
|
-
const history = useHistory();
|
|
39
|
-
|
|
40
|
-
const {agentAuthToken} = useContext(AgentContext);
|
|
41
30
|
|
|
42
31
|
useEffect(() => {
|
|
43
32
|
if (isWebInternal() && !isSDK) {
|
|
@@ -70,32 +59,18 @@ const CustomCreate = () => {
|
|
|
70
59
|
onChangeRoomTitle(generateChannelId);
|
|
71
60
|
}, []);
|
|
72
61
|
|
|
73
|
-
// useEffect( () => {
|
|
74
|
-
// // to check if user logged in quer param
|
|
75
|
-
// const queryParams = new URLSearchParams(window.location.search);
|
|
76
|
-
// if (queryParams.get('auth') === 'success' && roomTitle != '') {
|
|
77
|
-
// createRoomAndNavigateToShare(
|
|
78
|
-
// roomTitle?.trim(),
|
|
79
|
-
// false,
|
|
80
|
-
// false
|
|
81
|
-
// );
|
|
82
|
-
// }
|
|
83
|
-
// },[roomTitle])
|
|
84
|
-
|
|
85
62
|
const createRoomAndNavigateToShare = async (
|
|
86
63
|
roomTitle: string,
|
|
87
64
|
enablePSTN: boolean,
|
|
88
65
|
isSeparateHostLink: boolean,
|
|
89
66
|
) => {
|
|
90
67
|
if (roomTitle !== '') {
|
|
91
|
-
setLoading(true);
|
|
92
68
|
try {
|
|
93
69
|
setRoomInfo(RoomInfoDefaultValue);
|
|
94
70
|
//@ts-ignore
|
|
95
71
|
//isSeparateHostLink will be for internal usage since backend integration is not there
|
|
96
72
|
await createRoomFun(roomTitle, enablePSTN, isSeparateHostLink);
|
|
97
73
|
|
|
98
|
-
setLoading(false);
|
|
99
74
|
Toast.show({
|
|
100
75
|
leadingIconName: 'tick-fill',
|
|
101
76
|
type: 'success',
|
|
@@ -108,7 +83,6 @@ const CustomCreate = () => {
|
|
|
108
83
|
});
|
|
109
84
|
setRoomCreated(true);
|
|
110
85
|
} catch (error) {
|
|
111
|
-
setLoading(false);
|
|
112
86
|
setGlobalErrorMessage({
|
|
113
87
|
name: 'Unable to join channel',
|
|
114
88
|
message: error.message,
|
|
@@ -116,164 +90,12 @@ const CustomCreate = () => {
|
|
|
116
90
|
}
|
|
117
91
|
}
|
|
118
92
|
};
|
|
119
|
-
const showError = () => {
|
|
120
|
-
Toast.show({
|
|
121
|
-
leadingIconName: 'alert',
|
|
122
|
-
type: 'error',
|
|
123
|
-
text1: 'Backend endpoint not configured',
|
|
124
|
-
text2: 'Please configure backend endpoint config.json',
|
|
125
|
-
visibilityTime: 1000 * 10,
|
|
126
|
-
primaryBtn: null,
|
|
127
|
-
secondaryBtn: null,
|
|
128
|
-
leadingIcon: null,
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
93
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<View style={style.root}>
|
|
136
|
-
<View style={style.topLogoContainer}>
|
|
137
|
-
<View style={{paddingTop: 14}}>
|
|
138
|
-
<AgoraLogo />
|
|
139
|
-
</View>
|
|
140
|
-
<View>
|
|
141
|
-
<OpenAILogo />
|
|
142
|
-
</View>
|
|
143
|
-
</View>
|
|
144
|
-
<View
|
|
145
|
-
style={{
|
|
146
|
-
width: 490,
|
|
147
|
-
marginTop: 90,
|
|
148
|
-
display: 'flex',
|
|
149
|
-
flexDirection: 'column',
|
|
150
|
-
justifyContent: 'center',
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
}}>
|
|
153
|
-
<View style={style.centerLogoContainer}>
|
|
154
|
-
<View style={{padding: 20}}>
|
|
155
|
-
<AgoraOpenAILogo />
|
|
156
|
-
</View>
|
|
157
|
-
<Text style={style.mainTextStyle}>Agora & Conversational AI</Text>
|
|
158
|
-
<Spacer size={20} />
|
|
159
|
-
<Text style={style.subTextStyle}>
|
|
160
|
-
AI Builder Conversational AI demo
|
|
161
|
-
</Text>
|
|
162
|
-
</View>
|
|
163
|
-
<Spacer size={20} />
|
|
164
|
-
<TouchableOpacity
|
|
165
|
-
disabled={loading || !roomTitle?.trim()}
|
|
166
|
-
style={style.btnContainer}
|
|
167
|
-
onPress={() => {
|
|
168
|
-
const queryParams = new URLSearchParams(window.location.search);
|
|
169
|
-
if (!$config.BACKEND_ENDPOINT) {
|
|
170
|
-
showError();
|
|
171
|
-
} else {
|
|
172
|
-
// handleSSOLogin()
|
|
173
|
-
//history.push('/login')
|
|
174
|
-
createRoomAndNavigateToShare(roomTitle?.trim(), false, false);
|
|
175
|
-
}
|
|
176
|
-
}}>
|
|
177
|
-
<CallIcon fill="#111111" />
|
|
178
|
-
<Text
|
|
179
|
-
style={{
|
|
180
|
-
textAlign: 'center',
|
|
181
|
-
fontSize: 18,
|
|
182
|
-
fontStyle: 'normal',
|
|
183
|
-
fontWeight: '600',
|
|
184
|
-
lineHeight: 18,
|
|
185
|
-
}}>
|
|
186
|
-
{loading ? loadingText : 'Sign in to Join Call'}
|
|
187
|
-
</Text>
|
|
188
|
-
</TouchableOpacity>
|
|
189
|
-
</View>
|
|
190
|
-
</View>
|
|
191
|
-
) : (
|
|
192
|
-
<Redirect to={host} />
|
|
193
|
-
)}
|
|
194
|
-
</>
|
|
195
|
-
);
|
|
196
|
-
};
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
createRoomAndNavigateToShare(roomTitle?.trim(), false, false);
|
|
96
|
+
}, [roomTitle]);
|
|
197
97
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
display: 'flex',
|
|
201
|
-
flex: 1,
|
|
202
|
-
flexDirection: 'column',
|
|
203
|
-
padding: 20,
|
|
204
|
-
alignItems: 'center',
|
|
205
|
-
gap: 20,
|
|
206
|
-
backgroundColor: '#111',
|
|
207
|
-
borderRadius: 20,
|
|
208
|
-
},
|
|
209
|
-
mainMobile: {
|
|
210
|
-
paddingBottom: 80,
|
|
211
|
-
paddingTop: 66,
|
|
212
|
-
flex: 1,
|
|
213
|
-
},
|
|
214
|
-
mobileContainerStyle: {
|
|
215
|
-
backgroundColor: 'transparent',
|
|
216
|
-
flex: 1,
|
|
217
|
-
paddingBottom: 0,
|
|
218
|
-
paddingTop: 0,
|
|
219
|
-
},
|
|
220
|
-
btnContainer: {
|
|
221
|
-
width: '100%',
|
|
222
|
-
alignItems: 'center',
|
|
223
|
-
display: 'flex',
|
|
224
|
-
flexDirection: 'row',
|
|
225
|
-
height: 56,
|
|
226
|
-
padding: 20,
|
|
227
|
-
justifyContent: 'center',
|
|
228
|
-
alignContent: 'center',
|
|
229
|
-
gap: 8,
|
|
230
|
-
borderRadius: 4,
|
|
231
|
-
backgroundColor: '#00C2FF',
|
|
232
|
-
},
|
|
233
|
-
separator: {
|
|
234
|
-
height: 1,
|
|
235
|
-
},
|
|
236
|
-
topLogoContainer: {
|
|
237
|
-
paddingVertical: 20,
|
|
238
|
-
paddingHorizontal: 32,
|
|
239
|
-
display: 'flex',
|
|
240
|
-
width: 'auto',
|
|
241
|
-
flexDirection: 'row',
|
|
242
|
-
height: 60,
|
|
243
|
-
justifyContent: 'center',
|
|
244
|
-
alignItems: 'center',
|
|
245
|
-
gap: 20,
|
|
246
|
-
flexShrink: 0,
|
|
247
|
-
alignSelf: 'stretch',
|
|
248
|
-
},
|
|
249
|
-
centerLogoContainer: {
|
|
250
|
-
padding: 40,
|
|
251
|
-
display: 'flex',
|
|
252
|
-
paddingHorizontal: 8,
|
|
253
|
-
flexFirection: 'column',
|
|
254
|
-
justifyContent: 'center',
|
|
255
|
-
alignItems: 'center',
|
|
256
|
-
alignSelf: 'stretch',
|
|
257
|
-
},
|
|
258
|
-
mainTextStyle: {
|
|
259
|
-
color: '#FFF',
|
|
260
|
-
textAlign: 'center',
|
|
261
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
262
|
-
fontSize: 40,
|
|
263
|
-
fontStyle: 'normal',
|
|
264
|
-
fontWeight: '600',
|
|
265
|
-
lineHeight: 40,
|
|
266
|
-
letterSpacing: 1,
|
|
267
|
-
},
|
|
268
|
-
subTextStyle: {
|
|
269
|
-
color: '#FFFFFF' + hexadecimalTransparency['70%'],
|
|
270
|
-
textAlign: 'center',
|
|
271
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
272
|
-
fontSize: 18,
|
|
273
|
-
fontStyle: 'normal',
|
|
274
|
-
fontWeight: '400',
|
|
275
|
-
lineHeight: 21.6,
|
|
276
|
-
},
|
|
277
|
-
});
|
|
98
|
+
return <>{!roomCreated ? <Loading text="" /> : <Redirect to={host} />}</>;
|
|
99
|
+
};
|
|
278
100
|
|
|
279
101
|
export default CustomCreate;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {StyleSheet, View, ScrollView, Text} from 'react-native';
|
|
2
|
+
import React, {useContext} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
SelectDevice,
|
|
5
|
+
Spacer,
|
|
6
|
+
$config,
|
|
7
|
+
EditName,
|
|
8
|
+
useRoomInfo,
|
|
9
|
+
} from 'customization-api';
|
|
10
|
+
import SelectAiAgent from './SelectAiAgent';
|
|
11
|
+
import SelectAiAgentVoice from './SelectAiAgentVoice';
|
|
12
|
+
import ThemeConfig from '../../theme';
|
|
13
|
+
import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
|
|
14
|
+
import {AgentContext} from './AgentControls/AgentContext';
|
|
15
|
+
|
|
16
|
+
const InfoSection = () => {
|
|
17
|
+
const {agentConnectionState} = useContext(AgentContext);
|
|
18
|
+
const {
|
|
19
|
+
data: {roomId, uid},
|
|
20
|
+
} = useRoomInfo();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View style={styles.sectionContainer}>
|
|
24
|
+
<Text style={styles.sectionTitle}>INFO</Text>
|
|
25
|
+
<Spacer size={12} />
|
|
26
|
+
<View style={styles.infoRowContainer}>
|
|
27
|
+
<View style={styles.flex1}>
|
|
28
|
+
<Text style={styles.infoRowLabel}>Agent Status</Text>
|
|
29
|
+
</View>
|
|
30
|
+
<View style={[styles.flex1, styles.alignEnd]}>
|
|
31
|
+
<Text
|
|
32
|
+
style={[
|
|
33
|
+
styles.infoRowValue,
|
|
34
|
+
{
|
|
35
|
+
color:
|
|
36
|
+
agentConnectionState === 'AGENT_CONNECTED'
|
|
37
|
+
? $config.SEMANTIC_SUCCESS
|
|
38
|
+
: $config.SEMANTIC_WARNING,
|
|
39
|
+
},
|
|
40
|
+
]}>
|
|
41
|
+
{agentConnectionState === 'AGENT_CONNECTED'
|
|
42
|
+
? 'Connected'
|
|
43
|
+
: 'Not Connected'}
|
|
44
|
+
</Text>
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
<View style={styles.infoRowContainer}>
|
|
48
|
+
<View style={styles.flex1}>
|
|
49
|
+
<Text style={styles.infoRowLabel}>Room Status</Text>
|
|
50
|
+
</View>
|
|
51
|
+
<View style={[styles.flex1, styles.alignEnd]}>
|
|
52
|
+
<Text
|
|
53
|
+
style={[styles.infoRowLabel, {color: $config.SEMANTIC_SUCCESS}]}>
|
|
54
|
+
{'Connected'}
|
|
55
|
+
</Text>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
<View style={styles.infoRowContainer}>
|
|
59
|
+
<View style={styles.flex1}>
|
|
60
|
+
<Text style={styles.infoRowLabel}>Room-ID</Text>
|
|
61
|
+
</View>
|
|
62
|
+
<View style={[styles.flex1, styles.alignEnd]}>
|
|
63
|
+
<Text style={styles.infoRowLabel}>{roomId?.host}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
<View style={styles.infoRowContainer}>
|
|
67
|
+
<View style={styles.flex1}>
|
|
68
|
+
<Text style={styles.infoRowLabel}>Your-ID</Text>
|
|
69
|
+
</View>
|
|
70
|
+
<View style={[styles.flex1, styles.alignEnd]}>
|
|
71
|
+
<Text style={styles.infoRowLabel}>{uid}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const CustomSettingsPanel = () => {
|
|
79
|
+
return (
|
|
80
|
+
<View style={styles.container}>
|
|
81
|
+
<ScrollView style={styles.contentContainer}>
|
|
82
|
+
<View style={styles.sectionContainer}>
|
|
83
|
+
<Text style={styles.sectionTitle}>AI AGENT</Text>
|
|
84
|
+
<Spacer size={12} />
|
|
85
|
+
<SelectAiAgent />
|
|
86
|
+
<Spacer size={12} />
|
|
87
|
+
<SelectAiAgentVoice />
|
|
88
|
+
</View>
|
|
89
|
+
<Spacer size={24} />
|
|
90
|
+
<InfoSection />
|
|
91
|
+
<Spacer size={24} />
|
|
92
|
+
<View style={styles.sectionContainer}>
|
|
93
|
+
<Text style={styles.sectionTitle}>CALL SETTINGS</Text>
|
|
94
|
+
<Spacer size={12} />
|
|
95
|
+
<EditName label="Joining as" />
|
|
96
|
+
<SelectDevice />
|
|
97
|
+
</View>
|
|
98
|
+
</ScrollView>
|
|
99
|
+
</View>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default CustomSettingsPanel;
|
|
104
|
+
|
|
105
|
+
const styles = StyleSheet.create({
|
|
106
|
+
container: {
|
|
107
|
+
flex: 1,
|
|
108
|
+
display: 'flex',
|
|
109
|
+
height: '100%',
|
|
110
|
+
},
|
|
111
|
+
contentContainer: {
|
|
112
|
+
padding: 16,
|
|
113
|
+
backgroundColor: $config.CARD_LAYER_1_COLOR,
|
|
114
|
+
},
|
|
115
|
+
sectionContainer: {
|
|
116
|
+
padding: 16,
|
|
117
|
+
borderRadius: 8,
|
|
118
|
+
borderWidth: 1,
|
|
119
|
+
borderColor: $config.CARD_LAYER_3_COLOR,
|
|
120
|
+
},
|
|
121
|
+
sectionTitle: {
|
|
122
|
+
fontSize: 12,
|
|
123
|
+
fontWeight: '600',
|
|
124
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
125
|
+
fontStyle: 'normal',
|
|
126
|
+
lineHeight: 12,
|
|
127
|
+
color: $config.FONT_COLOR + hexadecimalTransparency['40%'],
|
|
128
|
+
},
|
|
129
|
+
infoRowContainer: {
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
marginBottom: 20,
|
|
133
|
+
flex: 2,
|
|
134
|
+
},
|
|
135
|
+
flex1: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
},
|
|
138
|
+
alignEnd: {
|
|
139
|
+
alignItems: 'flex-end',
|
|
140
|
+
},
|
|
141
|
+
infoRowLabel: {
|
|
142
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
143
|
+
fontSize: 14,
|
|
144
|
+
lineHeight: 14,
|
|
145
|
+
fontWeight: '600',
|
|
146
|
+
color: $config.FONT_COLOR,
|
|
147
|
+
},
|
|
148
|
+
infoRowValue: {
|
|
149
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
150
|
+
fontSize: 14,
|
|
151
|
+
lineHeight: 14,
|
|
152
|
+
fontWeight: '400',
|
|
153
|
+
color: $config.FONT_COLOR,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, {useContext, useEffect, useMemo} from 'react';
|
|
2
|
+
import {View, Text, StyleSheet} from 'react-native';
|
|
3
|
+
import {Dropdown, useRoomInfo, Spacer} from 'customization-api';
|
|
4
|
+
import ThemeConfig from '../../theme';
|
|
5
|
+
import {AgentContext} from './AgentControls/AgentContext';
|
|
6
|
+
|
|
7
|
+
const SelectAiAgent = () => {
|
|
8
|
+
const {
|
|
9
|
+
data: {agents},
|
|
10
|
+
} = useRoomInfo();
|
|
11
|
+
|
|
12
|
+
const {agentId, setAgentId} = useContext(AgentContext);
|
|
13
|
+
|
|
14
|
+
const data = useMemo(() => {
|
|
15
|
+
return agents?.map((agent: any) => {
|
|
16
|
+
return {
|
|
17
|
+
label: agent.agent_name,
|
|
18
|
+
value: agent.id,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}, [agents]);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!agentId && data && data.length) {
|
|
25
|
+
//set default agent
|
|
26
|
+
setAgentId(data[0].value);
|
|
27
|
+
}
|
|
28
|
+
}, [agentId, data]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View>
|
|
32
|
+
<Text style={style.label}>{'Choose your AI Agent'}</Text>
|
|
33
|
+
<Spacer size={12} />
|
|
34
|
+
<Dropdown
|
|
35
|
+
icon={undefined}
|
|
36
|
+
enabled={
|
|
37
|
+
$config.ENABLE_CONVERSATIONAL_AI && data && data.length ? true : false
|
|
38
|
+
}
|
|
39
|
+
//@ts-ignore
|
|
40
|
+
selectedValue={agentId}
|
|
41
|
+
label={
|
|
42
|
+
!data || !data.length
|
|
43
|
+
? 'No AI Agent available'
|
|
44
|
+
: !agentId
|
|
45
|
+
? 'Select AI Agent'
|
|
46
|
+
: data.find(d => d.value === agentId)?.label
|
|
47
|
+
}
|
|
48
|
+
data={data}
|
|
49
|
+
onSelect={({label, value}) => {
|
|
50
|
+
console.log('Selected AI Agent:', label, value);
|
|
51
|
+
//@ts-ignore
|
|
52
|
+
if (agentId !== value) {
|
|
53
|
+
//@ts-ignore
|
|
54
|
+
setAgentId(value);
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const style = StyleSheet.create({
|
|
63
|
+
label: {
|
|
64
|
+
fontWeight: '600',
|
|
65
|
+
fontSize: ThemeConfig.FontSize.small,
|
|
66
|
+
lineHeight: 16,
|
|
67
|
+
color: $config.FONT_COLOR,
|
|
68
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
export default SelectAiAgent;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, {useContext, useEffect} from 'react';
|
|
2
|
+
import {View, Text, StyleSheet} from 'react-native';
|
|
3
|
+
import {Dropdown, Spacer, useRoomInfo} from 'customization-api';
|
|
4
|
+
import ThemeConfig from '../../theme';
|
|
5
|
+
import {AgentContext} from './AgentControls/AgentContext';
|
|
6
|
+
import {AI_AGENT_VOICE} from './AgentControls/const';
|
|
7
|
+
|
|
8
|
+
const SelectAiAgentVoice = () => {
|
|
9
|
+
const {
|
|
10
|
+
data: {agents},
|
|
11
|
+
} = useRoomInfo();
|
|
12
|
+
|
|
13
|
+
const {agentId, setAgentVoice, agentVoice} = useContext(AgentContext);
|
|
14
|
+
|
|
15
|
+
const data = Object.keys(AI_AGENT_VOICE).map((key: string) => {
|
|
16
|
+
return {
|
|
17
|
+
label: key,
|
|
18
|
+
value: key,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (agentId && !agentVoice) {
|
|
24
|
+
//@ts-ignore
|
|
25
|
+
setAgentVoice(agents.find((agent: any) => agent.id === agentId)?.voice);
|
|
26
|
+
}
|
|
27
|
+
}, [agentId]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View>
|
|
31
|
+
<Text style={style.label}>{'Voice'}</Text>
|
|
32
|
+
<Spacer size={12} />
|
|
33
|
+
<Dropdown
|
|
34
|
+
icon={undefined}
|
|
35
|
+
enabled={$config.ENABLE_CONVERSATIONAL_AI}
|
|
36
|
+
//@ts-ignore
|
|
37
|
+
selectedValue={agentVoice}
|
|
38
|
+
label={
|
|
39
|
+
!data || !data.length
|
|
40
|
+
? 'No AI Agent Voice Available'
|
|
41
|
+
: !agentVoice
|
|
42
|
+
? 'Select AI Agent Voice'
|
|
43
|
+
: AI_AGENT_VOICE[agentVoice]
|
|
44
|
+
}
|
|
45
|
+
data={data}
|
|
46
|
+
onSelect={({label, value}) => {
|
|
47
|
+
console.log('Selected AI Agent Voice:', label, value);
|
|
48
|
+
//@ts-ignore
|
|
49
|
+
if (agentVoice !== value) {
|
|
50
|
+
//@ts-ignore
|
|
51
|
+
setAgentVoice(value);
|
|
52
|
+
}
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const style = StyleSheet.create({
|
|
60
|
+
label: {
|
|
61
|
+
fontWeight: '400',
|
|
62
|
+
fontSize: ThemeConfig.FontSize.small,
|
|
63
|
+
lineHeight: 16,
|
|
64
|
+
color: $config.FONT_COLOR,
|
|
65
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
export default SelectAiAgentVoice;
|
|
@@ -11,15 +11,15 @@ const ChatItemBubble = ({item}: {item: ChatItem}) => {
|
|
|
11
11
|
msgId={item.id}
|
|
12
12
|
isLocal={item.isSelf}
|
|
13
13
|
message={item.text}
|
|
14
|
-
createdTimestamp={
|
|
14
|
+
createdTimestamp={item.time}
|
|
15
15
|
uid={item.uid}
|
|
16
16
|
isDeleted={false}
|
|
17
17
|
isSameUser={false}
|
|
18
18
|
type={ChatMessageType.TXT}
|
|
19
19
|
remoteUIConfig={{
|
|
20
20
|
username: 'AI Agent',
|
|
21
|
-
avatarIcon:
|
|
22
|
-
|
|
21
|
+
// avatarIcon:
|
|
22
|
+
// 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik01LjAyMTQ4IDYuNjgxMzZDNS4wMjE0OCA2LjgwMDg5IDUuMTEwNDkgNi45MDE3MiA1LjIyOTE0IDYuOTE2NThDNS4yMzE4IDYuOTE2ODkgNS41MDQ2MyA2Ljk1NDY5IDUuNzkwMjQgNy4xMjI3MkM2LjE2OTIxIDcuMzQ1NjEgNi4zODk3IDcuNjg1NTggNi40NDU2NSA4LjEzMzA4QzYuNDYwNSA4LjI1MTczIDYuNTYxMzMgOC4zNDA3NCA2LjY4MDg3IDguMzQwNzRDNi44MDA0MSA4LjM0MDc0IDYuOTAxMjMgOC4yNTE3MyA2LjkxNjA5IDguMTMzMDhDNi45MTY0IDguMTMwNDIgNi45NTQyMSA3Ljg1NzU5IDcuMTIyMjMgNy41NzE5OUM3LjM0NTEzIDcuMTkzMDEgNy42ODUwOSA2Ljk3MjUyIDguMTMyNTkgNi45MTY1OEM4LjI1MTI0IDYuOTAxNzIgOC4zNDAyNSA2LjgwMDg5IDguMzQwMjUgNi42ODEzNkM4LjM0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 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {View, StyleSheet, Text
|
|
3
|
-
import {
|
|
4
|
-
import {SidePanelType, useSidePanel} from 'customization-api';
|
|
2
|
+
import {View, StyleSheet, Text} from 'react-native';
|
|
3
|
+
import {useRoomInfo} from 'customization-api';
|
|
5
4
|
import ThemeConfig from '../../../theme';
|
|
6
5
|
|
|
7
6
|
const MobileTopbar = () => {
|
|
8
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
data: {meetingTitle},
|
|
9
|
+
} = useRoomInfo();
|
|
9
10
|
return (
|
|
10
11
|
<View style={style.rootStyle}>
|
|
11
12
|
<View style={style.containerStyle}>
|
|
12
|
-
<
|
|
13
|
-
<LogoIcon />
|
|
14
|
-
</View>
|
|
15
|
-
<Text style={style.textStyle}>Agora & OpenAI Demo</Text>
|
|
13
|
+
<Text style={style.textStyle}>{meetingTitle}</Text>
|
|
16
14
|
</View>
|
|
17
|
-
<TouchableOpacity
|
|
18
|
-
onPress={() => {
|
|
19
|
-
setSidePanel(SidePanelType.Settings);
|
|
20
|
-
}}>
|
|
21
|
-
<SettingsIcon />
|
|
22
|
-
</TouchableOpacity>
|
|
23
15
|
</View>
|
|
24
16
|
);
|
|
25
17
|
};
|
|
@@ -30,7 +22,7 @@ const style = StyleSheet.create({
|
|
|
30
22
|
flexDirection: 'row',
|
|
31
23
|
justifyContent: 'space-between',
|
|
32
24
|
alignItems: 'center',
|
|
33
|
-
paddingBottom:
|
|
25
|
+
paddingBottom: 14,
|
|
34
26
|
},
|
|
35
27
|
containerStyle: {
|
|
36
28
|
display: 'flex',
|
|
@@ -40,22 +32,14 @@ const style = StyleSheet.create({
|
|
|
40
32
|
gap: 4,
|
|
41
33
|
alignSelf: 'stretch',
|
|
42
34
|
},
|
|
43
|
-
logContainerStyle: {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
width: 40,
|
|
46
|
-
height: 40,
|
|
47
|
-
paddingRight: 1,
|
|
48
|
-
justifyContent: 'center',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
},
|
|
51
35
|
textStyle: {
|
|
52
|
-
color:
|
|
36
|
+
color: $config.FONT_COLOR,
|
|
53
37
|
textAlign: 'center',
|
|
54
38
|
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
55
|
-
fontSize:
|
|
39
|
+
fontSize: 16,
|
|
56
40
|
fontStyle: 'normal',
|
|
57
41
|
fontWeight: '600',
|
|
58
|
-
lineHeight:
|
|
42
|
+
lineHeight: 20,
|
|
59
43
|
},
|
|
60
44
|
});
|
|
61
45
|
|