Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add build and publish pipeline by Docker #53

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build the container image

on:
push:
branches:
- main
paths:
- Dockerfile
- src/**
- poetry.lock
- pyproject.toml

jobs:
build:
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64, arm64

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

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/llm-assistant:latest
ghcr.io/${{ github.repository }}/llm-assistant:${{ github.sha }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV POETRY_NO_INTERACTION=1 \

RUN pip install poetry==${POETRY_VERSION}

COPY pyproject.toml poetry.lock ./
COPY pyproject.toml poetry.lock README.md ./
samhwang marked this conversation as resolved.
Show resolved Hide resolved
COPY src ./src

RUN poetry install --compile --without dev
Expand Down
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
# Multifunctional LLM Assistant for Discord

## Dependencies Installation
This project is a multifunctional assistant bot for Discord. It is designed by VAIT to help our members with various tasks, such as testing LLM models and quickly review our members resume.

We will use [Poetry](https://python-poetry.org/docs/) in this project. Please visit the link to install poetry on your local machine.
## How to Run this Bot

After successfully installing Poetry, use the following command to install the project dependencies:

```shell
poetry install
```

This command will create a Python virtual environment and install all the required dependencies into that environment.

To activate the Python environment, run:

```shell
poetry shell
```

When you’re done working in the virtual environment, simply type:

```shell
exit
```

---

## Discord Bot Development

### Getting started
### Setting up the bot in Discord

- [Create a bot in discord](https://interactions-py.github.io/interactions.py/Guides/02%20Creating%20Your%20Bot/).
- Add that bot to a test server.
- Add that bot to your server server.
nqngo marked this conversation as resolved.
Show resolved Hide resolved
- When making the invite through OAuth2 URL Generator, make sure to enable `bot` and `applications.commands` options.
- Follow the [Invite your bot](https://interactions-py.github.io/interactions.py/Guides/02%20Creating%20Your%20Bot/) section for reference.
- Copy out `.env.example` into `.env`, and fill in the `DISCORD_BOT_TOKEN` and `DISCORD_GUILD_ID`.
- Now, run the bot code locally and test the bot on your server.
- Now, run the bot code locally; alternatively, you can deploy the bot in a docker-compose environment. See the sister repository [deploy-llm-bot](https://github.com/bifrostlab/deploy-llm-bot) for more information.
4 changes: 2 additions & 2 deletions src/discord_bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import interactions
import re
import llm
from settings import Settings
from discord_bot import llm
from discord_bot.settings import Settings


MODEL_CHOICES = ["gpt-3.5-turbo", "gpt-4", "phi"]
Expand Down