This example is a pretty slim one and disables many bot features to just have a plain GPT/openai-bot in the end.

The bot can be added as Slack app by anyone in the Slack workspace and can handle private messages. Additionally the bot can be invited to channels, but then it will answer any message, which might be unwanted by default.

When a message is sent to the bot, it will answer with a message generated by the OpenAI API in a new thread. All replies within the new thread will have the thread history in context so OpenAI is able to generate dresponses based on the whole context. In the end the flow is presst similar to Chat-GPT and the message is also generated with the stream API to get first result as fast as possible.

**Data privacy note:** by default every message and response (+some medadata like used model) are stored in the log file. This can be disabled by setting `logger.level` to `warning` in the config.


**Example conversation:**
![Screenshot](./screenshot.png)

# Setup

## 1st) Create the Slack app
[See the readme section here](../../readme.md#1st-createprepare-the-slack-app) for more details. 

# 2nd) Create an OpenAI access token
- create an account on https://openai.com
- create a new [OpenAI API key](https://platform.openai.com/account/api-keys)

# 3rd) Configuration
See the [config.yaml](./config.yaml) from this example and replace all slack+openai tokens by your own ones

# 4th) Run the bot
[See the readme section here](../../readme.md#3rd-run-the-bot)

# 5th) Add the bot to your Slack client
Go to the Slack client click on "Add Apps" in the lower left corner and search for the name of your Slack app. 
After adding it you will see it in the left sidebar and can start chatting with it.
