Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dotneet/smart-chatbot-ui
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: AmigoAppAI/open-gpt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 9 commits
  • 55 files changed
  • 7 contributors

Commits on Dec 9, 2023

  1. Copy the full SHA
    8e4a772 View commit details

Commits on Dec 14, 2023

  1. Azure open ai services setup (#3)

    * Setup support for Azure OpenAI Services
    
    * Fixed OpenAI api changes since package upgrade
    
    * Fixed issues after upgrading OpenAI package
    
    * Update env example to include new env vars
    
    * Maybe a fix?
    
    ---------
    
    Co-authored-by: Keith Gibson <keithwgibson74@gmail.com>
    EdwardPrentice and pureit-dev authored Dec 14, 2023
    Copy the full SHA
    440e4ad View commit details

Commits on Dec 18, 2023

  1. Bug fix for azure models (#4)

    * Setup support for Azure OpenAI Services
    
    * fixed issue with azure models
    pureit-dev authored Dec 18, 2023
    Copy the full SHA
    9f3f494 View commit details

Commits on Dec 21, 2023

  1. Copy the full SHA
    72c47b9 View commit details
  2. Version again

    EdwardPrentice committed Dec 21, 2023
    Copy the full SHA
    5f53717 View commit details
  3. Copy the full SHA
    fb568eb View commit details

Commits on Jan 22, 2024

  1. char by char

    salvatore-fxpig authored and EdwardPrentice committed Jan 22, 2024
    Copy the full SHA
    a59f206 View commit details
  2. Add token smoothing

    EdwardPrentice committed Jan 22, 2024
    Copy the full SHA
    e66310c View commit details

Commits on Mar 20, 2024

  1. auto-generated commit (#17)

    Co-authored-by: optimus <noreply@amigotech.ai>
    Amigo-The-Developer and optimus authored Mar 20, 2024
    Copy the full SHA
    7a84702 View commit details
Showing with 1,814 additions and 841 deletions.
  1. +20 −4 .env.local.example
  2. +2 −1 .github/dependabot.yml
  3. +59 −59 .github/workflows/deploy-docker-image.yaml
  4. +1 −1 .github/workflows/run-test-suite.yml
  5. +9 −0 CONTACT.md
  6. +14 −0 FEATURES.md
  7. +6 −6 Makefile
  8. +18 −52 README.md
  9. +114 −11 agent/agent.ts
  10. +29 −24 agent/agentConvo.ts
  11. +14 −8 agent/agentUtil.ts
  12. +2 −2 agent/plugins/google.ts
  13. +8 −8 components/Chat/Chat.tsx
  14. +3 −3 components/Chat/ChatInput.tsx
  15. +15 −8 components/Chat/ChatMessage.tsx
  16. +43 −22 components/Chat/ModelSelect.tsx
  17. +41 −25 components/Chatbar/components/ChatbarSettings.tsx
  18. +5 −5 docker-compose.dev.yml
  19. +3 −6 docker-compose.yml
  20. +24 −0 hooks/useTokenAddr.ts
  21. +3 −0 next.config.js
  22. +1,225 −489 package-lock.json
  23. +18 −16 package.json
  24. +1 −1 pages/_document.tsx
  25. +2 −2 pages/api/google.ts
  26. +2 −2 pages/api/home/home.tsx
  27. BIN public/amigo-logo.png
  28. +1 −1 public/locales/ar/chat.json
  29. +1 −1 public/locales/bn/chat.json
  30. +1 −1 public/locales/de/chat.json
  31. +1 −1 public/locales/es/chat.json
  32. +1 −1 public/locales/fr/chat.json
  33. +1 −1 public/locales/he/chat.json
  34. +1 −1 public/locales/id/chat.json
  35. +1 −1 public/locales/it/chat.json
  36. +1 −1 public/locales/ja/chat.json
  37. +1 −1 public/locales/ko/chat.json
  38. +1 −1 public/locales/pl/chat.json
  39. +1 −1 public/locales/pt/chat.json
  40. +1 −1 public/locales/ro/chat.json
  41. +1 −1 public/locales/ru/chat.json
  42. +1 −1 public/locales/si/chat.json
  43. +1 −1 public/locales/sv/chat.json
  44. +1 −1 public/locales/te/chat.json
  45. +1 −1 public/locales/vi/chat.json
  46. +1 −1 public/locales/zh/chat.json
  47. +1 −1 public/locales/zh_TW/chat.json
  48. +2 −2 scripts/create-mongodb-backup.sh
  49. +22 −6 server/routers/models.ts
  50. +7 −4 services/useApiError.ts
  51. +13 −10 types/openai.ts
  52. +12 −3 utils/app/const.ts
  53. +20 −10 utils/server/index.ts
  54. +31 −25 utils/server/openai.ts
  55. +6 −6 utils/server/similarity.ts
24 changes: 20 additions & 4 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chatbot UI
DEFAULT_MODEL=gpt-3.5-turbo
OPENAI_API_KEY=YOUR_KEY
OPENAI_API_KEY= # Either OpenAI or Azure OpenAI key
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT="You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown."

# Specify url to a json file that list available plugins.
@@ -18,8 +18,11 @@ GOOGLE_API_KEY=
GOOGLE_CSE_ID=

# MongoDB URI for Local
MONGODB_URI=mongodb://root:example@127.0.0.1:27017/
MONGODB_DB=chatui
MONGODB_URI=mongodb://root:password@127.0.0.1:27017/
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=password
MONGODB_DB=open-gpt

# MongoDB URI for docker-compose
# MONGODB_URI=mongodb://root:example@mongo:27017/
# MONGO_INITDB_ROOT_USERNAME=root
@@ -29,7 +32,6 @@ MONGODB_DB=chatui
NEXTAUTH_ENABLED=false
NEXTAUTH_EMAIL_PATTERN=.+@example.com
NEXTAUTH_URL=http://localhost:3000
# must replace if you use NextAuth
NEXTAUTH_SECRET=dummy
NEXTAUTH_SESSION_MAX_AGE=86400
GITHUB_CLIENT_ID=
@@ -40,8 +42,22 @@ COGNITO_CLIENT_ID=
COGNITO_CLIENT_SECRET=
COGNITO_ISSUER=

# Azure Auth
AZURE_AD_CLIENT_ID=
AZURE_AD_TENANT_ID=
AZURE_AD_CLIENT_SECRET=

# Audit Log
AUDIT_LOG_ENABLED=false

# For Debugging
DEBUG_AGENT_LLM_LOGGING=true


# Azure OpenAI Service
OPENAI_API_HOST= # https://<deployment_name>.openai.azure.com
OPENAI_API_TYPE= # openai or azure
OPENAI_API_VERSION= # e.g 2023-07-01-preview
AZURE_DEPLOYMENT_ID_EMBEDDINGS= # Your embeddings deployment name
AZURE_DEPLOYMENT_ID= # Your deployment name
AZURE_MODELS_PATH= # "models" or "deployments"
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -8,4 +8,5 @@ updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
interval: "daily"

118 changes: 59 additions & 59 deletions .github/workflows/deploy-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
name: Docker
# 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.
# # 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']
# 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 }}
# 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
# 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
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2.1.0

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# # 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 }}
# # 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 }}
# # 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
# # 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
2 changes: 1 addition & 1 deletion .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: node:16
image: node:20

steps:
- name: Checkout code
9 changes: 9 additions & 0 deletions CONTACT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contact Us!

Firstly, thank you for checking out this project!

The original author of this project is the incredible [McKay](https://twitter.com/mckaywrigley) so please redirect any gratitude his way!

If you'd like to discuss the project's current status, [AmigoAI Consulting](https://amigoapp.ai) is currently maintaining this project. The best way to get in touch is to email us at `edward {AT} amigoapp.ai`.

You can also find us [on Twitter](https://twitter.com/amigoai_) 🐦
14 changes: 14 additions & 0 deletions FEATURES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# OpenGPT | Free AI Chat UI

# Features, Architecture and Roadmap

- SSO Auth(Google, GitHub)
- ChatGPT compatible plugins
- Python Interpreter Plugin
- Persitent storage(MongoDB)
- IME support

[Contact Us](CONTACT.md)



12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@ include .env
.PHONY: all

build:
docker build -t chatbot-ui .
docker build -t open-gpt .

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
docker stop open-gpt || true && docker rm open-gpt || true
docker run --name open-gpt --rm -e OPENAI_API_KEY=${OPENAI_API_KEY} -p 3000:3000 open-gpt

logs:
docker logs -f chatbot-ui
docker logs -f open-gpt

push:
docker tag chatbot-ui:latest ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
docker push ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
docker tag open-gpt:latest ${DOCKER_USER}/open-gpt:${DOCKER_TAG}
docker push ${DOCKER_USER}/open-gpt:${DOCKER_TAG}
70 changes: 18 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,28 @@
# Smart Chatbot UI
# OpenGPT | Free AI Chat UI

This repo is forked from [chatbot-ui](https://github.com/mckaywrigley/chatbot-ui).
## News

This repository is highly experimental, so please do not expect compatibility when performing updates.
Forked from the amazing project from McKay of [Twitter](https://twitter.com/mckaywrigley) fame.

## [DEMO](https://smart-chatbot-ui.vercel.app/)
This project is actively maintained and will be extended to support

- Do not input personal information.
- Conversation, prompts, folders are stored in mongodb.
- Streaming response is not working in vercel environment.
- Plugins are not working for vercel timeout limitation.
Initial focus is on merging all outstanding PRs and fixing bugs.

## Additional Features
## About

- SSO Auth(Google, GitHub)
- ChatGPT compatible plugins
- Python Interpreter Plugin
- Persitent storage(MongoDB)
- IME support
An open source UI for use with cloud and local LLMs. Integrates with a wide range of models.

It is built with [Next.js](https://nextjs.org/) and [Tailwind CSS](https://tailwindcss.com/).

### [Launch OpenGPT now!](https://sage-gnome-98d99a.netlify.app/)

Please only use with information you're happy to share 😉

![Chatbot UI](./docs/screenshot_2023-05-08.png)

## Updates

- Chatbot UI will be updated over time.
- Expect frequent improvements.

**Recent updates:**

- [x] Python Interpreter (5/8/23)
- [x] Multiple Users with MongoDB Support (4/19/23)
- [x] Plugins(ChatGPT compatible) (4/17/23)
- [x] SSO Auth(email pattern matching only) (4/15/23)
- [x] Prompt templates (3/27/23)
- [x] Regenerate & edit responses (3/25/23)
- [x] Folders (3/24/23)
- [x] Search chat content (3/23/23)
- [x] Stop message generation (3/22/23)
- [x] Import/Export chats (3/22/23)
- [x] Custom system prompt (3/21/23)
- [x] Error handling (3/20/23)
- [x] GPT-4 support (access required) (3/20/23)
- [x] Search conversations (3/19/23)
- [x] Code syntax highlighting (3/18/23)
- [x] Toggle sidebar (3/18/23)
- [x] Conversation naming (3/18/23)
- [x] GitHub flavored markdown (3/18/23)
- [x] Add OpenAI API key in app (3/18/23)
- [x] Markdown support (3/17/23)
## Technical Specs

[Features](FEATURES.md)

## Deploy

@@ -128,7 +103,7 @@ When deploying the application, the following environment variables can be set:
| GOOGLE_API_KEY | | See [Custom Search JSON API documentation][GCSE] |
| GOOGLE_CSE_ID | | See [Custom Search JSON API documentation][GCSE] |
| MONGODB_URI | | See [Official Document](https://www.mongodb.com/docs/manual/reference/connection-string/) |
| MONGODB_DB | `chatui` | MongoDB database name |
| MONGODB_DB | `opengpt` | MongoDB database name |
| NEXTAUTH_ENABLED | `false` | Enable SSO authentication. set 'true' or 'false' |
| NEXTAUTH_EMAIL_PATTERN | | The email regex pattern granted access to chatbot-ui (ex `.+@example.com`) |
| NEXTAUTH_URL | `http://localhost:3000` | NextAuth Settings. See [Official Document](https://next-auth.js.org/configuration/options) |
@@ -209,13 +184,4 @@ PLUGINS_INTERNAL=wikipedia_search,google_search,python_interpreter
PYTHON_INTERPRETER_BACKEND=http://localhost:8080/api/run
```

## Vercel

- streaming response is not supported in vercel.
- plugin executing fails because of the timeout limit is too short in free plan.

## Contact

If you have any questions, feel free to reach out to me on [Twitter](https://twitter.com/santa128bit).

[GCSE]: https://developers.google.com/custom-search/v1/overview
[Contact Us](CONTACT.md)
Loading