whatsapp-chatgpt icon indicating copy to clipboard operation
whatsapp-chatgpt copied to clipboard

Custom Context (`!context <name>`)

Open navopw opened this issue 2 years ago • 1 comments

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

navopw avatar Feb 19 '23 21:02 navopw

Can you write the full code for this custom context feature and make it easy for people to use?

HarshalDewangan avatar Mar 04 '23 08:03 HarshalDewangan