[mirotalksfu] - add DeepSeek integration
هذا الالتزام موجود في:
@@ -131,8 +131,16 @@ CHATGPT_ENABLED=false # Enable ChatGPT integration (
|
|||||||
CHATGPT_BASE_PATH=https://api.openai.com/v1/ # OpenAI base path
|
CHATGPT_BASE_PATH=https://api.openai.com/v1/ # OpenAI base path
|
||||||
CHATGPT_API_KEY= # OpenAI API key
|
CHATGPT_API_KEY= # OpenAI API key
|
||||||
CHATGPT_MODEL=gpt-3.5-turbo # Model to use (gpt-3.5-turbo, gpt-4, etc.)
|
CHATGPT_MODEL=gpt-3.5-turbo # Model to use (gpt-3.5-turbo, gpt-4, etc.)
|
||||||
CHATGPT_MAX_TOKENS=1000 # Max response tokens
|
CHATGPT_MAX_TOKENS=1024 # Max response tokens
|
||||||
CHATGPT_TEMPERATURE=0 # Creativity level (0-1)
|
CHATGPT_TEMPERATURE=0.7 # Creativity level (0-1)
|
||||||
|
|
||||||
|
# DeepSeek Integration
|
||||||
|
DEEP_SEEK_ENABLED=false # Enable DeepSeek integration (true|false)
|
||||||
|
DEEP_SEEK_BASE_PATH=https://api.deepseek.com/v1/ # DeepSeek base path
|
||||||
|
DEEP_SEEK_API_KEY= # DeepSeek API key
|
||||||
|
DEEP_SEEK_MODEL=deepseek-chat # Model to use (deepseek-chat, deepseek-coder, etc.)
|
||||||
|
DEEP_SEEK_MAX_TOKENS=1024 # Max response tokens
|
||||||
|
DEEP_SEEK_TEMPERATURE=0.7 # Creativity level (0-1)
|
||||||
|
|
||||||
# Video AI (HeyGen) Integration
|
# Video AI (HeyGen) Integration
|
||||||
VIDEOAI_ENABLED=false # Enable video AI avatars (true|false)
|
VIDEOAI_ENABLED=false # Enable video AI avatars (true|false)
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ module.exports = class Room {
|
|||||||
screen_cant_share: false,
|
screen_cant_share: false,
|
||||||
chat_cant_privately: false,
|
chat_cant_privately: false,
|
||||||
chat_cant_chatgpt: false,
|
chat_cant_chatgpt: false,
|
||||||
|
chat_cant_deep_seek: false,
|
||||||
media_cant_sharing: false,
|
media_cant_sharing: false,
|
||||||
};
|
};
|
||||||
this.survey = config?.features?.survey;
|
this.survey = config?.features?.survey;
|
||||||
@@ -489,6 +490,9 @@ module.exports = class Room {
|
|||||||
case 'chat_cant_chatgpt':
|
case 'chat_cant_chatgpt':
|
||||||
this._moderator.chat_cant_chatgpt = data.status;
|
this._moderator.chat_cant_chatgpt = data.status;
|
||||||
break;
|
break;
|
||||||
|
case 'chat_cant_deep_seek':
|
||||||
|
this._moderator.chat_cant_deep_seek = data.status;
|
||||||
|
break;
|
||||||
case 'media_cant_sharing':
|
case 'media_cant_sharing':
|
||||||
this._moderator.media_cant_sharing = data.status;
|
this._moderator.media_cant_sharing = data.status;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ dev dependencies: {
|
|||||||
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
|
* @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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.8.36
|
* @version 1.8.37
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1448,6 +1448,7 @@ function startServer() {
|
|||||||
mattermost: config.integrations?.mattermost?.enabled ? config.integrations.mattermost : false,
|
mattermost: config.integrations?.mattermost?.enabled ? config.integrations.mattermost : false,
|
||||||
slack: slackEnabled ? config.integrations?.slack : false,
|
slack: slackEnabled ? config.integrations?.slack : false,
|
||||||
chatGPT: config.integrations?.chatGPT?.enabled ? config.integrations.chatGPT : false,
|
chatGPT: config.integrations?.chatGPT?.enabled ? config.integrations.chatGPT : false,
|
||||||
|
deepSeek: config.integrations?.deepSeek?.enabled ? config.integrations.deepSeek : false,
|
||||||
email_alerts: config?.integrations?.email?.alert ? config.integrations.email : false,
|
email_alerts: config?.integrations?.email?.alert ? config.integrations.email : false,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2397,6 +2398,7 @@ function startServer() {
|
|||||||
case 'screen_cant_share':
|
case 'screen_cant_share':
|
||||||
case 'chat_cant_privately':
|
case 'chat_cant_privately':
|
||||||
case 'chat_cant_chatgpt':
|
case 'chat_cant_chatgpt':
|
||||||
|
case 'chat_cant_deep_seek':
|
||||||
case 'media_cant_sharing':
|
case 'media_cant_sharing':
|
||||||
room.broadCast(socket.id, 'updateRoomModerator', moderator);
|
room.broadCast(socket.id, 'updateRoomModerator', moderator);
|
||||||
break;
|
break;
|
||||||
@@ -2642,6 +2644,49 @@ function startServer() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('getDeepSeek', async ({ time, room, name, prompt, context }, cb) => {
|
||||||
|
if (!roomExists(socket)) return;
|
||||||
|
|
||||||
|
if (!config?.integrations?.deepSeek?.enabled) return cb({ message: 'DeepSeek seems disabled, try later!' });
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Add the prompt to the context
|
||||||
|
context.push({ role: 'user', content: prompt });
|
||||||
|
// Call DeepSeek's API to generate response
|
||||||
|
const response = await axios.post(
|
||||||
|
`${config?.integrations?.deepSeek?.basePath}chat/completions`,
|
||||||
|
{
|
||||||
|
model: config?.integrations?.deepSeek?.model,
|
||||||
|
messages: context,
|
||||||
|
max_tokens: config?.integrations?.deepSeek?.max_tokens,
|
||||||
|
temperature: config?.integrations?.deepSeek?.temperature,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${config?.integrations?.deepSeek?.apiKey}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
// Extract message from completion
|
||||||
|
const message = response.data.choices[0].message.content.trim();
|
||||||
|
// Add response to context
|
||||||
|
context.push({ role: 'assistant', content: message });
|
||||||
|
// Log conversation details
|
||||||
|
log.info('DeepSeek', {
|
||||||
|
time: time,
|
||||||
|
room: room,
|
||||||
|
name: name,
|
||||||
|
context: context,
|
||||||
|
});
|
||||||
|
// Callback response to client
|
||||||
|
cb({ message: message, context: context });
|
||||||
|
} catch (error) {
|
||||||
|
log.error('DeepSeek', error);
|
||||||
|
cb({ message: error.message });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// https://docs.heygen.com/reference/list-avatars-v2
|
// https://docs.heygen.com/reference/list-avatars-v2
|
||||||
socket.on('getAvatarList', async ({}, cb) => {
|
socket.on('getAvatarList', async ({}, cb) => {
|
||||||
if (!config?.integrations?.videoAI?.enabled || !config?.integrations?.videoAI?.apiKey)
|
if (!config?.integrations?.videoAI?.enabled || !config?.integrations?.videoAI?.apiKey)
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ module.exports = {
|
|||||||
*
|
*
|
||||||
* Advanced Settings:
|
* Advanced Settings:
|
||||||
* -----------------
|
* -----------------
|
||||||
* - max_tokens: Maximum response length (default: 1000 tokens)
|
* - max_tokens: Maximum response length (default: 1024 tokens)
|
||||||
* - temperature: Creativity control (0=strict, 1=creative) (default: 0)
|
* - temperature: Creativity control (0=strict, 1=creative) (default: 0)
|
||||||
*
|
*
|
||||||
* Usage Example:
|
* Usage Example:
|
||||||
@@ -512,6 +512,7 @@ module.exports = {
|
|||||||
* - gpt-3.5-turbo (recommended)
|
* - gpt-3.5-turbo (recommended)
|
||||||
* - gpt-4
|
* - gpt-4
|
||||||
* - gpt-4-turbo
|
* - gpt-4-turbo
|
||||||
|
* - ...
|
||||||
*
|
*
|
||||||
* 2. Temperature Guide:
|
* 2. Temperature Guide:
|
||||||
* - 0.0: Factual responses
|
* - 0.0: Factual responses
|
||||||
@@ -523,8 +524,55 @@ module.exports = {
|
|||||||
basePath: process.env.CHATGPT_BASE_PATH || 'https://api.openai.com/v1/',
|
basePath: process.env.CHATGPT_BASE_PATH || 'https://api.openai.com/v1/',
|
||||||
apiKey: process.env.CHATGPT_API_KEY || '',
|
apiKey: process.env.CHATGPT_API_KEY || '',
|
||||||
model: process.env.CHATGPT_MODEL || 'gpt-3.5-turbo',
|
model: process.env.CHATGPT_MODEL || 'gpt-3.5-turbo',
|
||||||
max_tokens: parseInt(process.env.CHATGPT_MAX_TOKENS) || 1000,
|
max_tokens: parseInt(process.env.CHATGPT_MAX_TOKENS) || 1024,
|
||||||
temperature: parseInt(process.env.CHATGPT_TEMPERATURE) || 0,
|
temperature: parseInt(process.env.CHATGPT_TEMPERATURE) || 0.7,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DeepDeek Integration Configuration
|
||||||
|
* ================================
|
||||||
|
* DeepDeek API integration for AI-powered chat functionality
|
||||||
|
*
|
||||||
|
* Setup Instructions:
|
||||||
|
* ------------------
|
||||||
|
* 1. Go to https://deepseek.com/
|
||||||
|
* 2. Create your DeepDeek account
|
||||||
|
* 3. Generate your API key at https://deepseek.com/account/api-keys
|
||||||
|
*
|
||||||
|
* Core Settings:
|
||||||
|
* -------------
|
||||||
|
* - enabled : Enable/disable DeepDeek integration [true/false] (default: false)
|
||||||
|
* - basePath : DeepDeek API endpoint (default: 'https://api.deepseek.com/v1/')
|
||||||
|
* - apiKey : DeepDeek API secret key (ALWAYS store in .env)
|
||||||
|
* - model : DeepDeek model version (default: 'deepdeek-chat')
|
||||||
|
*
|
||||||
|
* Advanced Settings:
|
||||||
|
* -----------------
|
||||||
|
* - max_tokens: Maximum response length (default: 1024 tokens)
|
||||||
|
* - temperature: Creativity control (0=strict, 1=creative) (default: 0)
|
||||||
|
*
|
||||||
|
* Usage Example:
|
||||||
|
* -------------
|
||||||
|
* 1. Supported Models:
|
||||||
|
* - deepseek-chat (recommended)
|
||||||
|
* - deepseek-coder
|
||||||
|
* - deepseek-math
|
||||||
|
* - deepseek-llm
|
||||||
|
* - ...
|
||||||
|
*
|
||||||
|
* 2. Temperature Guide:
|
||||||
|
* - 0.0: Factual responses
|
||||||
|
* - 0.7: Balanced
|
||||||
|
* - 1.0: Maximum creativity
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
deepSeek: {
|
||||||
|
enabled: process.env.DEEP_SEEK_ENABLED === 'true',
|
||||||
|
basePath: process.env.DEEP_SEEK_BASE_PATH || 'https://api.deepseek.com/v1/',
|
||||||
|
apiKey: process.env.DEEP_SEEK_API_KEY || '',
|
||||||
|
model: process.env.DEEP_SEEK_MODEL || 'deepseek-chat',
|
||||||
|
max_tokens: parseInt(process.env.DEEP_SEEK_MAX_TOKENS) || 1024,
|
||||||
|
temperature: parseInt(process.env.DEEP_SEEK_TEMPERATURE) || 0.7,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mirotalksfu",
|
"name": "mirotalksfu",
|
||||||
"version": "1.8.36",
|
"version": "1.8.37",
|
||||||
"description": "WebRTC SFU browser-based video calls",
|
"description": "WebRTC SFU browser-based video calls",
|
||||||
"main": "Server.js",
|
"main": "Server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"compression": "1.8.0",
|
"compression": "1.8.0",
|
||||||
"cors": "2.8.5",
|
"cors": "2.8.5",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"discord.js": "^14.19.2",
|
"discord.js": "^14.19.3",
|
||||||
"dompurify": "^3.2.5",
|
"dompurify": "^3.2.5",
|
||||||
"dotenv": "^16.5.0",
|
"dotenv": "^16.5.0",
|
||||||
"express": "5.1.0",
|
"express": "5.1.0",
|
||||||
|
|||||||
ثنائية
public/images/deepSeek.png
Normal file
ثنائية
public/images/deepSeek.png
Normal file
ملف ثنائي غير معروض.
|
بعد العرض: | الارتفاع: | الحجم: 5.4 KiB |
@@ -64,7 +64,7 @@ let BRAND = {
|
|||||||
},
|
},
|
||||||
about: {
|
about: {
|
||||||
imageUrl: '../images/mirotalk-logo.gif',
|
imageUrl: '../images/mirotalk-logo.gif',
|
||||||
title: '<strong>WebRTC SFU v1.8.36</strong>',
|
title: '<strong>WebRTC SFU v1.8.37</strong>',
|
||||||
html: `
|
html: `
|
||||||
<button
|
<button
|
||||||
id="support-button"
|
id="support-button"
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class LocalStorage {
|
|||||||
moderator_screen_cant_share: false, // Everyone can't share screen
|
moderator_screen_cant_share: false, // Everyone can't share screen
|
||||||
moderator_chat_cant_privately: false, // Everyone can't chat privately, only Public chat allowed
|
moderator_chat_cant_privately: false, // Everyone can't chat privately, only Public chat allowed
|
||||||
moderator_chat_cant_chatgpt: false, // Everyone can't chat with ChatGPT
|
moderator_chat_cant_chatgpt: false, // Everyone can't chat with ChatGPT
|
||||||
|
moderator_chat_cant_deep_seek: false, // Everyone can't chat with DeepSeek
|
||||||
moderator_media_cant_sharing: false, // Everyone can't share media
|
moderator_media_cant_sharing: false, // Everyone can't share media
|
||||||
moderator_disconnect_all_on_leave: false, // Disconnect all participants on leave room
|
moderator_disconnect_all_on_leave: false, // Disconnect all participants on leave room
|
||||||
mic_auto_gain_control: true,
|
mic_auto_gain_control: true,
|
||||||
|
|||||||
@@ -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 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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.8.36
|
* @version 1.8.37
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -250,6 +250,7 @@ let isVideoControlsOn = false;
|
|||||||
let isChatPasteTxt = false;
|
let isChatPasteTxt = false;
|
||||||
let isChatMarkdownOn = false;
|
let isChatMarkdownOn = false;
|
||||||
let isChatGPTOn = false;
|
let isChatGPTOn = false;
|
||||||
|
let isDeepSeekOn = false;
|
||||||
let isSpeechSynthesisSupported = 'speechSynthesis' in window;
|
let isSpeechSynthesisSupported = 'speechSynthesis' in window;
|
||||||
let joinRoomWithoutAudioVideo = true;
|
let joinRoomWithoutAudioVideo = true;
|
||||||
let joinRoomWithScreen = false;
|
let joinRoomWithScreen = false;
|
||||||
@@ -2853,6 +2854,14 @@ function handleSelects() {
|
|||||||
lS.setSettings(localStorageSettings);
|
lS.setSettings(localStorageSettings);
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
};
|
};
|
||||||
|
switchEveryoneCantChatDeepSeek.onchange = (e) => {
|
||||||
|
const chatCantDeepSeek = e.currentTarget.checked;
|
||||||
|
rc.updateRoomModerator({ type: 'chat_cant_deep_seek', status: chatCantDeepSeek });
|
||||||
|
rc.roomMessage('chat_cant_deep_seek', chatCantDeepSeek);
|
||||||
|
localStorageSettings.moderator_chat_cant_deep_seek = chatCantDeepSeek;
|
||||||
|
lS.setSettings(localStorageSettings);
|
||||||
|
e.target.blur();
|
||||||
|
};
|
||||||
switchEveryoneCantMediaSharing.onchange = (e) => {
|
switchEveryoneCantMediaSharing.onchange = (e) => {
|
||||||
const mediaCantSharing = e.currentTarget.checked;
|
const mediaCantSharing = e.currentTarget.checked;
|
||||||
rc.updateRoomModerator({ type: 'media_cant_sharing', status: mediaCantSharing });
|
rc.updateRoomModerator({ type: 'media_cant_sharing', status: mediaCantSharing });
|
||||||
@@ -4465,6 +4474,31 @@ function getParticipantsList(peers) {
|
|||||||
</li>`;
|
</li>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deepSeek = BUTTONS.chat.deepSeek !== undefined ? BUTTONS.chat.deepSeek : true;
|
||||||
|
|
||||||
|
// DEEP-SEEK
|
||||||
|
if (deepSeek) {
|
||||||
|
const deepSeek_active = rc.chatPeerName === 'DeepSeek' ? ' active' : '';
|
||||||
|
|
||||||
|
li += `
|
||||||
|
<li
|
||||||
|
id="DeepSeek"
|
||||||
|
data-to-id="DeepSeek"
|
||||||
|
data-to-name="DeepSeek"
|
||||||
|
class="clearfix${deepSeek_active}"
|
||||||
|
onclick="rc.showPeerAboutAndMessages(this.id, 'DeepSeek', '', event)"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="${image.deepSeek}"
|
||||||
|
alt="avatar"
|
||||||
|
/>
|
||||||
|
<div class="about">
|
||||||
|
<div class="name">DeepSeek</div>
|
||||||
|
<div class="status"><i class="fa fa-circle online"></i> online</div>
|
||||||
|
</div>
|
||||||
|
</li>`;
|
||||||
|
}
|
||||||
|
|
||||||
const public_chat_active = rc.chatPeerName === 'all' ? ' active' : '';
|
const public_chat_active = rc.chatPeerName === 'all' ? ' active' : '';
|
||||||
|
|
||||||
// ALL
|
// ALL
|
||||||
@@ -5351,7 +5385,7 @@ function showAbout() {
|
|||||||
position: 'center',
|
position: 'center',
|
||||||
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
|
imageUrl: BRAND.about?.imageUrl && BRAND.about.imageUrl.trim() !== '' ? BRAND.about.imageUrl : image.about,
|
||||||
customClass: { image: 'img-about' },
|
customClass: { image: 'img-about' },
|
||||||
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.8.36',
|
title: BRAND.about?.title && BRAND.about.title.trim() !== '' ? BRAND.about.title : 'WebRTC SFU v1.8.37',
|
||||||
html: `
|
html: `
|
||||||
<br />
|
<br />
|
||||||
<div id="about">
|
<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 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
|
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
|
||||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||||
* @version 1.8.36
|
* @version 1.8.37
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -104,6 +104,7 @@ const image = {
|
|||||||
lobby: '../images/lobby.png',
|
lobby: '../images/lobby.png',
|
||||||
email: '../images/email.png',
|
email: '../images/email.png',
|
||||||
chatgpt: '../images/chatgpt.png',
|
chatgpt: '../images/chatgpt.png',
|
||||||
|
deepSeek: '../images/deepSeek.png',
|
||||||
all: '../images/all.png',
|
all: '../images/all.png',
|
||||||
forbidden: '../images/forbidden.png',
|
forbidden: '../images/forbidden.png',
|
||||||
broadcasting: '../images/broadcasting.png',
|
broadcasting: '../images/broadcasting.png',
|
||||||
@@ -267,6 +268,7 @@ class RoomClient {
|
|||||||
screen_cant_share: false,
|
screen_cant_share: false,
|
||||||
chat_cant_privately: false,
|
chat_cant_privately: false,
|
||||||
chat_cant_chatgpt: false,
|
chat_cant_chatgpt: false,
|
||||||
|
chat_cant_deep_seek: false,
|
||||||
media_cant_sharing: false,
|
media_cant_sharing: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -330,6 +332,7 @@ class RoomClient {
|
|||||||
|
|
||||||
this.pollSelectedOptions = {};
|
this.pollSelectedOptions = {};
|
||||||
this.chatGPTContext = [];
|
this.chatGPTContext = [];
|
||||||
|
this.deepSeekContext = [];
|
||||||
this.chatMessages = [];
|
this.chatMessages = [];
|
||||||
this.leftMsgAvatar = null;
|
this.leftMsgAvatar = null;
|
||||||
this.rightMsgAvatar = null;
|
this.rightMsgAvatar = null;
|
||||||
@@ -4773,7 +4776,7 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendMessage() {
|
sendMessage() {
|
||||||
if (!this.thereAreParticipants() && !isChatGPTOn) {
|
if (!this.thereAreParticipants() && !isChatGPTOn && !isDeepSeekOn) {
|
||||||
this.cleanMessage();
|
this.cleanMessage();
|
||||||
isChatPasteTxt = false;
|
isChatPasteTxt = false;
|
||||||
return this.userLog('info', 'No participants in the room', 'top-end');
|
return this.userLog('info', 'No participants in the room', 'top-end');
|
||||||
@@ -4825,12 +4828,14 @@ class RoomClient {
|
|||||||
peer_name: this.peer_name,
|
peer_name: this.peer_name,
|
||||||
peer_avatar: this.peer_avatar,
|
peer_avatar: this.peer_avatar,
|
||||||
peer_id: this.peer_id,
|
peer_id: this.peer_id,
|
||||||
to_peer_id: 'ChatGPT',
|
to_peer_id: '',
|
||||||
to_peer_name: 'ChatGPT',
|
to_peer_name: '',
|
||||||
peer_msg: peer_msg,
|
peer_msg: peer_msg,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isChatGPTOn) {
|
if (isChatGPTOn) {
|
||||||
|
data.to_peer_id = 'ChatGPT';
|
||||||
|
data.to_peer_name = 'ChatGPT';
|
||||||
console.log('Send message:', data);
|
console.log('Send message:', data);
|
||||||
this.socket.emit('message', data);
|
this.socket.emit('message', data);
|
||||||
this.setMsgAvatar('left', this.peer_name, this.peer_avatar);
|
this.setMsgAvatar('left', this.peer_name, this.peer_avatar);
|
||||||
@@ -4869,7 +4874,60 @@ class RoomClient {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log('ChatGPT error:', err);
|
console.log('ChatGPT error:', err);
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (isDeepSeekOn) {
|
||||||
|
data.to_peer_id = 'deepSeek';
|
||||||
|
data.to_peer_name = 'deepSeek';
|
||||||
|
console.log('Send message:', data);
|
||||||
|
this.socket.emit('message', data);
|
||||||
|
this.setMsgAvatar('left', this.peer_name, this.peer_avatar);
|
||||||
|
this.appendMessage(
|
||||||
|
'left',
|
||||||
|
this.leftMsgAvatar,
|
||||||
|
this.peer_name,
|
||||||
|
this.peer_id,
|
||||||
|
peer_msg,
|
||||||
|
data.to_peer_id,
|
||||||
|
data.to_peer_name,
|
||||||
|
);
|
||||||
|
this.cleanMessage();
|
||||||
|
|
||||||
|
this.socket
|
||||||
|
.request('getDeepSeek', {
|
||||||
|
time: getDataTimeString(),
|
||||||
|
room: this.room_id,
|
||||||
|
name: this.peer_name,
|
||||||
|
prompt: peer_msg,
|
||||||
|
context: this.deepSeekContext,
|
||||||
|
})
|
||||||
|
.then((completion) => {
|
||||||
|
if (!completion) return;
|
||||||
|
const { message, context } = completion;
|
||||||
|
this.deepSeekContext = context ? context : [];
|
||||||
|
console.log('Receive message:', message);
|
||||||
|
this.setMsgAvatar('right', 'DeepSeek');
|
||||||
|
this.appendMessage(
|
||||||
|
'right',
|
||||||
|
image.deepSeek,
|
||||||
|
'DeepSeek',
|
||||||
|
this.peer_id,
|
||||||
|
message,
|
||||||
|
'DeepSeek',
|
||||||
|
'DeepSeek',
|
||||||
|
);
|
||||||
|
this.cleanMessage();
|
||||||
|
this.streamingTask(message);
|
||||||
|
this.speechInMessages && !VideoAI.active
|
||||||
|
? this.speechMessage(true, 'DeepSeek', message)
|
||||||
|
: this.sound('message');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log('DeepSeek error:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isChatGPTOn || !isDeepSeekOn) {
|
||||||
const participantsList = this.getId('participantsList');
|
const participantsList = this.getId('participantsList');
|
||||||
const participantsListItems = participantsList.getElementsByTagName('li');
|
const participantsListItems = participantsList.getElementsByTagName('li');
|
||||||
for (let i = 0; i < participantsListItems.length; i++) {
|
for (let i = 0; i < participantsListItems.length; i++) {
|
||||||
@@ -4980,7 +5038,7 @@ class RoomClient {
|
|||||||
// INCOMING PRIVATE MESSAGE
|
// INCOMING PRIVATE MESSAGE
|
||||||
if (li.id === data.peer_id && data.to_peer_id != 'all') {
|
if (li.id === data.peer_id && data.to_peer_id != 'all') {
|
||||||
li.classList.add('pulsate');
|
li.classList.add('pulsate');
|
||||||
if (!['all', 'ChatGPT'].includes(data.to_peer_id)) {
|
if (!['all', 'ChatGPT', 'DeepSeek'].includes(data.to_peer_id)) {
|
||||||
this.getId(`${data.peer_id}-unread-msg`).classList.remove('hidden');
|
this.getId(`${data.peer_id}-unread-msg`).classList.remove('hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5069,6 +5127,9 @@ class RoomClient {
|
|||||||
case 'ChatGPT':
|
case 'ChatGPT':
|
||||||
chatGPTMessages.insertAdjacentHTML('beforeend', newMessageHTML);
|
chatGPTMessages.insertAdjacentHTML('beforeend', newMessageHTML);
|
||||||
break;
|
break;
|
||||||
|
case 'DeepSeek':
|
||||||
|
deepSeekMessages.insertAdjacentHTML('beforeend', newMessageHTML);
|
||||||
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
chatPublicMessages.insertAdjacentHTML('beforeend', newMessageHTML);
|
chatPublicMessages.insertAdjacentHTML('beforeend', newMessageHTML);
|
||||||
break;
|
break;
|
||||||
@@ -5079,8 +5140,8 @@ class RoomClient {
|
|||||||
|
|
||||||
const message = getId(`message-${chatMessagesId}`);
|
const message = getId(`message-${chatMessagesId}`);
|
||||||
if (message) {
|
if (message) {
|
||||||
if (getFromName === 'ChatGPT') {
|
if (['ChatGPT', 'DeepSeek'].includes(getFromName)) {
|
||||||
// Stream the message for ChatGPT
|
// Stream the message for ChatGPT or DeepSeek
|
||||||
this.streamMessage(message, getMsg, 100);
|
this.streamMessage(message, getMsg, 100);
|
||||||
} else {
|
} else {
|
||||||
// Process the message for other senders
|
// Process the message for other senders
|
||||||
@@ -5372,10 +5433,12 @@ class RoomClient {
|
|||||||
}
|
}
|
||||||
// Remove child nodes from different message containers
|
// Remove child nodes from different message containers
|
||||||
removeAllChildNodes(chatGPTMessages);
|
removeAllChildNodes(chatGPTMessages);
|
||||||
|
removeAllChildNodes(deepSeekMessages);
|
||||||
removeAllChildNodes(chatPublicMessages);
|
removeAllChildNodes(chatPublicMessages);
|
||||||
removeAllChildNodes(chatPrivateMessages);
|
removeAllChildNodes(chatPrivateMessages);
|
||||||
this.chatMessages = [];
|
this.chatMessages = [];
|
||||||
this.chatGPTContext = [];
|
this.chatGPTContext = [];
|
||||||
|
this.deepSeekContext = [];
|
||||||
this.sound('delete');
|
this.sound('delete');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -7401,6 +7464,13 @@ class RoomClient {
|
|||||||
'top-end',
|
'top-end',
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'chat_cant_deep_seek':
|
||||||
|
this.userLog(
|
||||||
|
'info',
|
||||||
|
`${icons.moderator} Moderator: everyone can't chat with DeepSeek ${status}`,
|
||||||
|
'top-end',
|
||||||
|
);
|
||||||
|
break;
|
||||||
case 'media_cant_sharing':
|
case 'media_cant_sharing':
|
||||||
this.userLog('info', `${icons.moderator} Moderator: everyone can't share media ${status}`, 'top-end');
|
this.userLog('info', `${icons.moderator} Moderator: everyone can't share media ${status}`, 'top-end');
|
||||||
break;
|
break;
|
||||||
@@ -8784,7 +8854,7 @@ class RoomClient {
|
|||||||
const avatarImg = getParticipantAvatar(peer_name, peer_avatar);
|
const avatarImg = getParticipantAvatar(peer_name, peer_avatar);
|
||||||
|
|
||||||
const generateChatAboutHTML = (imgSrc, title, status = 'online', participants = '') => {
|
const generateChatAboutHTML = (imgSrc, title, status = 'online', participants = '') => {
|
||||||
const isSensitiveChat = !['all', 'ChatGPT'].includes(peer_id) && title.length > 15;
|
const isSensitiveChat = !['all', 'ChatGPT', 'DeepSeek'].includes(peer_id) && title.length > 15;
|
||||||
const truncatedTitle = isSensitiveChat ? `${title.substring(0, 10)}*****` : title;
|
const truncatedTitle = isSensitiveChat ? `${title.substring(0, 10)}*****` : title;
|
||||||
return `
|
return `
|
||||||
<img class="all-participants-img"
|
<img class="all-participants-img"
|
||||||
@@ -8810,7 +8880,7 @@ class RoomClient {
|
|||||||
for (let i = 0; i < participantsListItems.length; i++) {
|
for (let i = 0; i < participantsListItems.length; i++) {
|
||||||
participantsListItems[i].classList.remove('active');
|
participantsListItems[i].classList.remove('active');
|
||||||
participantsListItems[i].classList.remove('pulsate'); // private new message to read
|
participantsListItems[i].classList.remove('pulsate'); // private new message to read
|
||||||
if (!['all', 'ChatGPT'].includes(peer_id)) {
|
if (!['all', 'ChatGPT', 'DeepSeek'].includes(peer_id)) {
|
||||||
// icon private new message to read
|
// icon private new message to read
|
||||||
this.getId(`${peer_id}-unread-msg`).classList.add('hidden');
|
this.getId(`${peer_id}-unread-msg`).classList.add('hidden');
|
||||||
}
|
}
|
||||||
@@ -8818,6 +8888,8 @@ class RoomClient {
|
|||||||
participant.classList.add('active');
|
participant.classList.add('active');
|
||||||
|
|
||||||
isChatGPTOn = false;
|
isChatGPTOn = false;
|
||||||
|
isDeepSeekOn = false;
|
||||||
|
|
||||||
console.log('Display messages', peer_id);
|
console.log('Display messages', peer_id);
|
||||||
|
|
||||||
switch (peer_id) {
|
switch (peer_id) {
|
||||||
@@ -8829,6 +8901,19 @@ class RoomClient {
|
|||||||
chatAbout.innerHTML = generateChatAboutHTML(image.chatgpt, 'ChatGPT');
|
chatAbout.innerHTML = generateChatAboutHTML(image.chatgpt, 'ChatGPT');
|
||||||
this.getId('chatGPTMessages').style.display = 'block';
|
this.getId('chatGPTMessages').style.display = 'block';
|
||||||
break;
|
break;
|
||||||
|
case 'DeepSeek':
|
||||||
|
if (this._moderator.chat_cant_deep_seek) {
|
||||||
|
return userLog(
|
||||||
|
'warning',
|
||||||
|
'The moderator does not allow you to chat with DeepSeek',
|
||||||
|
'top-end',
|
||||||
|
6000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
isDeepSeekOn = true;
|
||||||
|
chatAbout.innerHTML = generateChatAboutHTML(image.deepSeek, 'DeepSeek');
|
||||||
|
this.getId('deepSeekMessages').style.display = 'block';
|
||||||
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
chatAbout.innerHTML = generateChatAboutHTML(image.all, 'Public chat', 'online', participantsCount);
|
chatAbout.innerHTML = generateChatAboutHTML(image.all, 'Public chat', 'online', participantsCount);
|
||||||
this.getId('chatPublicMessages').style.display = 'block';
|
this.getId('chatPublicMessages').style.display = 'block';
|
||||||
@@ -8861,6 +8946,7 @@ class RoomClient {
|
|||||||
|
|
||||||
hidePeerMessages() {
|
hidePeerMessages() {
|
||||||
elemDisplay('chatGPTMessages', false);
|
elemDisplay('chatGPTMessages', false);
|
||||||
|
elemDisplay('deepSeekMessages', false);
|
||||||
elemDisplay('chatPublicMessages', false);
|
elemDisplay('chatPublicMessages', false);
|
||||||
elemDisplay('chatPrivateMessages', false);
|
elemDisplay('chatPrivateMessages', false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ let BUTTONS = {
|
|||||||
chatMarkdownButton: true,
|
chatMarkdownButton: true,
|
||||||
chatSpeechStartButton: true,
|
chatSpeechStartButton: true,
|
||||||
chatGPT: true,
|
chatGPT: true,
|
||||||
|
deepSeek: true,
|
||||||
},
|
},
|
||||||
poll: {
|
poll: {
|
||||||
pollPinButton: true,
|
pollPinButton: true,
|
||||||
@@ -184,6 +185,7 @@ function handleRules(isPresenter) {
|
|||||||
switchEveryoneCantShareScreen.checked = localStorageSettings.moderator_screen_cant_share;
|
switchEveryoneCantShareScreen.checked = localStorageSettings.moderator_screen_cant_share;
|
||||||
switchEveryoneCantChatPrivately.checked = localStorageSettings.moderator_chat_cant_privately;
|
switchEveryoneCantChatPrivately.checked = localStorageSettings.moderator_chat_cant_privately;
|
||||||
switchEveryoneCantChatChatGPT.checked = localStorageSettings.moderator_chat_cant_chatgpt;
|
switchEveryoneCantChatChatGPT.checked = localStorageSettings.moderator_chat_cant_chatgpt;
|
||||||
|
switchEveryoneCantChatDeepSeek.checked = localStorageSettings.moderator_chat_cant_deep_seek;
|
||||||
switchEveryoneCantMediaSharing.checked = localStorageSettings.moderator_media_cant_sharing;
|
switchEveryoneCantMediaSharing.checked = localStorageSettings.moderator_media_cant_sharing;
|
||||||
switchDisconnectAllOnLeave.checked = localStorageSettings.moderator_disconnect_all_on_leave;
|
switchDisconnectAllOnLeave.checked = localStorageSettings.moderator_disconnect_all_on_leave;
|
||||||
|
|
||||||
@@ -197,6 +199,7 @@ function handleRules(isPresenter) {
|
|||||||
screen_cant_share: switchEveryoneCantShareScreen.checked,
|
screen_cant_share: switchEveryoneCantShareScreen.checked,
|
||||||
chat_cant_privately: switchEveryoneCantChatPrivately.checked,
|
chat_cant_privately: switchEveryoneCantChatPrivately.checked,
|
||||||
chat_cant_chatgpt: switchEveryoneCantChatChatGPT.checked,
|
chat_cant_chatgpt: switchEveryoneCantChatChatGPT.checked,
|
||||||
|
chat_cant_deep_seek: switchEveryoneCantChatDeepSeek.checked,
|
||||||
media_cant_sharing: switchEveryoneCantMediaSharing.checked,
|
media_cant_sharing: switchEveryoneCantMediaSharing.checked,
|
||||||
};
|
};
|
||||||
console.log('Rules moderator data ---->', moderatorData);
|
console.log('Rules moderator data ---->', moderatorData);
|
||||||
|
|||||||
@@ -887,7 +887,25 @@ access to use this app.
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="everyoneCantChatGPTBtn">
|
<tr id="everyoneCantChatDeepSeek">
|
||||||
|
<td>
|
||||||
|
<div class="title">
|
||||||
|
<i class="fa-solid fa-robot red"></i>
|
||||||
|
<p>Disable DeepSeek Access</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="form-check form-switch form-switch-md">
|
||||||
|
<input
|
||||||
|
id="switchEveryoneCantChatDeepSeek"
|
||||||
|
class="form-check-input"
|
||||||
|
type="checkbox"
|
||||||
|
checked
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="everyoneCantMediaSharingBtn">
|
||||||
<td>
|
<td>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<i class="fab fa-youtube red"></i>
|
<i class="fab fa-youtube red"></i>
|
||||||
@@ -1627,6 +1645,7 @@ access to use this app.
|
|||||||
<div id="chatHistory" class="chat-history">
|
<div id="chatHistory" class="chat-history">
|
||||||
<!-- CHAT MESSAGES -->
|
<!-- CHAT MESSAGES -->
|
||||||
<ul id="chatGPTMessages" class="mb-0"></ul>
|
<ul id="chatGPTMessages" class="mb-0"></ul>
|
||||||
|
<ul id="deepSeekMessages" class="mb-0"></ul>
|
||||||
<ul id="chatPublicMessages" class="mb-0"></ul>
|
<ul id="chatPublicMessages" class="mb-0"></ul>
|
||||||
<ul id="chatPrivateMessages" class="mb-0"></ul>
|
<ul id="chatPrivateMessages" class="mb-0"></ul>
|
||||||
|
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم