Skip to content

Commit

Permalink
Update deps, use newer GPT3 engines, remove GPT2
Browse files Browse the repository at this point in the history
  • Loading branch information
Migushthe2nd committed Mar 9, 2024
1 parent cbee980 commit 78521db
Show file tree
Hide file tree
Showing 18 changed files with 2,188 additions and 1,657 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BOT_TOKEN=
OPENAI_API_KEY=
BOOSTE_API_KEY=
BOOSTE_API_KEY=

NODE_ENV=production
68 changes: 68 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Containers & Deploy

on:
push:
branches: [main]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_KEY: ${{ secrets.SSH_KEY }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Pulling new image on server
uses: appleboy/ssh-action@master
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USERNAME }}
key: ${{ env.SSH_KEY }}
script: |
cd /home/ubuntu/docker/larry
sudo docker pull ghcr.io/migushthe2nd/larry:main
sudo docker stack deploy --compose-file docker-compose.yml larry
sudo docker image prune -a -f
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:18 AS build-env

WORKDIR /usr/src/app

# Environment variables for production
COPY package*.json ./
COPY pnpm-lock.yaml ./
RUN corepack enable pnpm
RUN pnpm install

COPY . .

RUN pnpm prune --prod
ENV NODE_ENV=production

# currently just running with src still in the container instead of copying dist to a new container:
# can't get tsc to copy assets (json, images, emails) to dist
CMD pnpm run dev
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Larry

Larry is a simple Discord bot that interacts with the OpenAI GTP3 API. It also has support for different personalities
and even GPT2, served by booste. The bot keeps track of the conversation on a per-guild basis. You need to supply your
~~and even GPT2, served by booste~~. The bot keeps track of the conversation on a per-guild basis. You need to supply your
own OpenAI and booste API key for this to work.

- only keeps the last 8 lines of a conversation, to limit token usage
Expand All @@ -12,7 +12,7 @@ own OpenAI and booste API key for this to work.
- `larry help`: shows all available commands
- `larry status`: shows the current configuration
- `larry reset`: resets the conversation
- `larry switch`: switches between GTP2 and GPT3 (default: GPT3). Current conversation will be reset.
- ~~`larry switch`: switches between GTP2 and GPT3 (default: GPT3). Current conversation will be reset.~~
- `larry join`: Joins your current voice channel. Will use the same message history as the written messages.
- `larry leave`: Leaves the voice channel it is currently in.
- `larry personality <human/random/obedient/terminal/simple/singer>`: switches the GPT3 personality (default: human). Current conversation will be reset.
Expand Down
15 changes: 0 additions & 15 deletions larry.config.js

This file was deleted.

18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@
"repository": "https://github.com/Migushthe2nd/Larry",
"author": "Migushthe2nd",
"scripts": {
"dev": "nodemon ./src/index.js"
"dev": "pnpm exec nodemon ./src/index.js",
"start": "node ./src/index.js"
},
"dependencies": {
"@discordjs/opus": "^0.5.0",
"@discordjs/opus": "^0.9.0",
"@discordjs/voice": "^0.16.1",
"booste": "^0.0.7",
"discord-speech-recognition": "^1.0.6",
"discord.js": "^12.5.3",
"discord-speech-recognition": "^2.2.0",
"discord.js": "^13.6.0",
"dotenv": "^8.2.0",
"gpt-3-encoder": "^1.1.3",
"msedge-tts": "^1.0.0",
"openai-api": "^1.2.3",
"libsodium-wrappers": "^0.7.10",
"msedge-tts": "^1.3.4",
"openai-api": "^1.3.1",
"queue-promise": "^2.2.0",
"vader-sentiment": "^1.1.3",
"websocket": "^1.0.34",
"xml-escape": "^1.1.0"
},
"devDependencies": {
"nodemon": "^2.0.7"
},
"engines": {
"node": "18.x"
}
}
Loading

0 comments on commit 78521db

Please sign in to comment.