This MagicMirror module generates a random fact from the following questions submitted to the ChatGPT AI:
- Tell me a fun fact in 50 words or less
- Tell me an interesting fact about an animal in <country> in 50 words or less
- Tell me an interesting fact about the country <country> in 50 words or less
- Tell me about a famous historical figure from <country> in 50 words or less
- Tell me about a notable historical event that happened in <country> in 50 words or less
- Tell me about a notable world record in 50 words or less
- Tell me an interesting sporting event that happened in <country> in 50 words or less
- Tell me an odd but true fact in 50 words or less
Inspired by the quotes shown on the MagInkDash project.
Tested with:
- Raspberry Pi
- An installation of MagicMirror2
- npm
- A ChatGPT API Key
Navigate into your MagicMirror's modules folder:
cd ~/MagicMirror/modules
Clone this repository:
git clone https://github.com/mlcampbe/MMM-ChatGPT-Fact
Navigate to the new MMM-ChatGPT-Fact folder and install the node dependencies.
cd MMM-ChatGPT-Fact/ && npm install
Configure the module in your config.js file.
Navigate into the MMM-ChatGPT-Fact folder with cd ~/MagicMirror/modules/MMM-ChatGPT-Fact and get the latest code from Github with git pull.
If you haven't made any manual changes to the module, this should work without any problems. Type git status to see your changes and if there are any you can reset them with git reset --hard. After that, git pull should be possible.
To use this module, add it to the modules array in the config/config.js file:
modules: [
{
module: 'MMM-ChatGPT-Fact',
position: 'top_right', // This can be any of the regions.
config: {
updateInterval: 3600000, // every 1 hour
apiKey: " xxxxxx", // your ChatGPT API Key
model: "gpt-4o-mini", // which ChatGPT AI model to use
},
},
]The following properties can be configured:
| Option | Description |
|---|---|
updateInterval |
How often does the content needs to be fetched? (Milliseconds)
Possible values: 1000 - 86400000
Default value: 3600000 (1 hour)
|
apiKey |
Your ChatGPT API Key value
Default value: XXXXXX (dummy value, must be set)
|
model |
Which ChatGPT AI model to use for the fact generation.
Default value: gpt-4o-mini
|
safetyFilter |
Boolean to add the string "that is suitable for children under 12" to all ChatGPT questions.
Default value: false
|
