Skip to content

Commit

Permalink
chatbot-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
warmice71 committed Dec 30, 2023
0 parents commit 03f1f31
Show file tree
Hide file tree
Showing 249 changed files with 23,449 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
.env.local
node_modules
test-results
8 changes: 8 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Chatbot UI
DEFAULT_MODEL=gpt-3.5-turbo
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT=You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.
OPENAI_API_KEY=YOUR_KEY

# Google
GOOGLE_API_KEY=YOUR_API_KEY
GOOGLE_CSE_ID=YOUR_ENGINE_ID
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# If you find my open-source work helpful, please consider sponsoring me!

github: mckaywrigley
69 changes: 69 additions & 0 deletions .github/workflows/deploy-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: ['main']

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/[email protected]

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
platforms: "linux/amd64,linux/arm64"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
24 changes: 24 additions & 0 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
container:
image: node:16

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: npm ci

- name: Run Vitest Suite
run: npm test
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
/test-results

# next.js
/.next/
/out/
/dist

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
.idea
pnpm-lock.yaml
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing Guidelines

**Welcome to Chatbot UI!**

We appreciate your interest in contributing to our project.

Before you get started, please read our guidelines for contributing.

## Types of Contributions

We welcome the following types of contributions:

- Bug fixes
- New features
- Documentation improvements
- Code optimizations
- Translations
- Tests

## Getting Started

To get started, fork the project on GitHub and clone it locally on your machine. Then, create a new branch to work on your changes.

```
git clone https://github.com/mckaywrigley/chatbot-ui.git
cd chatbot-ui
git checkout -b my-branch-name
```

Before submitting your pull request, please make sure your changes pass our automated tests and adhere to our code style guidelines.

## Pull Request Process

1. Fork the project on GitHub.
2. Clone your forked repository locally on your machine.
3. Create a new branch from the main branch.
4. Make your changes on the new branch.
5. Ensure that your changes adhere to our code style guidelines and pass our automated tests.
6. Commit your changes and push them to your forked repository.
7. Submit a pull request to the main branch of the main repository.

## Contact

If you have any questions or need help getting started, feel free to reach out to me on [Twitter](https://twitter.com/mckaywrigley).
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ---- Base Node ----
FROM node:19-alpine AS base
WORKDIR /app
COPY package*.json ./

# ---- Dependencies ----
FROM base AS dependencies
RUN npm ci

# ---- Build ----
FROM dependencies AS build
COPY . .
RUN npm run build

# ---- Production ----
FROM node:19-alpine AS production
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/package*.json ./
COPY --from=build /app/next.config.js ./next.config.js
COPY --from=build /app/next-i18next.config.js ./next-i18next.config.js

# Expose the port the app will run on
EXPOSE 3000

# Start the application
CMD ["npm", "start"]
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include .env

.PHONY: all

build:
docker build -t chatbot-ui .

run:
export $(cat .env | xargs)
docker stop chatbot-ui || true && docker rm chatbot-ui || true
docker run --name chatbot-ui --rm -e OPENAI_API_KEY=${OPENAI_API_KEY} -p 3000:3000 chatbot-ui

logs:
docker logs -f chatbot-ui

push:
docker tag chatbot-ui:latest ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
docker push ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Chatbot UI

## News

Chatbot UI 2.0 will launch on January 3rd, 2024.

See a [preview](https://x.com/mckaywrigley/status/1738273242283151777?s=20).

This repo will be completely overhauled with the updated codebase.

The old codebase will be available in a new repo.

There will be several hours of downtime on ChatbotUI.com while the new version is deployed.

We recommend exporting your data before the update!

## About

Chatbot UI is an open source chat UI for AI models.

See a [demo](https://twitter.com/mckaywrigley/status/1640380021423603713?s=46&t=AowqkodyK6B4JccSOxSPew).

![Chatbot UI](./public/screenshots/screenshot-0402023.jpg)

## Updates

Chatbot UI will be updated over time.

Expect frequent improvements.

**Next up:**

- [ ] Sharing
- [ ] "Bots"

## Deploy


53 changes: 53 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Security Policy


This security policy outlines the process for reporting vulnerabilities and secrets found within this GitHub repository. It is essential that all contributors and users adhere to this policy in order to maintain a secure and stable environment.

## Reporting a Vulnerability

If you discover a vulnerability within the code, dependencies, or any other component of this repository, please follow these steps:

1. **Do not disclose the vulnerability publicly.** Publicly disclosing a vulnerability may put the project at risk and could potentially harm other users.

2. **Contact the repository maintainer(s) privately.** Send a private message or email to the maintainer(s) with a detailed description of the vulnerability. Include the following information:

- The affected component(s)
- Steps to reproduce the issue
- Potential impact of the vulnerability
- Any possible mitigations or workarounds

3. **Wait for a response from the maintainer(s).** Please be patient, as they may need time to investigate and verify the issue. The maintainer(s) should acknowledge receipt of your report and provide an estimated time frame for addressing the vulnerability.

4. **Cooperate with the maintainer(s).** If requested, provide additional information or assistance to help resolve the issue.

5. **Do not disclose the vulnerability until the maintainer(s) have addressed it.** Once the issue has been resolved, the maintainer(s) may choose to publicly disclose the vulnerability and credit you for the discovery.

## Reporting Secrets

If you discover any secrets, such as API keys or passwords, within the repository, follow these steps:

1. **Do not share the secret or use it for unauthorized purposes.** Misusing a secret could have severe consequences for the project and its users.

2. **Contact the repository maintainer(s) privately.** Notify them of the discovered secret, its location, and any potential risks associated with it.

3. **Wait for a response and further instructions.**

## Responsible Disclosure

We encourage responsible disclosure of vulnerabilities and secrets. If you follow the steps outlined in this policy, we will work with you to understand and address the issue. We will not take legal action against individuals who discover and report vulnerabilities or secrets in accordance with this policy.

## Patching and Updates

We are committed to maintaining the security of our project. When vulnerabilities are reported and confirmed, we will:

1. Work diligently to develop and apply a patch or implement a mitigation strategy.
2. Keep the reporter informed about the progress of the fix.
3. Update the repository with the necessary patches and document the changes in the release notes or changelog.
4. Credit the reporter for the discovery, if they wish to be acknowledged.

## Contributing to Security

We welcome contributions that help improve the security of our project. If you have suggestions or want to contribute code to address security issues, please follow the standard contribution guidelines for this repository. When submitting a pull request related to security, please mention that it addresses a security issue and provide any necessary context.

By adhering to this security policy, you contribute to the overall security and stability of the project. Thank you for your cooperation and responsible handling of vulnerabilities and secrets.

Loading

1 comment on commit 03f1f31

@eliasdiek
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@warmice71 hey ,I'm looking for someone with your stack to work on our platform ,either as a freelancer or in a full time role . are you up for it ? contact me on telegram @eliasdiek or via email at [email protected]

Please sign in to comment.