agora-appbuilder-core 4.1.0-beta-7 → 4.1.0-beta-9

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.0-beta-7",
3
+ "version": "4.1.0-beta-9",
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.0-beta-7',
80
- CORE_VERSION: '4.1.0-beta-7',
79
+ CLI_VERSION: '3.1.0-beta-9',
80
+ CORE_VERSION: '4.1.0-beta-9',
81
81
  DISABLE_LANDSCAPE_MODE: false,
82
82
  STT_AUTO_START: false,
83
83
  CLOUD_RECORDING_AUTO_START: false,
@@ -85,6 +85,7 @@ const DefaultConfig = {
85
85
  AUTO_CONNECT_RTM: false,
86
86
  ENABLE_CONVERSATIONAL_AI: false,
87
87
  CUSTOMIZE_AGENT: true,
88
+ AI_LAYOUT: 'DEFAULT_LAYOUT',
88
89
  };
89
90
 
90
91
  module.exports = DefaultConfig;
@@ -172,6 +172,7 @@ interface ConfigInterface {
172
172
  AUTO_CONNECT_RTM: boolean;
173
173
  ENABLE_CONVERSATIONAL_AI: boolean;
174
174
  CUSTOMIZE_AGENT: boolean;
175
+ AI_LAYOUT: string;
175
176
  }
176
177
  declare var $config: ConfigInterface;
