whatsapp-chatgpt
whatsapp-chatgpt copied to clipboard
Custom Context (`!context <name>`)
Define a json configuration file that has a list of actors (e.g. doctor, humorist, etc).
context-config.json or something similar
[
{
name: "doctor",
prompt: "Act as a doctor, give medical advise"
},
{
name: "humorist",
prompt: "Act as a humorist"
}
]
Add the environment variable CONTEXT
which defines the actor/context for all newly created conversations.
Make it possible to switch between different context/actors with !context <name>
Example code for promptPrefix:
const res = await api.sendMessage('what is the answer to the universe?', {
promptPrefix: `Act as ...`
})
Credits go to: @andrewssobral
Can you write the full code for this custom context feature and make it easy for people to use?