From 0db0704e2c8a71e8865ba10406e8af1e7df173c8 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 1 May 2023 23:18:24 +0200 Subject: [PATCH] docs: Add slack-bot example (#145) Signed-off-by: mudler --- examples/README.md | 1 + examples/slack-bot/.env.example | 11 +++++++++++ examples/slack-bot/README.md | 27 ++++++++++++++++++++++++++ examples/slack-bot/docker-compose.yaml | 23 ++++++++++++++++++++++ examples/slack-bot/models | 1 + 5 files changed, 63 insertions(+) create mode 100644 examples/slack-bot/.env.example create mode 100644 examples/slack-bot/README.md create mode 100644 examples/slack-bot/docker-compose.yaml create mode 120000 examples/slack-bot/models diff --git a/examples/README.md b/examples/README.md index dfbbdd5..a86c196 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,6 +6,7 @@ Here is a list of projects that can easily be integrated with the LocalAI backen - [chatbot-ui](https://github.com/go-skynet/LocalAI/tree/master/examples/chatbot-ui/) (by [@mkellerman](https://github.com/mkellerman)) - [discord-bot](https://github.com/go-skynet/LocalAI/tree/master/examples/discord-bot/) (by [@mudler](https://github.com/mudler)) +- [slack-bot](https://github.com/go-skynet/LocalAI/tree/master/examples/slack-bot/) (by [@mudler](https://github.com/mudler)) ## Want to contribute? diff --git a/examples/slack-bot/.env.example b/examples/slack-bot/.env.example new file mode 100644 index 0000000..d4fe401 --- /dev/null +++ b/examples/slack-bot/.env.example @@ -0,0 +1,11 @@ +SLACK_APP_TOKEN=xapp-1-... +SLACK_BOT_TOKEN=xoxb-... +OPENAI_API_KEY=sk-... +OPENAI_API_BASE=http://api:8080 +OPENAI_MODEL=gpt-3.5-turbo +OPENAI_TIMEOUT_SECONDS=60 +#OPENAI_SYSTEM_TEXT="You proofread text. When you receive a message, you will check +#for mistakes and make suggestion to improve the language of the given text" +USE_SLACK_LANGUAGE=true +SLACK_APP_LOG_LEVEL=INFO +TRANSLATE_MARKDOWN=true \ No newline at end of file diff --git a/examples/slack-bot/README.md b/examples/slack-bot/README.md new file mode 100644 index 0000000..9c9f10f --- /dev/null +++ b/examples/slack-bot/README.md @@ -0,0 +1,27 @@ +# Slack bot + +Slackbot using: https://github.com/seratch/ChatGPT-in-Slack + +## Setup + +```bash +# Clone LocalAI +git clone https://github.com/go-skynet/LocalAI + +cd LocalAI/examples/slack-bot + +git clone https://github.com/seratch/ChatGPT-in-Slack + +# (optional) Checkout a specific LocalAI tag +# git checkout -b build + +# Download gpt4all-j to models/ +wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j + +# Set the discord bot options (see: https://github.com/seratch/ChatGPT-in-Slack) +cp -rfv .env.example .env +vim .env + +# start with docker-compose +docker-compose up -d --build +``` \ No newline at end of file diff --git a/examples/slack-bot/docker-compose.yaml b/examples/slack-bot/docker-compose.yaml new file mode 100644 index 0000000..35a7501 --- /dev/null +++ b/examples/slack-bot/docker-compose.yaml @@ -0,0 +1,23 @@ +version: '3.6' + +services: + api: + image: quay.io/go-skynet/local-ai:latest + build: + context: ../../ + dockerfile: Dockerfile.dev + ports: + - 8080:8080 + environment: + - DEBUG=true + - MODELS_PATH=/models + volumes: + - ./models:/models:cached + command: ["/usr/bin/local-ai" ] + + bot: + build: + context: ./ChatGPT-in-Slack + dockerfile: Dockerfile + env_file: + - .env diff --git a/examples/slack-bot/models b/examples/slack-bot/models new file mode 120000 index 0000000..9c5c2aa --- /dev/null +++ b/examples/slack-bot/models @@ -0,0 +1 @@ +../chatbot-ui/models \ No newline at end of file