Discussions

Ask a Question
Back to all

How to fetch opening Intro from knowledgebase using the SDK approach

Hi Team,

I am trying to add a following opening intro to my Santa Avatar, but I coudn't mage to do it. Coild you please heplp me with this.


Here is the code snippet I am using to fetch the interactive Avatar:

try {
const res = await avatar.current.createStartAvatar({
quality: AvatarQuality.High,
avatarName: "",
knowledgeId: "",
voice: voiceSettings,
language,
disableIdleTimeout: false,
});
setData(res);

await avatar.current.startVoiceChat({ useSilencePrompt: true });
await new Promise((resolve) => setTimeout(resolve, 5000));
await avatar.current.speak({
  text: "Ho, Ho, Ho. Merry Christmas to you! What is your name, and what would you like for Christmas?",
});

setChatMode("voice_mode");

} catch (error) {
console.error("Error starting avatar session:", error);
} finally {
setIsLoadingSession(false);
}