Coder Social home page Coder Social logo

abehan7 / doc-chatbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dissorial/doc-chatbot

0.0 0.0 0.0 2.6 MB

Document chatbot — multiple files, topics, chat windows and chat history. Powered by GPT.

JavaScript 1.33% TypeScript 96.43% CSS 2.25%

doc-chatbot's Introduction

doc-chatbot: GPT x Pinecone x LangChain

Features

  • Create multiple topics to chat about
  • Store any number of files to each topic
  • Create any number of chats (chat windows) for each topic
  • Upload files, convert them to embeddings, store the embeddings in a namespace and upload to Pinecone, and delete Pinecone namespaces from within the browser
  • Store and automatically retrieve chat history for all chats with local storage
  • Supports .pdf, .docx and .txt

TypeScript Next JS React TailwindCSS

+ LangChain and Pinecone

Note: If you'd like to set this up with google auth and mongoDB (as opposed to no auth and using local storage), have a look at this branch: mongodb-and-auth. However, that repo is several important commits behind this one and lacks certain features, so keep that in mind.

Main chat area Main chat area


Settings page

Settings page


Local setup & development

If you'd like to run this locally and deploy your own version, follow the steps below.

Clone the repo

git clone https://github.com/dissorial/doc-chatbot.git

Pinecone setup

API key

Create an account on Pinecone. Go to Indexes and Create index. Enter any name, put 1536 for Dimensions and leave the rest on default. Then go to API keys and Create API key.

Index name

Self-explanatory

Pinecone environment

Right next to your index name, e.g. us-west2-rkw


Install packages

yarn install

Set up your .env file

  • Rename .env.example to .env
  • Your .env file should look like this:
NODE_ENV=development

Node environment

  • Development by default. In production, set this to 'production' (without the quotes)

Other

  • In utils/makechain.ts, adjust the QA_PROMPT for your own usecase. Change modelName in new OpenAI to gpt-4, if you have access to it.

Deployment

Add these to your .env file:

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=
JWT_SECRET=

NextAuth Secret

  • You can generate this by running openssl rand -base64 32 in Git Bash.

JWT Secret

  • You can generate this by running openssl rand -base64 32 in Git Bash.

NextAuth URL


Run the app

npm run dev

Troubleshooting

General errors

  • Make sure that you are running the latest version of Node. To check your version run node -v.
  • If you're encountering issues with a specific file, try converting it to text first or try a different file. It's possible that the file is corrupted, scanned, or requires OCR to be converted to text.
  • Confirm that you're using the same versions of LangChain and Pinecone as this repository.

Pinecone errors

  • Confirm that you've set the vector dimensions to 1536.
  • Note that Pinecone indexes for users on the Starter (free) plan are deleted after 7 days of inactivity. To prevent this, send an API request to Pinecone to reset the counter before 7 days.
  • If issues persist, consider starting fresh with a new Pinecone project, index, and cloned repository.

Credit

This repository was originally a fork of GPT-4 & LangChain repository by mayooear but underwent many major changes in this repo.

Frontend of this repo is inspired by ChatGPT.

doc-chatbot's People

Contributors

dissorial avatar

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.