This is a monorepo for the llmpeople project - chat with a 3D model powered by ChatGPT.
It uses BabylonJS, NextJS, TypeScript, and the OpenAI API.
An OpenAI API key is required. Check out the OPENAI_API_KEY env var in the .env file. If instead of OpenAI's voices you wish to use Google Cloud's voices, you'll need a Google Cloud API key - and use the GOOGLE_CLOUD_API_KEY env var instead.
-
Install npm - nvm is recommended.
nvm install --lts
installs the latest node LST version. -
Make sure npm is installed.
npm -v
to check if it's installed. -
Install yarn -
npm install --global yarn
-
Install the dependencies - Simply run
yarn
in the root folder of this project. -
Run the project - Run
yarn dev
in the root folder of this project.
There are 2 models available:
You can switch between these models in the settings modal.
You can share your model and settings by copying the URL in the settings modal. This URL contains the model and settings you are currently using. When someone visits this URL, they will see the same model and settings you are currently using. For example, the following URL:
Will load the vest_dude
model, the en-US-Neural2-I
voice, and the prompt Prompt - respond as spongebob
If you wish to use a custom model, the recommended way is to use Blender and follow the steps below:
- Export the model as .glb
- Save the .glb file in the public folder of this project
- Create a new config for the model in the constants.ts file. If the model filename is
my_new_model.glb
, we will need to update themodels
object with the following:
export const models = {
vroid_girl1: defaultConfig,
vest_dude: {
// (vest_dude's model config)
},
my_new_model: {
// (my_new_model's model config - add your config here)
},
} as const;
The model's filename should match the key in the models
object. In this example, the key is my_new_model
and the filename is my_new_model.glb
.
To simplify the configuration step, we can start with the defaultConfig: my_new_model: defaultConfig
, and then adjust it as necessary. For example, let's image that our custom model only has 1 idle animation: custom_idle_animation
- we would need to update the models
object as follows:
export const models = {
vroid_girl1: defaultConfig,
vest_dude: {
// (vest_dude's model config)
},
my_new_model: {
...defaultConfig,
idleAnimations: ['custom_idle_animation'] // add custom idle animation here.
},
} as const;
This project uses react-speech-recognition, which in turn uses the Web Speech API's SpeechRecognition. The language for speech recognition can be set in the settings. The default is en-US
.