Compare commits
7 Commits
feat/updat
...
fix/incorr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
654787b17b | ||
|
|
6fca8b4d42 | ||
|
|
431281d47c | ||
|
|
274a307e83 | ||
|
|
03ef24b031 | ||
|
|
21f6c6d468 | ||
|
|
d7a7e3174c |
@@ -2,7 +2,7 @@ import type { StartAvatarResponse } from "@heygen/streaming-avatar";
|
|||||||
|
|
||||||
import StreamingAvatar, {
|
import StreamingAvatar, {
|
||||||
AvatarQuality,
|
AvatarQuality,
|
||||||
StreamingEvents, TaskType, VoiceEmotion,
|
StreamingEvents, TaskMode, TaskType, VoiceEmotion,
|
||||||
} from "@heygen/streaming-avatar";
|
} from "@heygen/streaming-avatar";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -91,17 +91,20 @@ export default function InteractiveAvatar() {
|
|||||||
const res = await avatar.current.createStartAvatar({
|
const res = await avatar.current.createStartAvatar({
|
||||||
quality: AvatarQuality.Low,
|
quality: AvatarQuality.Low,
|
||||||
avatarName: avatarId,
|
avatarName: avatarId,
|
||||||
knowledgeId: knowledgeId,
|
knowledgeId: knowledgeId, // Or use a custom `knowledgeBase`.
|
||||||
voice: {
|
voice: {
|
||||||
rate: 1.5, // 0.5 ~ 1.5
|
rate: 1.5, // 0.5 ~ 1.5
|
||||||
emotion: VoiceEmotion.EXCITED,
|
emotion: VoiceEmotion.EXCITED,
|
||||||
},
|
},
|
||||||
language: language,
|
language: language,
|
||||||
|
disableIdleTimeout: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
setData(res);
|
setData(res);
|
||||||
// default to voice mode
|
// default to voice mode
|
||||||
await avatar.current?.startVoiceChat();
|
await avatar.current?.startVoiceChat({
|
||||||
|
useSilencePrompt: false
|
||||||
|
});
|
||||||
setChatMode("voice_mode");
|
setChatMode("voice_mode");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error starting avatar session:", error);
|
console.error("Error starting avatar session:", error);
|
||||||
@@ -117,7 +120,7 @@ export default function InteractiveAvatar() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// speak({ text: text, task_type: TaskType.REPEAT })
|
// speak({ text: text, task_type: TaskType.REPEAT })
|
||||||
await avatar.current.speak({ text: text }).catch((e) => {
|
await avatar.current.speak({ text: text, taskType: TaskType.REPEAT, taskMode: TaskMode.SYNC }).catch((e) => {
|
||||||
setDebug(e.message);
|
setDebug(e.message);
|
||||||
});
|
});
|
||||||
setIsLoadingRepeat(false);
|
setIsLoadingRepeat(false);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function NavBar() {
|
|||||||
<Link
|
<Link
|
||||||
isExternal
|
isExternal
|
||||||
color="foreground"
|
color="foreground"
|
||||||
href="https://app.heygen.com/interactive-avatar"
|
href="https://labs.heygen.com/interactive-avatar"
|
||||||
>
|
>
|
||||||
Avatars
|
Avatars
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/openai": "^0.0.34",
|
"@ai-sdk/openai": "^0.0.34",
|
||||||
"@heygen/streaming-avatar": "^2.0.0-beta.1",
|
"@heygen/streaming-avatar": "^2.0.8",
|
||||||
"@nextui-org/button": "2.0.34",
|
"@nextui-org/button": "2.0.34",
|
||||||
"@nextui-org/chip": "^2.0.32",
|
"@nextui-org/chip": "^2.0.32",
|
||||||
"@nextui-org/code": "2.0.29",
|
"@nextui-org/code": "2.0.29",
|
||||||
|
|||||||
Reference in New Issue
Block a user