[mirotalksfu] - improve VideoAI

هذا الالتزام موجود في:
Miroslav Pejic
2024-07-05 23:26:02 +02:00
الأصل c61c99e07b
التزام 23747fa75d
4 ملفات معدلة مع 65 إضافات و5 حذوفات

عرض الملف

@@ -44,7 +44,7 @@ dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.4.85
* @version 1.4.86
*
*/

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.4.85",
"version": "1.4.86",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.4.85
* @version 1.4.86
*
*/
@@ -4092,7 +4092,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.4.85',
title: 'WebRTC SFU v1.4.86',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.4.85
* @version 1.4.86
*
*/
@@ -7336,6 +7336,14 @@ class RoomClient {
this.startRendering();
if (!this.isMobileDevice) {
// Handle desktop or non-mobile device
this.handleDesktopChat();
} else {
// Handle mobile device
this.handleMobileChat();
}
VideoAI.active = true;
this.userLog('info', 'Video AI streaming started', 'top-end');
@@ -7344,6 +7352,58 @@ class RoomClient {
}
}
// Method for handling desktop or non-mobile device chat logic
handleDesktopChat() {
if (!this.isChatOpen) {
this.toggleChat();
}
this.sendMessageToVideoAi();
}
// Method for handling mobile device chat logic
handleMobileChat() {
if (this.videoMediaContainer.childElementCount <= 2) {
isHideMeActive = !isHideMeActive;
this.handleHideMe();
}
setTimeout(() => {
this.streamingTask(
`Welcome to ${BRAND.app.name}! Please Open the Chat and navigate to the ChatGPT section. Feel free to ask me any questions you have.`,
);
}, 2000);
}
sendMessageToVideoAi() {
const tasks = [
{ delay: 1000, action: () => this.chatPin() },
{ delay: 1200, action: () => this.toggleShowParticipants() },
{ delay: 1400, action: () => this.showPeerAboutAndMessages('ChatGPT', 'ChatGPT') },
{ delay: 1600, action: () => this.streamingTask(`Welcome to ${BRAND.app.name}!`) },
{
delay: 2000,
action: () => {
chatMessage.value = 'Hello!';
this.sendMessage();
},
},
];
this.executeTasksSequentially(tasks);
}
executeTasksSequentially(tasks) {
tasks.reduce((promise, task) => {
return promise.then(
() =>
new Promise((resolve) => {
setTimeout(() => {
task.action();
resolve();
}, task.delay);
}),
);
}, Promise.resolve());
}
streamingTask(message) {
if (VideoAI.enabled && VideoAI.active && message) {
const response = this.socket.request('streamingTask', {