How the emotions are selected
The selection of the current emotion is done in the router.js file inside the lib folder. The current emotion can either be chosen directly or can be determined by the current levels of arousal and valence (See Purpose for additional information)
The actual used code at the moment
This sets the initial emotion. The registered values foremotionsNumber are 0 to 8. 8 being thinking. The other emotions are sorted alphabetically:
- Amused
- Bored
- Calm
- Excited
- Frustrated
- Happy
- Sad
- Worried
- Thinking Thinking is at the end because it is just a filler emotion for when RICBOTs LLM is generating and is never displayed as an actual emotion RICBOT is currently feeling.
The code below
arousalandvalenceare initialized. Relevant for choosing the emotion by values- A function to update the values of
arousalandvalence - A get function for
arousalandvalence - The
calculateEmotion()function. The function is more or less a huge switch statement that searches up the current combination ofarousalandvalenceand then sets the emotion accordingly.
As you can see, the basis to continue working on the emotion calculation with arousal and valence already exists. Feel free to use it.