Compare commits

...

1 Commits

Author SHA1 Message Date
raojianb
64bb29760e feat: simplify api 2024-09-22 01:53:18 -07:00

View File

@@ -110,7 +110,7 @@ export default function InteractiveAvatar() {
return; return;
} }
await avatar.current await avatar.current
.speak({ text: text, sessionId: data?.session_id! }) .speak({ text: text })
.catch((e) => { .catch((e) => {
setDebug(e.message); setDebug(e.message);
}); });
@@ -123,7 +123,7 @@ export default function InteractiveAvatar() {
return; return;
} }
await avatar.current await avatar.current
.interrupt({ sessionId: data?.session_id! }) .interrupt()
.catch((e) => { .catch((e) => {
setDebug(e.message); setDebug(e.message);
}); });
@@ -134,9 +134,7 @@ export default function InteractiveAvatar() {
return; return;
} }
await avatar.current.stopAvatar({ await avatar.current.stopAvatar();
sessionId: data?.session_id!,
});
setStream(undefined); setStream(undefined);
} }
@@ -155,9 +153,9 @@ export default function InteractiveAvatar() {
const previousText = usePrevious(text); const previousText = usePrevious(text);
useEffect(() => { useEffect(() => {
if (!previousText && text) { if (!previousText && text) {
avatar.current?.startListening({ sessionId: data?.session_id! }); avatar.current?.startListening();
} else if (previousText && !text) { } else if (previousText && !text) {
avatar?.current?.stopListening({ sessionId: data?.session_id! }); avatar?.current?.stopListening();
} }
}, [text, previousText]); }, [text, previousText]);