go build -o gchatgpt.bin main.go
to build or download the latest release.
- Create a new GChat app in Google Cloud Console. Copy its "Project number (app ID)"
- Build the binary
go build -ldflags="-s -w" -o gchatgpt.bin *.go
or downoad the latest release. - Run
./gchatgpt.bin
.
Run the bot:
OPENAI_API_KEY="sk-xxxx" GOOGLE_PROJECT_NUMBER="123456789" ADDRESS=":8080" OPENAI_MODEL="" PREPROMPT="" ./gchatgpt.bin
OPENAI_API_KEY
: OpenAI API key. Get one from https://beta.openai.com/account/api-keysGOOGLE_PROJECT_NUMBER
: Project number (app ID) of the GChat app.ADDRESS
: Address to listen on. Defaults to:1234
OPENAI_MODEL
: OpenAI model to use. Defaults togpt-3.5-turbo
PREPROMPT
: Preprompt to use. Defaults to"You are a chat bot in a thread with multiple users. You will receive messages in the format <username>: <prompt>. Respond in a non-verbose and to-the-point manner."
The bot should be listening to an https endpoing exposed to the internet. This URL should be configured in the GChat app config in the Google Cloud Console.
On GChat, speak to the bot by tagging it. @gchatgpt What is the answer to life, universe, and everything?
License: MIT