Skip to content

Commit

Permalink
[mirotalksfu] - improve AI warning message for quota no enough
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Feb 9, 2025
1 parent 49eda30 commit b01d874
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,7 @@ function startServer() {
cb(data);
} catch (error) {
log.error('streamingNew', error.response.data);
cb({ error: error.response?.status === 500 ? 'Internal server error' : error.response.data.message });
cb({ error: error.response?.status === 500 ? 'Internal server error' : error.response.data });
}
});

Expand Down
17 changes: 12 additions & 5 deletions public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3270,13 +3270,13 @@ class RoomClient {
});
}

msgPopup(type, message, timer = 3000) {
msgPopup(type, message, timer = 3000, position = 'center') {
switch (type) {
case 'warning':
case 'error':
Swal.fire({
background: swalBackground,
position: 'center',
position: position,
icon: type,
title: type,
text: message,
Expand All @@ -3289,7 +3289,7 @@ class RoomClient {
case 'success':
Swal.fire({
background: swalBackground,
position: 'center',
position: position,
icon: type,
title: type,
text: message,
Expand All @@ -3300,7 +3300,7 @@ class RoomClient {
case 'html':
Swal.fire({
background: swalBackground,
position: 'center',
position: position,
icon: type,
html: message,
showClass: { popup: 'animate__animated animate__fadeInDown' },
Expand Down Expand Up @@ -8965,7 +8965,14 @@ class RoomClient {

await this.startSession();
} catch (error) {
this.userLog('error', error, 'top-end');
switch (error.code) {
case 'quota_not_enough':
this.msgPopup('warning', 'You’ve reached your quota limit for this demo account. Please consider upgrading for more features.', 6000, 'top');
break;
// ...
default:
this.userLog('error', error.message, 'top-end');
}
console.error('Video AI streamingNew error:', error);
this.stopSession();
}
Expand Down

0 comments on commit b01d874

Please sign in to comment.