agora-appbuilder-core 4.1.2 → 4.1.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-implementation/dummyConfig.ts +2 -2
- package/template/defaultConfig.js +2 -2
- package/template/src/ai-agent/components/AgentControls/AgentContext.tsx +28 -4
- package/template/src/ai-agent/components/CustomSettingsPanel.tsx +8 -2
- package/template/src/ai-agent/components/SelectAiAgent.tsx +18 -2
- package/template/src/ai-agent/components/SelectUserLanguage.tsx +4 -2
- package/template/src/ai-agent/components/UserPrompt.tsx +4 -2
- package/template/src/pages/video-call/VideoRenderer.tsx +1 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* Dummy Config used to load when project doesn't have the customization.
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import {customize} from 'customization-api';
|
|
16
16
|
|
|
17
|
-
const dummyConfig =
|
|
17
|
+
const dummyConfig = customize({});
|
|
18
18
|
export default dummyConfig;
|
|
@@ -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.
|
|
80
|
-
CORE_VERSION: '4.1.
|
|
79
|
+
CLI_VERSION: '3.1.3',
|
|
80
|
+
CORE_VERSION: '4.1.3',
|
|
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,
|
|
@@ -47,7 +48,7 @@ export interface AIAgentContextInterface {
|
|
|
47
48
|
setLanguage: (language: keyof typeof ASR_LANGUAGES) => void;
|
|
48
49
|
prompt?: string;
|
|
49
50
|
setPrompt: (prompt: string) => void;
|
|
50
|
-
isInterruptionHandlingEnabled
|
|
51
|
+
isInterruptionHandlingEnabled?: boolean;
|
|
51
52
|
setIsInterruptionHandlingEnabled: (value: boolean) => void;
|
|
52
53
|
chatHistory: IMessageListItem[];
|
|
53
54
|
setChatHistory: (history: IMessageListItem[]) => void;
|
|
@@ -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);
|
|
@@ -98,7 +100,7 @@ export const AgentProvider: React.FC<{children: React.ReactNode}> = ({
|
|
|
98
100
|
const [isStartAPICalled, setStartAPICalled] = useState(false);
|
|
99
101
|
const [isStopAPICalled, setStopAPICalled] = useState(false);
|
|
100
102
|
const [isInterruptionHandlingEnabled, setIsInterruptionHandlingEnabled] =
|
|
101
|
-
useState(
|
|
103
|
+
useState(undefined);
|
|
102
104
|
const [language, setLanguage] =
|
|
103
105
|
useState<AIAgentContextInterface['language']>('');
|
|
104
106
|
|
|
@@ -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 (
|
|
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) {
|
|
@@ -123,17 +123,23 @@ const AdvancedSettings = () => {
|
|
|
123
123
|
|
|
124
124
|
//when user switchs agent then update the toggle value for that agent
|
|
125
125
|
useEffect(() => {
|
|
126
|
-
if (
|
|
126
|
+
if (
|
|
127
|
+
isInterruptionHandlingEnabled === undefined &&
|
|
128
|
+
agentId &&
|
|
129
|
+
agents?.length
|
|
130
|
+
) {
|
|
127
131
|
setIsInterruptionHandlingEnabled(
|
|
128
132
|
agents?.find(a => a?.id === agentId)?.config?.enable_aivad,
|
|
129
133
|
);
|
|
130
134
|
}
|
|
131
|
-
}, [agentId, agents,
|
|
135
|
+
}, [agentId, agents, isInterruptionHandlingEnabled]);
|
|
136
|
+
|
|
132
137
|
const disabled = $config.ENABLE_CONVERSATIONAL_AI
|
|
133
138
|
? agentConnectionState === 'AGENT_CONNECTED'
|
|
134
139
|
? true
|
|
135
140
|
: false
|
|
136
141
|
: true;
|
|
142
|
+
|
|
137
143
|
return (
|
|
138
144
|
<View style={[{flexDirection: 'row', justifyContent: 'space-between'}]}>
|
|
139
145
|
<Text
|
|
@@ -14,7 +14,14 @@ const SelectAiAgent = () => {
|
|
|
14
14
|
data: {agents},
|
|
15
15
|
} = useRoomInfo();
|
|
16
16
|
const {setStore} = useStorageContext();
|
|
17
|
-
const {
|
|
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]
|
|
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(undefined);
|
|
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,
|
|
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
|
}
|