177
178
  declare module 'customization' {
@@ -57,7 +57,6 @@
57
57
  "@react-native-async-storage/async-storage": "1.19.2",
58
58
  "@react-native-community/checkbox": "0.5.16",
59
59
  "@react-native-community/clipboard": "1.5.1",
60
- "@splinetool/react-spline": "^4.0.0",
61
60
  "@splinetool/runtime": "^1.9.69",
62
61
  "@supersami/rn-foreground-service": "^1.1.1",
63
62
  "add": "^2.0.6",
@@ -66,7 +65,7 @@
66
65
  "agora-extension-beauty-effect": "^1.0.2-beta",
67
66
  "agora-extension-virtual-background": "^1.1.3",
68
67
  "agora-react-native-rtm": "1.5.1",
69
- "agora-rtc-sdk-ng": "4.23.0",
68
+ "agora-rtc-sdk-ng": "4.23.2",
70
69
  "agora-rtm-sdk": "1.5.1",
71
70
  "buffer": "^6.0.3",
72
71
  "electron-log": "4.3.5",
@@ -324,7 +324,7 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
324
324
  localUid,
325
325
  store.token,
326
326
  {
327
- agent_id: agentId,
327
+ agent_id: agentId || agents?.length ? agents[0].id : null,
328
328
  prompt: prompt,
329
329
  voice: agents.find(a => a.id === agentId)?.config?.tts?.params
330
330
  ?.voice_name,
@@ -400,7 +400,7 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
400
400
  setAgentConnectionState(AgentState.AGENT_DISCONNECT_REQUEST);
401
401
  setStopAPICalled(true);
402
402
  await connectToAIAgent('stop', channel_name, localUid, store.token, {
403
- agent_id: agentId,
403
+ agent_id: agentId || agents?.length ? agents[0].id : null,
404
404
  });
405
405
  setStore(prevState => {
406
406
  return {
@@ -55,7 +55,7 @@ const MobileLayoutComponent: LayoutComponent = () => {
55
55
  innerContainerStyle={{backgroundColor: '#222'}}
56
56
  user={{
57
57
  ...defaultContent[agentUID],
58
- name: 'Ai Agent',
58
+ name: 'AI Agent',
59
59
  video: false,
60
60
  }}
61
61
  CustomChild={() =>
@@ -13,7 +13,7 @@ import {
13
13
  useLayout,
14
14
  CustomAgentInterfaceProps,
15
15
  } from 'customization-api';
16
- import {isMobileUA} from '../utils/common';
16
+ import {isAndroid, isIOS, isMobileUA} from '../utils/common';
17
17
  import AudioVisualizer, {DisconnectedView} from './components/AudioVisualizer';
18
18
  import Bottombar from './components/Bottombar';
19
19
  import CustomCreate from './components/CustomCreate';
@@ -105,7 +105,7 @@ const DesktopLayoutComponent: LayoutComponent = () => {
105
105
  <MaxVideoView
106
106
  user={{
107
107
  ...defaultContent[agentUID],
108
- name: 'Ai Agent',
108
+ name: 'AI Agent',
109
109
  video: false,
110
110
  }}
111
111
  CustomChild={() =>
@@ -152,6 +152,18 @@ const DesktopLayoutComponent: LayoutComponent = () => {
152
152
  // );
153
153
  // };
154
154
 
155
+ const defaultLayout = {
156
+ name: 'Ai-Agent',
157
+ label: 'Ai-Agent',
158
+ icon: '🤖',
159
+ component: DesktopLayoutComponent,
160
+ };
161
+ const animationLayout = {
162
+ name: 'conversational-ai',
163
+ label: 'Conversational AI',
164
+ icon: '🤖',
165
+ component: ConversationalAI,
166
+ };
155
167
  export const AI_AGENT_CUSTOMIZATION: CustomizationApiInterface = {
156
168
  components: {
157
169
  create: CustomCreate,
@@ -159,26 +171,12 @@ export const AI_AGENT_CUSTOMIZATION: CustomizationApiInterface = {
159
171
  wrapper: AgentProvider,
160
172
  //customAgentInterface: AiAgentCustomView,
161
173
  customLayout() {
162
- return [
163
- {
164
- name: 'Ai-Agent',
165
- label: 'Ai-Agent',
166
- icon: '🤖',
167
- component: DesktopLayoutComponent,
168
- },
169
- {
170
- name: 'conversational-ai',
171
- label: 'Conversational AI',
172
- icon: '🤖',
173
- component: ConversationalAI,
174
- },
175
- {
176
- name: 'default-ai-only',
177
- label: 'Default AI Only',
178
- icon: '🤖',
179
- component: DefaultAIOnly,
180
- },
181
- ];
174
+ return isAndroid() || isIOS()
175
+ ? //android and ios does not support animation layout
176
+ [defaultLayout]
177
+ : $config.AI_LAYOUT === 'ANIMATION_LAYOUT'
178
+ ? [animationLayout, defaultLayout]
179
+ : [defaultLayout, animationLayout];
182
180
  },
183
181
  customSidePanel: () => {
184
182
  return [
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export const ConversationalAI = () => {
3
+ return <></>;
4
+ };
@@ -1,4 +1,4 @@
1
- import React, {useEffect, useRef, useState} from 'react';
1
+ import React, {Suspense, useEffect, useRef, useState} from 'react';
2
2
  import {
3
3
  Platform,
4
4
  StyleSheet,
@@ -17,7 +17,6 @@ import {
17
17
  SidePanelType,
18
18
  } from 'customization-api';
19
19
  import ThemeConfig from '../../theme';
20
- import Spline from '@splinetool/react-spline';
21
20
  import {useAgent} from '../components/AgentControls/AgentContext';
22
21
  import {AgentState} from '../components/AgentControls/const';
23
22
  import {useIsAgentAvailable} from '../components/utils';
@@ -34,6 +33,7 @@ import TranscriptIcon from '../assets/transcript.png';
34
33
  import SettingsIcon from '../assets/settings.png';
35
34
  //@ts-ignore
36
35
  import DisconnectIcon from '../assets/close.png';
36
+ const {Application} = require('@splinetool/runtime');
37
37
 
38
38
  const MicButton = () => {
39
39
  const {audio} = useLocalUserInfo();
@@ -112,15 +112,28 @@ const DisconnectButton = () => {
112
112
 
113
113
  export const ConversationalAI: LayoutComponent = () => {
114
114
  const {agentConnectionState, toggleAgentConnection} = useAgent();
115
- const spline = useRef();
116
- const sphere = useRef();
115
+ // const spline = useRef();
116
+ // const sphere = useRef();
117
+
118
+ useEffect(() => {
119
+ setTimeout(() => {
120
+ // make sure you have a canvas in the body
121
+ const canvas = document.getElementById('ai-agent') as HTMLCanvasElement;
122
+
123
+ // start the application and load the scene
124
+ const spline = new Application(canvas);
125
+ spline.load(
126
+ 'https://d1i64xs2div6cu.cloudfront.net/scene-250216.splinecode',
127
+ );
128
+ });
129
+ }, []);
117
130
 
118
131
  function onLoad(splineApp) {
119
132
  // save the app in a ref for later use
120
- spline.current = splineApp;
121
- sphere.current = splineApp.findObjectByName('Sphere');
122
- console.log('debugging animation main', spline.current);
123
- console.log('debugging animation sphere', sphere.current);
133
+ // spline.current = splineApp;
134
+ // sphere.current = splineApp.findObjectByName('Sphere');
135
+ // console.log('debugging animation main', spline.current);
136
+ // console.log('debugging animation sphere', sphere.current);
124
137
  }
125
138
 
126
139
  const isLoading =
@@ -142,10 +155,13 @@ export const ConversationalAI: LayoutComponent = () => {
142
155
  </View>
143
156
  </View>
144
157
  <View style={styles.container}>
145
- <Spline
146
- scene="https://d1i64xs2div6cu.cloudfront.net/scene-250216.splinecode"
147
- onLoad={onLoad}
148
- />
158
+ <canvas id="ai-agent" width="100%" height="100%"></canvas>
159
+ {/* <Suspense fallback={<div>Loading...</div>}>
160
+ <Spline
161
+ scene="https://d1i64xs2div6cu.cloudfront.net/scene-250216.splinecode"
162
+ onLoad={onLoad}
163
+ />
164
+ </Suspense> */}
149
165
  </View>
150
166
  <View style={styles.btnContainer}>
151
167
  {!isLoading && agentConnectionState === 'AGENT_CONNECTED' ? (
@@ -69,7 +69,7 @@ export const DefaultAIOnly: LayoutComponent = () => {
69
69
  <MaxVideoView
70
70
  user={{
71
71
  ...defaultContent[agentUID],
72
- name: 'Ai Agent',
72
+ name: 'AI Agent',
73
73
  video: false,
74
74
  type: 'ai-agent',
75
75
  }}
@@ -128,7 +128,7 @@ const Dropdown: FC<Props> = ({
128
128
  },
129
129
  ]}>
130
130
  <FlatList
131
- showsVerticalScrollIndicator={true}
131
+ showsVerticalScrollIndicator={false}
132
132
  data={data}
133
133
  renderItem={renderItem}
134
134
  keyExtractor={(item, index) => index.toString()}