w00ing / chat-baker

Type in any URL to bake a personal chatbot!

Home Page:https://www.chat-baker.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat Baker

Type in any URL to bake a personal chatbot!

Untitled.mov

How it works

It uses Embeddings and ChatGPT API provided by OpenAI. First, it loads and converts the data from the source url to text using custom HTML parser. Then, it uses Embedings to index the text data and stores the results locally. Finally, when it takes an input from user, it queries that input from the previously made embeddings index to find the most relevant context, then sends the user input along with the context over the ChatGPT API.

Running Locally

Cloning the repository the local machine.

git clone

Creating a account on OpenAI to get an API key.

  1. Go to OpenAI to make an account.
  2. Click on your profile picture in the top right corner, and click on "View API Keys".
  3. Click on "Create new secret key". Copy the secret key.

Storing API key in .env file.

Create a file in root directory of project with env. And store your API key in it, as shown in the .example.env file.

Chromium executable path.

As Vercel serverless function is bound to AWS lambda, it does not allow dependencies larger than 50mb. So, we need to upload the Chromium executable to our storage and use it from there. You can use any storage you want.

Upload a Chromium brotli file to your storage, such as S3, or Github.

ex) https://github.com/Sparticuz/chromium/releases/download/v110.0.1/chromium-v110.0.1-pack.tar

Then, use process.env.CHROMIUM_PATH to store the path to the executable.

If you are running the application locally, provide the path to the Chromium executable to process.env.CHROMIUM_PATH_LOCAL.

Reference: https://github.com/Sparticuz/chromium#-min-package

Installing the dependencies.

yarn install

Running the application.

Then, run the application in the command line and it will be available at http://localhost:3000.

yarn dev

About

Type in any URL to bake a personal chatbot!

https://www.chat-baker.com


Languages

Language:TypeScript 93.8%Language:JavaScript 4.2%Language:CSS 2.0%