feat: add task type (#18)
This commit is contained in:
@@ -2,7 +2,7 @@ import type { StartAvatarResponse } from "@heygen/streaming-avatar";
|
|||||||
|
|
||||||
import StreamingAvatar, {
|
import StreamingAvatar, {
|
||||||
AvatarQuality,
|
AvatarQuality,
|
||||||
StreamingEvents,
|
StreamingEvents, TaskType,
|
||||||
} from "@heygen/streaming-avatar";
|
} from "@heygen/streaming-avatar";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
@@ -109,11 +109,10 @@ export default function InteractiveAvatar() {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await avatar.current
|
// speak({ text: text, task_type: TaskType.REPEAT })
|
||||||
.speak({ text: text })
|
await avatar.current.speak({ text: text }).catch((e) => {
|
||||||
.catch((e) => {
|
setDebug(e.message);
|
||||||
setDebug(e.message);
|
});
|
||||||
});
|
|
||||||
setIsLoadingRepeat(false);
|
setIsLoadingRepeat(false);
|
||||||
}
|
}
|
||||||
async function handleInterrupt() {
|
async function handleInterrupt() {
|
||||||
@@ -129,12 +128,7 @@ export default function InteractiveAvatar() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function endSession() {
|
async function endSession() {
|
||||||
if (!avatar.current) {
|
await avatar.current?.stopAvatar();
|
||||||
setDebug("Avatar API not initialized");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await avatar.current.stopAvatar();
|
|
||||||
setStream(undefined);
|
setStream(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user