1515 * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616 * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18- * @version 1.8.05
18+ * @version 1.8.06
1919 *
2020 */
2121
@@ -11558,13 +11558,47 @@ function emitMsg(from, fromAvatar, to, msg, privateMsg, id) {
1155811558 sendToDataChannel(chatMessage);
1155911559}
1156011560
11561+ /**
11562+ * Show AI typing indicator animation in the chat
11563+ * @param {string} aiName
11564+ */
11565+ function showAITypingIndicator(aiName) {
11566+ const existing = getId(`ai-typing-${aiName}`);
11567+ if (existing) return;
11568+ const typingHTML = `
11569+ <div id="ai-typing-${aiName}" class="msg left-msg">
11570+ <div class="ai-typing-indicator">
11571+ <div class="typing-dots">
11572+ <span></span>
11573+ <span></span>
11574+ <span></span>
11575+ </div>
11576+ </div>
11577+ </div>
11578+ `;
11579+ msgerChat.insertAdjacentHTML('beforeend', typingHTML);
11580+ msgerChat.scrollTop = msgerChat.scrollHeight;
11581+ }
11582+
11583+ /**
11584+ * Hide AI typing indicator animation from the chat
11585+ * @param {string} aiName
11586+ */
11587+ function hideAITypingIndicator(aiName) {
11588+ const indicator = getId(`ai-typing-${aiName}`);
11589+ if (indicator) indicator.remove();
11590+ }
11591+
1156111592/**
1156211593 * Read ChatGPT incoming message
1156311594 * https://platform.openai.com/docs/introduction
1156411595 * @param {string} msg
1156511596 */
1156611597async function getChatGPTmessage(msg) {
1156711598 console.log('Send ChatGPT message:', msg);
11599+
11600+ showAITypingIndicator('ChatGPT');
11601+
1156811602 signalingSocket
1156911603 .request('data', {
1157011604 room_id: roomId,
@@ -11579,6 +11613,7 @@ async function getChatGPTmessage(msg) {
1157911613 })
1158011614 .then(
1158111615 function (completion) {
11616+ hideAITypingIndicator('ChatGPT');
1158211617 if (!completion) return;
1158311618 const { message, context } = completion;
1158411619 chatGPTcontext = context ? context : [];
@@ -11590,6 +11625,7 @@ async function getChatGPTmessage(msg) {
1159011625 }.bind(this)
1159111626 )
1159211627 .catch((err) => {
11628+ hideAITypingIndicator('ChatGPT');
1159311629 console.log('ChatGPT error:', err);
1159411630 });
1159511631}
@@ -14966,7 +15002,7 @@ function showAbout() {
1496615002 Swal.fire({
1496715003 background: swBg,
1496815004 position: 'center',
14969- title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.05 ',
15005+ title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.06 ',
1497015006 imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1497115007 customClass: { image: 'img-about' },
1497215008 html: `
0 commit comments