LocalAI/examples/discord-bot
James Braza e34b5f0119
Cleaning up `examples/` models and starter `.env` files (#1124)
Closes https://github.com/go-skynet/LocalAI/issues/1066 and
https://github.com/go-skynet/LocalAI/issues/1065

Standardizes all `examples/`:
- Models in one place (other than `rwkv`, which was one-offy)
- Env files as `.env.example` with `cp`
    - Also standardizes comments and links docs
2023-10-02 18:14:10 +02:00
..
.env.example Cleaning up `examples/` models and starter `.env` files (#1124) 2023-10-02 18:14:10 +02:00
README.md docs: add discord-bot preview (#137) 2023-05-01 11:03:34 +02:00
docker-compose.yaml images: cleanup, drop .dev Dockerfile (#437) 2023-05-30 15:58:10 +02:00
models Cleaning up `examples/` models and starter `.env` files (#1124) 2023-10-02 18:14:10 +02:00

README.md

discord-bot

Screenshot from 2023-05-01 07-58-19

Setup

# Clone LocalAI
git clone https://github.com/go-skynet/LocalAI

cd LocalAI/examples/discord-bot

# (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 (see: https://github.com/go-skynet/gpt-discord-bot#setup)
cp -rfv .env.example .env
vim .env

# start with docker-compose
docker-compose up -d --build

Note: see setup options here: https://github.com/go-skynet/gpt-discord-bot#setup

Open up the URL in the console and give permission to the bot in your server. Start a thread with /chat ..

Kubernetes

  • install the local-ai chart first
  • change OPENAI_API_BASE to point to the API address and apply the discord-bot manifest:
apiVersion: v1
kind: Namespace
metadata:
  name: discord-bot
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: localai
  namespace: discord-bot
  labels:
    app: localai
spec:
  selector:
    matchLabels:
      app: localai
  replicas: 1
  template:
    metadata:
      labels:
        app: localai
      name: localai
    spec:
      containers:
        - name: localai-discord
          env:
          - name: OPENAI_API_KEY
            value: "x"
          - name: DISCORD_BOT_TOKEN
            value: ""
          - name: DISCORD_CLIENT_ID
            value: ""
          - name: OPENAI_API_BASE
            value: "http://local-ai.default.svc.cluster.local:8080"
          - name: ALLOWED_SERVER_IDS
            value: "xx"
          - name: SERVER_TO_MODERATION_CHANNEL
            value: "1:1"
          image: quay.io/go-skynet/gpt-discord-bot:main