Compare commits
1 Commits
chore/upda
...
feat/inter
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
051d81f97b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,3 +33,4 @@ yarn-error.log*
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
.idea
|
||||
|
||||
@@ -131,6 +131,16 @@ export default function StreamingAvatar() {
|
||||
setInitialized(true);
|
||||
}
|
||||
|
||||
async function handleInterrupt() {
|
||||
if (!initialized || !avatar.current) {
|
||||
setDebug('Avatar API not initialized');
|
||||
return;
|
||||
}
|
||||
await avatar.current.interrupt({ interruptRequest: { sessionId: data?.sessionId } }).catch((e) => {
|
||||
setDebug(e.message);
|
||||
});
|
||||
}
|
||||
|
||||
async function endSession() {
|
||||
if (!initialized || !avatar.current) {
|
||||
setDebug("Avatar API not initialized");
|
||||
@@ -249,6 +259,14 @@ export default function StreamingAvatar() {
|
||||
>
|
||||
<track kind="captions" />
|
||||
</video>
|
||||
<Button
|
||||
size="md"
|
||||
onClick={handleInterrupt}
|
||||
className="bg-gradient-to-tr from-indigo-500 to-indigo-300 absolute bottom-20 right-3 text-white rounded-lg"
|
||||
variant="shadow"
|
||||
>
|
||||
Interrupt
|
||||
</Button>
|
||||
<Button
|
||||
size="md"
|
||||
onClick={endSession}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/openai": "^0.0.34",
|
||||
"@heygen/streaming-avatar": "^1.0.10",
|
||||
"@heygen/streaming-avatar": "^1.0.11",
|
||||
"@nextui-org/button": "2.0.34",
|
||||
"@nextui-org/code": "2.0.29",
|
||||
"@nextui-org/input": "2.2.2",
|
||||
|
||||
Reference in New Issue
Block a user