Giter Club home page Giter Club logo

llm-chat-web-ui's Introduction

GenAI Chat

GenAI Chat is an open-source serverless alternative to ChatGPT.

Design Goals

There are plenty of open source alternatives like chatwithgpt.ai. The goal of this particular project was to make a version that:

  • Supports plugins
  • Supports open source LLMs
  • Is completely pay-per-use ($0/mo if unused)
  • Runs as a progressive web app
  • Has no automatic log out

This comes at the cost of:

  • Being less secure and more buggy
  • Requiring 3 cloud accounts to host (netlify, cockroachlabs, modal)

Demo

ezgif-5-0f5b8fee49

Features

  • Easy to add arbitrary plugins/functions/agents
  • Easy to add hugging face open source transformers (LLAMA 3)
  • OpenAI API streaming
  • Image generation (StableDiffusion XL, DALLE)
  • Automatic chat title generation
  • Sharable links (when you make a chat public)
  • Speech (STT) to Audio (TTS) voice chat

Setup

At a high level:

  • Netlify is used for cheap cloud functions and static hosting
  • Cockroach labs is used for cheap persistent storage
  • Modal is used for long-running functions and serverless GPU functions (this is the only thing that is not free)
  1. Fork this repo
  2. Create a postgres database on cockroachlabs (free)
  3. Create a netlify app and connect it to your fork (free)
  4. Add netlify env vars
DATABASE_URL (from cockroachlabs)
OPENAI_API_KEY (from openai)
  1. Create a modal account
  2. On modal create llm-chat-secret
# Required
DATABASE_URL (from cockroachlabs)
HUGGING_FACE_HUB_TOKEN (from huggingface)
OPENAI_API_KEY (from openai)

# Semi Optional
SERPER_API_KEY (from https://serper.dev/)
WOLFRAM_ALPHA_APPID (https://developer.wolframalpha.com/)

# Semi Optional File Storage (uses imgur if provided or falls back to s3)
IMGUR_CLIENT_ID
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_BUCKET_NAME
ELEVEN_API_KEY
  1. Deploy modal cd modal && modal deploy modalapp
  2. Create an API key cd modal && python scripts/create_user.py --name "John Smith"
  3. Update src\backend.js with deployed modal endpoint (API_ENDPOINT) OR use ?backend=<modal endpoint> in the URL at chat.sshh.io.
  4. Go to <netlify site>/?key=<API key>

Advanced

Add a new plugin

Note that plugins are only supported for openai functions agents.

Just add a new function to /modal/tools/tools.py.

Add a new model

  1. Update models/chat_hf_inference.py and adjust to whatever model you want

llm-chat-web-ui's People

Contributors

sshh12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

llm-chat-web-ui's Issues

Feature Ideas

  • Support arbitrary frontend/backend hosting
  • Obsidian-like features
    • Graph
    • Folders
    • Canvas
  • ChatGPT Plugins

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.