-
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mirotalksfu] - add interrupt avatar speaking button
- Loading branch information
1 parent
a3412ce
commit 21e178b
Showing
4 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ dev dependencies: { | |
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon | ||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.6.30 | ||
* @version 1.6.31 | ||
* | ||
*/ | ||
|
||
|
@@ -2250,6 +2250,7 @@ function startServer() { | |
socket.on('getAvatarList', async ({}, cb) => { | ||
if (!config.videoAI.enabled || !config.videoAI.apiKey) | ||
return cb({ error: 'Video AI seems disabled, try later!' }); | ||
|
||
try { | ||
const response = await axios.get(`${config.videoAI.basePath}/v1/avatar.list`, { | ||
headers: { | ||
|
@@ -2273,6 +2274,7 @@ function startServer() { | |
socket.on('getVoiceList', async ({}, cb) => { | ||
if (!config.videoAI.enabled || !config.videoAI.apiKey) | ||
return cb({ error: 'Video AI seems disabled, try later!' }); | ||
|
||
try { | ||
const response = await axios.get(`${config.videoAI.basePath}/v1/voice.list`, { | ||
headers: { | ||
|
@@ -2393,6 +2395,7 @@ function startServer() { | |
|
||
if (!config.videoAI.enabled || !config.videoAI.apiKey) | ||
return cb({ error: 'Video AI seems disabled, try later!' }); | ||
|
||
try { | ||
const response = await axios.post( | ||
`${config.videoAI.basePath}/v1/streaming.task`, | ||
|
@@ -2419,6 +2422,38 @@ function startServer() { | |
} | ||
}); | ||
|
||
// https://docs.heygen.com/reference/interrupt-task | ||
socket.on('streamingInterrupt', async ({ session_id, text }, cb) => { | ||
if (!roomExists(socket)) return; | ||
|
||
if (!config.videoAI.enabled || !config.videoAI.apiKey) | ||
return cb({ error: 'Video AI seems disabled, try later!' }); | ||
|
||
try { | ||
const response = await axios.post( | ||
`${config.videoAI.basePath}/v1/streaming.interrupt`, | ||
{ | ||
session_id, | ||
}, | ||
{ | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-Api-Key': config.videoAI.apiKey, | ||
}, | ||
}, | ||
); | ||
|
||
const data = { response: response.data }; | ||
|
||
log.debug('streamingInterrupt', data); | ||
|
||
cb(data); | ||
} catch (error) { | ||
log.error('streamingInterrupt', error.response.data); | ||
cb({ error: error.response?.status === 500 ? 'Internal server error' : error.response.data.message }); | ||
} | ||
}); | ||
|
||
socket.on('talkToOpenAI', async ({ text, context }, cb) => { | ||
if (!roomExists(socket)) return; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] or purchase directly via CodeCanyon | ||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 | ||
* @author Miroslav Pejic - [email protected] | ||
* @version 1.6.30 | ||
* @version 1.6.31 | ||
* | ||
*/ | ||
|
||
|
@@ -4614,7 +4614,7 @@ function showAbout() { | |
imageUrl: image.about, | ||
customClass: { image: 'img-about' }, | ||
position: 'center', | ||
title: 'WebRTC SFU v1.6.30', | ||
title: 'WebRTC SFU v1.6.31', | ||
html: ` | ||
<br /> | ||
<div id="about"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters