From 1e2a665116e86b2ad82afda2e7c2f3862937fb33 Mon Sep 17 00:00:00 2001 From: mudler Date: Sun, 30 Apr 2023 23:24:56 +0200 Subject: [PATCH] docs: update discord-bot example --- examples/discord-bot/README.md | 52 ++++++++++++++++++++++-- examples/discord-bot/docker-compose.yaml | 4 +- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/examples/discord-bot/README.md b/examples/discord-bot/README.md index 6053ae87..6628c354 100644 --- a/examples/discord-bot/README.md +++ b/examples/discord-bot/README.md @@ -8,15 +8,13 @@ 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 # Download gpt4all-j to models/ wget https://gpt4all.io/models/ggml-gpt4all-j.bin -O models/ggml-gpt4all-j -# Set the discord bot options +# Set the discord bot options (see: https://github.com/go-skynet/gpt-discord-bot#setup) cp -rfv .env.example .env vim .env @@ -24,5 +22,53 @@ vim .env 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: + +```yaml +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 +``` \ No newline at end of file diff --git a/examples/discord-bot/docker-compose.yaml b/examples/discord-bot/docker-compose.yaml index 19056d50..6a10f306 100644 --- a/examples/discord-bot/docker-compose.yaml +++ b/examples/discord-bot/docker-compose.yaml @@ -16,8 +16,6 @@ services: command: ["/usr/bin/local-ai" ] bot: - build: - context: ./gpt-discord-bot - dockerfile: Dockerfile + image: quay.io/go-skynet/gpt-discord-bot:main env_file: - .env