docs: add discord-bot example (#126)

swagger
Ettore Di Giacinto 2 years ago committed by GitHub
parent 16773e2a35
commit 54b5eadcc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      Dockerfile.dev
  2. 4
      docker-compose.yaml
  3. 1
      examples/README.md
  4. 2
      examples/chatbot-ui/docker-compose.yaml
  5. 6
      examples/discord-bot/.env.example
  6. 28
      examples/discord-bot/README.md
  7. 23
      examples/discord-bot/docker-compose.yaml
  8. 1
      examples/discord-bot/models

@ -0,0 +1,14 @@
ARG GO_VERSION=1.20
ARG DEBIAN_VERSION=11
ARG BUILD_TYPE=
FROM golang:$GO_VERSION as builder
WORKDIR /build
RUN apt-get update && apt-get install -y cmake
COPY . .
RUN make build
FROM debian:$DEBIAN_VERSION
COPY --from=builder /build/local-ai /usr/bin/local-ai
EXPOSE 8080
ENTRYPOINT [ "/usr/bin/local-ai" ]

@ -5,11 +5,11 @@ services:
image: quay.io/go-skynet/local-ai:latest image: quay.io/go-skynet/local-ai:latest
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile.dev
ports: ports:
- 8080:8080 - 8080:8080
env_file: env_file:
- .env - .env
volumes: volumes:
- ./models:/models:cached - ./models:/models:cached
command: ["/usr/bin/local-ai" ] command: ["/usr/bin/local-ai" ]

@ -5,6 +5,7 @@ Here is a list of projects that can easily be integrated with the LocalAI backen
## Projects ## Projects
- [chatbot-ui](https://github.com/go-skynet/LocalAI/tree/master/examples/chatbot-ui/) (by [@mkellerman](https://github.com/mkellerman)) - [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))
## Want to contribute? ## Want to contribute?

@ -5,7 +5,7 @@ services:
image: quay.io/go-skynet/local-ai:latest image: quay.io/go-skynet/local-ai:latest
build: build:
context: ../../ context: ../../
dockerfile: Dockerfile dockerfile: Dockerfile.dev
ports: ports:
- 8080:8080 - 8080:8080
environment: environment:

@ -0,0 +1,6 @@
OPENAI_API_KEY=x
DISCORD_BOT_TOKEN=x
DISCORD_CLIENT_ID=x
OPENAI_API_BASE=http://api:8080
ALLOWED_SERVER_IDS=x
SERVER_TO_MODERATION_CHANNEL=1:1

@ -0,0 +1,28 @@
# discord-bot
## Setup
```bash
# Clone LocalAI
git clone https://github.com/go-skynet/LocalAI
cd LocalAI/examples/discord-bot
git clone https://github.com/go-skynet/gpt-discord-bot.git
# (optional) Checkout a specific LocalAI tag
# git checkout -b build <TAG>
# Download gpt4all-j to models/
wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j
# Set the discord bot options
cp -rfv .env.example .env
vim .env
# start with docker-compose
docker-compose up -d --build
```
Open up the URL in the console and give permission to the bot in your server. Start a thread with `/chat ..`

@ -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: ./gpt-discord-bot
dockerfile: Dockerfile
env_file:
- .env

@ -0,0 +1 @@
../chatbot-ui/models/
Loading…
Cancel
Save