agora-appbuilder-core 4.1.2 → 4.1.3-beta.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.2",
3
+ "version": "4.1.3-beta.1",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -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.2',
80
- CORE_VERSION: '4.1.2',
79
+ CLI_VERSION: '3.1.3-beta.1',
80
+ CORE_VERSION: '4.1.3-beta.1',
81
81
  DISABLE_LANDSCAPE_MODE: false,
82
82
  STT_AUTO_START: false,
83
83
  CLOUD_RECORDING_AUTO_START: false,
@@ -9,6 +9,7 @@ import {
9
9
  Toast,
10
10
  useRtc,
11
11
  isWebInternal,
12
+ useHistory,
12
13
  } from 'customization-api';
13
14
  import LocalEventEmitter, {
14
15
  LocalEventsEnum,
@@ -84,6 +85,7 @@ export const AgentContext = createContext<AIAgentContextInterface>({
84
85
  export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
85
86
  children,
86
87
  }) => {
88
+ const history = useHistory();
87
89
  const [agentConnectionState, setAgentConnectionState] =
88
90
  useState<AIAgentState>(AgentState.NOT_CONNECTED);
89
91
  const [agentAuthToken, setAgentAuthToken] = useState<string | null>(null);
@@ -112,6 +114,22 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
112
114
  const messageCache = {};
113
115
  const TIMEOUT_MS = 5000; // Timeout for incomplete messages
114
116
 
117
+ useEffect(() => {
118
+ const extraRemoteUser = users
119
+ // filter local user
120
+ ?.filter(i => i !== localUid)
121
+ // filter agent user
122
+ ?.filter(i => !i?.toString()?.startsWith('3'));
123
+ if (
124
+ extraRemoteUser &&
125
+ extraRemoteUser?.length &&
126
+ extraRemoteUser[0] !== localUid
127
+ ) {
128
+ //navigate extra user to new meeting
129
+ history.push('/');
130
+ }
131
+ }, [users, localUid]);
132
+
115
133
  //set agent uid when user refresh the page - to maintain the app state
116
134
  useEffect(() => {
117
135
  //@ts-ignore
@@ -124,11 +142,17 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
124
142
  //set agent id when user refresh the page - to maintain the app state
125
143
  useEffect(() => {
126
144
  //@ts-ignore
127
- if (store?.agentId && store?.agentId !== agentId) {
145
+ if (
146
+ //@ts-ignore
147
+ store?.agentId &&
148
+ //@ts-ignore
149
+ store?.agentId !== agentId &&
150
+ agents.filter(i => i?.id === agentId)?.length
151
+ ) {
128
152
  //@ts-ignore
129
153
  setAgentId(store.agentId);
130
154
  }
131
- }, [store, agentId]);
155
+ }, [store, agentId, agents]);
132
156
 
133
157
  React.useEffect(() => {
134
158
  if (!isSubscribedForStreams) {
@@ -128,12 +128,14 @@ const AdvancedSettings = () => {
128
128
  agents?.find(a => a?.id === agentId)?.config?.enable_aivad,
129
129
  );
130
130
  }
131
- }, [agentId, agents, setIsInterruptionHandlingEnabled]);
131
+ }, [agentId, agents]);
132
+
132
133
  const disabled = $config.ENABLE_CONVERSATIONAL_AI
133
134
  ? agentConnectionState === 'AGENT_CONNECTED'
134
135
  ? true
135
136
  : false
136
137
  : true;
138
+
137
139
  return (
138
140
  <View style={[{flexDirection: 'row', justifyContent: 'space-between'}]}>
139
141
  <Text
@@ -14,7 +14,14 @@ const SelectAiAgent = () => {
14
14
  data: {agents},
15
15
  } = useRoomInfo();
16
16
  const {setStore} = useStorageContext();
17
- const {agentId, setAgentId, agentConnectionState} = useContext(AgentContext);
17
+ const {
18
+ agentId,
19
+ setAgentId,
20
+ agentConnectionState,
21
+ setIsInterruptionHandlingEnabled,
22
+ setLanguage,
23
+ setPrompt,
24
+ } = useContext(AgentContext);
18
25
 
19
26
  const data = useMemo(() => {
20
27
  return agents
@@ -30,7 +37,13 @@ const SelectAiAgent = () => {
30
37
  useEffect(() => {
31
38
  if (!agentId && data && data.length) {
32
39
  //set default agent
33
- setAgentId(data[0].value);
40
+ setAgentId(data[0]?.value);
41
+ setStore(prevState => {
42
+ return {
43
+ ...prevState,
44
+ agentId: data[0]?.value,
45
+ };
46
+ });
34
47
  }
35
48
  }, [agentId, data]);
36
49
 
@@ -59,6 +72,9 @@ const SelectAiAgent = () => {
59
72
  data={data}
60
73
  onSelect={async ({label, value}) => {
61
74
  if (agentId !== value) {
75
+ setIsInterruptionHandlingEnabled(null);
76
+ setLanguage(null);
77
+ setPrompt('');
62
78
  setAgentId(value);
63
79
  //setting agent uid in the store so we can retrive it if user refresh the page
64
80
  setStore(prevState => {
@@ -21,14 +21,16 @@ const SelectUserLanguage = () => {
21
21
  });
22
22
 
23
23
  useEffect(() => {
24
- if (agentId && agents?.length) {
24
+ if (!language && agentId && agents?.length) {
25
25
  //@ts-ignore
26
26
  setLanguage(
27
27
  agents?.find((agent: any) => agent.id === agentId)?.config
28
28
  ?.asr_language,
29
29
  );
30
+ } else if (language) {
31
+ setLanguage(language);
30
32
  }
31
- }, [agentId, setLanguage, agents]);
33
+ }, [agentId, agents, language]);
32
34
 
33
35
  return (
34
36
  <View>
@@ -39,10 +39,12 @@ const UserPrompt = () => {
39
39
  }, [prompt]);
40
40
 
41
41
  useEffect(() => {
42
- if (agentId && agents?.length) {
42
+ if (!prompt && agentId && agents?.length) {
43
43
  setPrompt(agents?.find(a => a?.id === agentId)?.config?.llm?.prompt);
44
+ } else if (prompt) {
45
+ setPrompt(prompt);
44
46
  }
45
- }, [agentId, agents, setPrompt]);
47
+ }, [agentId, agents, setPrompt, prompt]);
46
48
  return (
47
49
  <>
48
50
  <View
@@ -401,7 +401,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
401
401
  CustomChild ? $config.VIDEO_AUDIO_TILE_OVERLAY_COLOR : null
402
402
  }
403
403
  customTextColor={
404
- CustomChild
404
+ CustomChild && !$config.ENABLE_CONVERSATIONAL_AI
405
405
  ? $config.FONT_COLOR + hexadecimalTransparency['80%']
406
406
  : null
407
407
  }