diff --git a/README.md b/README.md index b647533a3..89cd3373a 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ NOTE: Make sure you have enter your token into the `.env` file and run `npm run To start your 'session' with a Interactive Avatar, first click the 'start' button. If your HeyGen API key is entered into the Server's .env file, then you should see our demo Interactive Avatar appear. +This demo is locked to a single avatar, knowledge base and voice. You can +choose the conversation language before starting the session. + If you want to see a different Avatar or try a different voice, you can close the session and enter the IDs and then 'start' the session again. Please see below for information on where to retrieve different Avatar and voice IDs that you can use. ### Which Avatars can I use with this project? diff --git a/components/InteractiveAvatar.tsx b/components/InteractiveAvatar.tsx index a58ee9335..7ea0faeaf 100644 --- a/components/InteractiveAvatar.tsx +++ b/components/InteractiveAvatar.tsx @@ -19,9 +19,12 @@ import { useVoiceChat } from "./logic/useVoiceChat"; import { StreamingAvatarProvider, StreamingAvatarSessionState } from "./logic"; import { LoadingIcon } from "./Icons"; import { MessageHistory } from "./AvatarSession/MessageHistory"; +import { Select } from "./Select"; import { AVATARS } from "@/app/lib/constants"; +const SUPPORTED_LANGUAGES = ["en", "es", "fr"]; + const DEFAULT_CONFIG: StartAvatarRequest = { quality: AvatarQuality.Low, avatarName: AVATARS[0].avatar_id, @@ -44,6 +47,7 @@ function InteractiveAvatar() { const { startVoiceChat } = useVoiceChat(); const [config, setConfig] = useState(DEFAULT_CONFIG); + const [language, setLanguage] = useState("en"); const mediaStream = useRef(null); @@ -99,7 +103,7 @@ function InteractiveAvatar() { console.log(">>>>> Avatar end message:", event); }); - await startAvatar(config); + await startAvatar({ ...DEFAULT_CONFIG, language }); if (isVoiceChat) { await startVoiceChat(); @@ -136,13 +140,23 @@ function InteractiveAvatar() { {sessionState === StreamingAvatarSessionState.CONNECTED ? ( ) : sessionState === StreamingAvatarSessionState.INACTIVE ? ( -
- - +
+